NAudio icon indicating copy to clipboard operation
NAudio copied to clipboard

I can only hear one sound when playing multiple audio file files

Open fengjiannan2010 opened this issue 5 years ago • 1 comments

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

fengjiannan2010 avatar Oct 31 '19 15:10 fengjiannan2010

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

azhali avatar Jul 18 '21 22:07 azhali