i wan to append two or more wav files and then play them , in c#. Actually im working on Urdu TTS.
plzzz can anyone help me in doing this.
Loading
i wan to append two or more wav files and then play them , in c#. Actually im working on Urdu TTS.
plzzz can anyone help me in doing this.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Mike GoldPosted Aug 1, 2005, 7:24 PM
I got this code from public joe's. It can also be found on this site. Basically you use pinvoke to call
into the multimedia dll and play the sound
// PlaySound()
[DllImport( "winmm.dll", SetLastError = true,
CallingConvention = CallingConvention.Winapi)]
static extern bool PlaySound( string pszSound,
IntPtr hMod,
SoundFlags sf );
// Flags for playing sounds. For this example, we are reading
// the sound from a filename, so we need only specify
// SND_FILENAME | SND_ASYNC
[Flags]
public enum SoundFlags : int
{
SND_SYNC = 0x0000, // play synchronously (default)
SND_ASYNC = 0x0001, // play asynchronously
SND_NODEFAULT = 0x0002, // silence (!default) if sound not found
SND_MEMORY = 0x0004, // pszSound points to a memory file
SND_LOOP = 0x0008, // loop the sound until next sndPlaySound
SND_NOSTOP = 0x0010, // don't stop any currently playing sound
SND_NOWAIT = 0x00002000, // don't wait if the driver is busy
SND_ALIAS = 0x00010000, // name is a registry alias
SND_ALIAS_ID = 0x00110000, // alias is a predefined ID
SND_FILENAME = 0x00020000, // name is file name
SND_RESOURCE = 0x00040004 // name is resource name or atom
}
void PlayIt()
{
PlaySound( "mywavefile.wav", 0 , 0);
}
To combine the file check out http://ccrma.stanford.edu/courses/422/projects/WaveFormat/
Use a BinaryReader and Writer to read and write the bytes into a byte array, and also manipulate
the byte header information and data chunks.
Also check out http://www.borg.com/~jglatt/tech/wave.htm
and http://www.sonicspot.com/guide/wavefiles.html
-Mike G