NAudio
NAudio copied to clipboard
I can only hear one sound when playing multiple audio file files
I use the sample code Fire and Forget Audio Playback with NAudio, I can only hear one sound when playing multiple audio file files. I can hear multiple sounds through Thread.Sleep(500), but the sound continuity is not good.
My code is: Namespace ConsoleApp1 { Class Program { Static void Main(string[] args) {
// on startup:
Var kick = new CachedSound("Samples\kick-trimmed.wav"); Var crash = new CachedSound("Samples\crash-trimmed.wav"); Var snare = new CachedSound("Samples\snare-trimmed.wav");
// later in the app... AudioPlaybackEngine.Instance.PlaySound(kick); //System.Threading.Thread.Sleep(500); AudioPlaybackEngine.Instance.PlaySound(crash); //System.Threading.Thread.Sleep(500); AudioPlaybackEngine.Instance.PlaySound(snare);
// on shutdown //AudioPlaybackEngine.Instance.Dispose();
Console.ReadLine(); } } }
The function I want to achieve is to play a phone number or other digital sound through different sounds.
My file is a single digital sound
Hi,
Did you ever solve this problem? I am stuck at the same place and only one sound plays. Adding the sleep is not really a solution.
thanks