예제 #1
0
        public byte[] GenerateSound(string str)
        {
            List <byte[]> sound = new List <byte[]>();

            str = str.ToLower();
            var lastPhonem = "";

            for (int i = 0; i < str.Length; i++)
            {
                if (!_stopSounds.Contains(lastPhonem))
                {
                    try
                    {
                        var newSound = _sounds[Convert(lastPhonem + str[i])];
                    }
                    catch (Exception ex)
                    {
                        sound.Add(_sounds[Convert(lastPhonem)]);
                        lastPhonem = "";
                    }
                }
                else
                {
                    lastPhonem = "";
                }
                lastPhonem += str[i];
            }
            try
            {
                sound.Add(_sounds[Convert(lastPhonem)]);
            }
            catch (Exception ex) { }
            return(WaveIO.Merge(sound));
        }
예제 #2
0
        private void c1Button7_Click(object sender, EventArgs e)
        {
            //mciSendString("Close MyMp3", tmpBuffer, 0, 0);
            String pathfile = "";

            pathfile = System.IO.Path.GetDirectoryName(Application.ExecutablePath);

            string tmpFilename = pathfile + "\\sound\\sample.mp3";

            tmpFilename = pathfile + "\\sound\\invite_number.wav";
            arrPlay.Add(tmpFilename);
            tmpFilename = pathfile + "\\sound\\a.wav";
            arrPlay.Add(tmpFilename);
            tmpFilename = pathfile + "\\sound\\0.wav";
            arrPlay.Add(tmpFilename);
            tmpFilename = pathfile + "\\sound\\0.wav";
            arrPlay.Add(tmpFilename);
            tmpFilename = pathfile + "\\sound\\0.wav";
            arrPlay.Add(tmpFilename);
            tmpFilename = pathfile + "\\sound\\1.wav";
            arrPlay.Add(tmpFilename);
            tmpFilename = pathfile + "\\sound\\at_slot.wav";
            arrPlay.Add(tmpFilename);
            tmpFilename = pathfile + "\\sound\\4.wav";
            arrPlay.Add(tmpFilename);
            tmpFilename = pathfile + "\\sound\\ka.wav";
            arrPlay.Add(tmpFilename);
            WaveIO wa = new WaveIO();

            wa.Merge(arrPlay, pathfile + "\\sound\\sound.wav");
            //MemoryStream sound  wa.MergetoStream(arrPlay);

            //MemoryStream stream = bqc.CombineFileStrean(arrPlay);
            //stream.Position = 0;
            //SoundPlayer sound = new SoundPlayer(stream);
            SoundPlayer sound1 = new SoundPlayer(pathfile + "\\sound\\sound.wav");

            sound1.Play();
            sound1.Dispose();
        }