예제 #1
0
        public MixedAudioProvider(params NAudioProvider[] AudioProviders)
        {
            foreach (var provider in AudioProviders)
            {
                var bufferedProvider = new BufferedWaveProvider(provider.NAudioWaveFormat)
                {
                    DiscardOnBufferOverflow = true
                };

                provider.DataAvailable += (S, E) =>
                {
                    bufferedProvider.AddSamples(E.Buffer, 0, E.Length);
                };

                var sampleProvider = bufferedProvider.ToSampleProvider();

                var providerWf = provider.WaveFormat;

                // Mono to Stereo
                if (providerWf.Channels == 1)
                {
                    sampleProvider = sampleProvider.ToStereo();
                }

                // Resample
                if (providerWf.SampleRate != WaveFormat.SampleRate)
                {
                    sampleProvider = new WdlResamplingSampleProvider(sampleProvider, WaveFormat.SampleRate);
                }

                _audioProviders.Add(provider, sampleProvider);
            }

            if (_audioProviders.Count == 1)
            {
                _mixingWaveProvider = _audioProviders
                                      .Values
                                      .First()
                                      .ToWaveProvider16();
            }
            else
            {
                var mixingSampleProvider = new MixingSampleProvider(_audioProviders.Values);

                // Screna expects 44.1 kHz 16-bit Stereo
                _mixingWaveProvider = mixingSampleProvider.ToWaveProvider16();
            }

            var bufferSize = (int)
                             (
                (ReadInterval / 1000.0)
                * WaveFormat.SampleRate
                * WaveFormat.Channels
                * (WaveFormat.BitsPerSample / 8.0)
                             );

            _buffer = new byte[bufferSize];

            Task.Factory.StartNew(Loop, TaskCreationOptions.LongRunning);
        }
예제 #2
0
 public SignalNotePlayer()
 {
     mixer = new MixingSampleProvider(WaveFormat.CreateIeeeFloatWaveFormat(44100, 1))
     {
         ReadFully = true
     };
 }
예제 #3
0
        public async void PlaySound(MusicalNote[] musicalNotes, float gain, float time, SignalGeneratorType signalType)
        {
            var waveFormat = WaveFormat.CreateIeeeFloatWaveFormat(44100, 2);
            var mix        = new MixingSampleProvider(waveFormat);

            foreach (var I in musicalNotes)
            {
                var Signal = new SignalGenerator
                {
                    Gain      = gain,
                    Frequency = I.Frequency,
                    Type      = signalType
                }
                .Take(TimeSpan.FromSeconds(time));

                mix.AddMixerInput(Signal);
            }
            AudioOut.Stop();
            AudioOut.Init(mix);
            AudioOut.Play();
            while (AudioOut.PlaybackState == PlaybackState.Playing)
            {
                await Task.Delay((int)time * 1000);
            }
        }
예제 #4
0
        private void InitMixer()
        {
            InitOsc();

            List <ISampleProvider> samples = new List <ISampleProvider>();

            if (osc2Menu.SelectedIndex != -1)
            {
                samples.Add(osc2);
            }
            if (osc1Menu.SelectedIndex != -1)
            {
                samples.Add(osc1);
            }
            if (osc3Menu.SelectedIndex != -1)
            {
                samples.Add(osc3);
            }

            mixer = new MixingSampleProvider(samples);

            driverOut.Stop();
            driverOut.Dispose();
            driverOut = new WaveOut();
            driverOut.Init(mixer);
            WavePlay();
        }
        private static void Main(string[] args)
        {
            ISampleProvider provider1 = new SignalGenerator
            {
                Frequency = 1000.0f,
                Gain      = 0.5f
            };

            ISampleProvider provider2 = new SignalGenerator
            {
                Frequency = 1250.0f,
                Gain      = 0.5f
            };

            var takeDuration1 = TimeSpan.FromSeconds(5);     // otherwise it would emit indefinitely
            var takeDuration2 = TimeSpan.FromSeconds(10);

            var sources = new[]
            {
                provider1.Take(takeDuration1),
                provider2.Take(takeDuration2)
            };

            var mixingSampleProvider = new MixingSampleProvider(sources);

            var waveProvider = mixingSampleProvider.ToWaveProvider();

            WaveFileWriter.CreateWaveFile("test.wav", waveProvider);
        }
예제 #6
0
        public void InitializeAndPlay(MixingSampleProvider mixer)
        {
            _directSoundOutInstance.Init(mixer);
            _directSoundOutInstance.Play();

            PlaybackState = PlaybackState.Playing;
        }
예제 #7
0
        public static void RecordAudio(string outFile, int msToRecord)
        {
            string sysAudioFile = Helpers.CreateTempFileName(".wav");
            string micAudioFile = Helpers.CreateTempFileName(".wav");
            Thread sysThread    = new Thread(() => Audio.RecordSystemAudio(sysAudioFile, msToRecord));
            Thread micThread    = new Thread(() => Audio.RecordMicrophone(micAudioFile, msToRecord));

            sysThread.Start();
            micThread.Start();
            micThread.Join();

            using (var reader1 = new AudioFileReader(sysAudioFile))
            {
                using (var reader2 = new AudioFileReader(micAudioFile))
                {
                    reader1.Volume = 0.5f;
                    //reader2.Volume = 0.1f;
                    var mixer = new MixingSampleProvider(new[] { reader1, reader2 });
                    WaveFileWriter.CreateWaveFile16(outFile, mixer);
                }
            }

            File.Delete(sysAudioFile);
            File.Delete(micAudioFile);
        }
예제 #8
0
        public AudioOutputEngine(IAudioOutputDevice device)
        {
            System.Diagnostics.Debug.WriteLine($"Initializing a new audio output engine with {device.FriendlyName}");
            switch (device.Type)
            {
            case AudioOutputDeviceType.WaveOut:
                outputDevice = new WaveOut()
                {
                    DeviceNumber = (int)device.Identifier
                };
                break;

            case AudioOutputDeviceType.DirectSound:
                outputDevice = new DirectSoundOut((Guid)device.Identifier);
                break;

            case AudioOutputDeviceType.ASIO:
                outputDevice = new AsioOut((string)device.Identifier);
                break;
            }

            mixer = new MixingSampleProvider(WaveFormat.CreateIeeeFloatWaveFormat(SAMPLE_RATE, NUM_CHANNEL))
            {
                ReadFully = true
            };

            outputDevice.Init(mixer);
            outputDevice.Play();
        }
예제 #9
0
파일: Audio.cs 프로젝트: hnjm/CChat2
        public static void InitAll()
        {
            if (Initialized)
            {
                Main.Log("[AUDIO] Already initialized!");
                return;
            }

            Input                    = new WaveInEvent();
            Input.WaveFormat         = GetFormat();
            Input.BufferMilliseconds = 25;
            Input.DataAvailable     += NewInputData;
            Input.StartRecording();

            Mixer           = new MixingSampleProvider(GetFormat());
            Mixer.ReadFully = true;

            Output = new WaveOutEvent();
            Output.DesiredLatency = 60;
            Output.Init(Mixer);
            Output.Play();

            Initialized = true;
            Main.Log("[AUDIO] Initialized.");
        }
예제 #10
0
        public static void CreateMashup(string to, params string[] files)
        {
            if (files.Length < 2)
            {
                throw new Exception("Not enough files selected!");
            }

            var internalFormat = WaveFormat.CreateIeeeFloatWaveFormat(16000, 1);
            var toFormat       = WaveFormat.CreateIeeeFloatWaveFormat(44100, 1);
            var mixer          = new MixingSampleProvider(internalFormat);

            var readers             = files.Select(path => new Mp3FileReader(path)).ToList();
            var waveStreams         = readers.Select(WaveFormatConversionStream.CreatePcmStream).ToList();
            var resampledEnumerable = waveStreams.Select(stream => new MediaFoundationResampler(stream, internalFormat)).ToList();

            foreach (var resampled in resampledEnumerable)
            {
                mixer.AddMixerInput(resampled);
            }

            var waveProvider = new SampleToWaveProvider(mixer);

            using (var resampler = new MediaFoundationResampler(waveProvider, toFormat))
            {
                MediaFoundationEncoder.EncodeToMp3(resampler, to);
            }

            resampledEnumerable.Dispose();
            waveStreams.Dispose();
            readers.Dispose();
        }
예제 #11
0
        private void buttonSaveSignals_Click(object sender, EventArgs e)
        {
            var samplesList = new List <ISampleProvider> {
                wg1, wg2
            };

            var mixer = new MixingSampleProvider(samplesList);

            var waveOut = new WaveOut();

            waveOut.Init(mixer);
            //waveOut.Play();

            var saveSeconds = (int)numericUpDownSaveSignalsSeconds.Value;
            var sfd         = new SaveFileDialog {
                Filter = "WAV Файл|*.wav"
            };

            if (sfd.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            var osp = new OffsetSampleProvider(mixer)
            {
                TakeSamples = mixer.WaveFormat.SampleRate * saveSeconds * mixer.WaveFormat.Channels
            };

            WaveFileWriter.CreateWaveFile16(sfd.FileName, osp);
        }
예제 #12
0
        public static void ExportCustomIndices(List<CustomIndex> customIndices, string exportFolder, Dictionary<SampleGeneratingArgs, SampleSoundGenerator> loadedSamples=null) {
            foreach (CustomIndex ci in customIndices) {
                foreach (KeyValuePair<string, HashSet<SampleGeneratingArgs>> kvp in ci.Samples) {
                    if (kvp.Value.Count == 0) {
                        continue;
                    }
                    var samples = new List<ISampleProvider>();
                    var volumes = new List<double>();
                    int soundsAdded = 0;
                    
                    if (loadedSamples != null) {
                        foreach (SampleGeneratingArgs args in kvp.Value) {
                            if (SampleImporter.ValidateSampleArgs(args, loadedSamples)) {
                                var sample = loadedSamples[args];
                                samples.Add(sample.GetSampleProvider());
                                volumes.Add(sample.VolumeCorrection != -1 ? sample.VolumeCorrection : 1f);
                                soundsAdded++;
                            }
                        }
                    } else {
                        foreach (SampleGeneratingArgs args in kvp.Value) {
                            try {
                                var sample = SampleImporter.ImportSample(args);
                                samples.Add(sample.GetSampleProvider());
                                volumes.Add(sample.VolumeCorrection != -1 ? sample.VolumeCorrection : 1f);
                                soundsAdded++;
                            } catch (Exception) { }
                        }
                    }

                    if (soundsAdded == 0) {
                        continue;
                    }

                    int maxSampleRate = samples.Max(o => o.WaveFormat.SampleRate);
                    int maxChannels = samples.Max(o => o.WaveFormat.Channels);
                    IEnumerable<ISampleProvider> sameFormatSamples = samples.Select(o => (ISampleProvider)new WdlResamplingSampleProvider(SampleImporter.SetChannels(o, maxChannels), maxSampleRate));

                    ISampleProvider result = new MixingSampleProvider(sameFormatSamples);

                    if (soundsAdded > 1) {
                        result = new VolumeSampleProvider(result) {
                            Volume = (float)(1 / Math.Sqrt(soundsAdded * volumes.Average()))
                        };
                        result = new SimpleCompressorEffect(result) {
                            Threshold = 16,
                            Ratio = 6,
                            Attack = 0.1,
                            Release = 0.1,
                            Enabled = true,
                            MakeUpGain = 15 * Math.Log10(Math.Sqrt(soundsAdded * volumes.Average()))
                        };
                    }

                    // TODO: Allow mp3, ogg and aif export.
                    string filename = ci.Index == 1 ? kvp.Key + ".wav" : kvp.Key + ci.Index + ".wav";
                    CreateWaveFile(Path.Combine(exportFolder, filename), result.ToWaveProvider16());
                }
            }
        }
예제 #13
0
        public static void Start(int Device)
        {
            DeviceId = Device;
            byte[] silence = new byte[10000];
            Array.Clear(silence, 0, 5000);
            client.PlayVoice = true;
            decoder          = OpusDecoder.Create(48000, 1);
            players          = new Dictionary <int, BufferedWaveProvider>();

            foreach (ClientData data in client.ClientList())
            {
                BufferedWaveProvider player = new BufferedWaveProvider(new WaveFormat(48000, 16, 1));
                players[data.ClientId] = player;
                player.AddSamples(silence, 0, 5000);
            }

            mixer = new MixingSampleProvider(players.Select((playr) => playr.Value.ToSampleProvider()));

            Out = new WaveOut();
            Out.DeviceNumber = Device;
            Out.Init(mixer);
            Out.Play();

            Active = true;
        }
        public QueuedSpeechSynthesizer(ref MixingSampleProvider mspStandard, ref MixingSampleProvider mspLoopback, int volume, int rate)
        {
            synthesizer = new SpeechSynthesizer();

            this.volume = volume;
            this.rate   = rate;

            queue = new ObservableCollection <QSSQueueItem>();

            this.mspStandard = mspStandard;
            this.mspLoopback = mspLoopback;

            int samplerate = int.Parse(File.ReadAllLines("audioformat.txt")[0].Replace("Sample rate: ", ""));
            int channels   = int.Parse(File.ReadAllLines("audioformat.txt")[1].Replace("Channels: ", ""));

            if (channels == 1)
            {
                synthesizerAudioFormat = new SpeechAudioFormatInfo(samplerate, AudioBitsPerSample.Sixteen, AudioChannel.Mono);
            }
            else
            {
                synthesizerAudioFormat = new SpeechAudioFormatInfo(samplerate, AudioBitsPerSample.Sixteen, AudioChannel.Stereo);
            }
            waveFormat = new WaveFormat(samplerate, channels);

            startSpeakLoop();
        }
예제 #15
0
 void BeforeDeserialization(StreamingContext sc)
 {
     Instance = this;
     Mixer    = new MixingSampleProvider(WaveFormat.CreateIeeeFloatWaveFormat(16000, 2));
     Player   = new DirectSoundOut();
     Player.Init(Mixer);
 }
예제 #16
0
        private void GenerateToneWaveFile(string path, DtmfTone tone, int sampleRate, double duration, ISampleProvider noise = null)
        {
            var tone1 = new SignalGenerator(sampleRate, 1)
            {
                Gain      = 0.5,
                Frequency = tone.LowTone,
                Type      = SignalGeneratorType.Sin
            }
            .Take(TimeSpan.FromMilliseconds(duration));

            var tone2 = new SignalGenerator(sampleRate, 1)
            {
                Gain      = 0.5,
                Frequency = tone.HighTone,
                Type      = SignalGeneratorType.Sin
            }
            .Take(TimeSpan.FromMilliseconds(duration));

            var list = new List <ISampleProvider>(new[] { tone1, tone2 });

            if (noise != null)
            {
                list.Add(noise.Take(TimeSpan.FromMilliseconds(duration)));
            }

            var mix = new MixingSampleProvider(list);

            WaveFileWriter.CreateWaveFile16(path, mix);
        }
예제 #17
0
        public static void Merge(string[] paths)
        {
            IEnumerable <ISampleProvider> files = paths.Select(p =>
            {
                if (!File.Exists(p))
                {
                    throw new FileNotFoundException(message: $"The file {p} was not found.");
                }

                WaveStream temp = null;

                if (p.EndsWith(".mp3"))
                {
                    temp = new Mp3FileReader(p);
                }
                else if (p.EndsWith(".wav"))
                {
                    temp = new WaveFileReader(p);
                }
                else
                {
                    throw new FormatException(message: $"The file {p} is of an unsupported format.");
                    return(null);
                }

                if (temp.WaveFormat.SampleRate != 48000 || temp.WaveFormat.Channels != 2 || temp.WaveFormat.BitsPerSample != 16)
                {
                    return(new WaveFormatConversionProvider(new WaveFormat(48000, 16, 2), temp).ToSampleProvider());
                }

                return(temp.ToSampleProvider());
            });

            var fufu = new MixingSampleProvider(new WaveFormat(48000, 16, 2));
        }
예제 #18
0
        /// <summary>
        /// Mixes two wav files to a single wav file. (Unused).
        /// </summary>
        public void mix()
        {
            window.lockForMixing();

            WaveFileReader reader1 = new WaveFileReader(file1);
            WaveFileReader reader2 = new WaveFileReader(file2);

            int        maxSampleRate = Math.Max(reader1.WaveFormat.SampleRate, reader2.WaveFormat.SampleRate);
            WaveFormat format        = new WaveFormat(maxSampleRate, 1);

            MediaFoundationResampler resampler1 = new MediaFoundationResampler(reader1, format);
            var input1 = resampler1.ToSampleProvider();
            MediaFoundationResampler resampler2 = new MediaFoundationResampler(reader2, format);
            var input2 = resampler2.ToSampleProvider();

            ISampleProvider[] provider = { input1, input2 };

            MixingSampleProvider mixer = new MixingSampleProvider(provider);

            WaveFileWriter.CreateWaveFile16(mixfile, mixer);

            resampler1.Dispose();
            resampler2.Dispose();
            reader1.Close();
            reader2.Close();
            reader1.Dispose();
            reader2.Dispose();

            window.unlock();
        }
예제 #19
0
파일: Audio.cs 프로젝트: hnjm/CChat2
        public static void ClearAll()
        {
            if (!Initialized)
            {
                Main.Log("[AUDIO] Not initialized, cannot clear all!");
                return;
            }

            foreach (var item in Providers)
            {
                item.Value.ClearBuffer();
            }
            Providers.Clear();
            IDs.Clear();
            Mixer.RemoveAllMixerInputs();
            Output.Stop();
            Input.StopRecording();

            Mixer  = null;
            Output = null;
            Input  = null;
            maxID  = 0;

            Initialized = false;
            Main.Log("[AUDIO] Cleared all data, reset.");
        }
        public SoundcardSampleProvider(int sampleRate, List <ushort> receiverIDs, EventHandler <TransceiverReceivingCallsignsChangedEventArgs> eventHandler)
        {
            WaveFormat = WaveFormat.CreateIeeeFloatWaveFormat(sampleRate, 1);

            mixer = new MixingSampleProvider(WaveFormat)
            {
                ReadFully = true
            };

            receiverInputs   = new List <ReceiverSampleProvider>();
            this.receiverIDs = new List <ushort>();
            foreach (var receiverID in receiverIDs)
            {
                var receiverInput = new ReceiverSampleProvider(WaveFormat, receiverID, 4);
                receiverInput.ReceivingCallsignsChanged += eventHandler;
                receiverInputs.Add(receiverInput);
                this.receiverIDs.Add(receiverID);
                mixer.AddMixerInput(receiverInput);
            }

            landLineRing = new ResourceSoundSampleProvider(Samples.Instance.LandLineRing)
            {
                Looping = true, Gain = 0
            };
            mixer.AddMixerInput(landLineRing);
        }
 public PatternSampleProvider(Pattern pattern)
 {
     Samples         = new Samples();
     this.Sequencer  = new PatternSequencer(pattern, Samples);
     this.waveFormat = Samples.WaveFormat;
     mixer           = new MixingSampleProvider(waveFormat);
 }
예제 #22
0
        public ReceiverSampleProvider(WaveFormat waveFormat, ushort id, int voiceInputNumber)
        {
            WaveFormat = waveFormat;
            ID         = id;

            mixer = new MixingSampleProvider(WaveFormat)
            {
                ReadFully = true
            };

            voiceInputs = new List <CallsignSampleProvider>();
            for (int i = 0; i < voiceInputNumber; i++)
            {
                var voiceInput = new CallsignSampleProvider(WaveFormat, this);
                voiceInputs.Add(voiceInput);
                mixer.AddMixerInput(voiceInput);
            }
            ;

            blockTone = new BlockingToneSampleProvider(WaveFormat.SampleRate, 1)
            {
                Gain = 0, Frequency = 180
            };
            mixer.AddMixerInput(blockTone.ToMono());
            volume = new VolumeSampleProvider(mixer);
        }
예제 #23
0
        public PianoPlayer(int sampleRate = 44100, int channelCount = 2)
        {
            foreach (string filename in System.IO.Directory.EnumerateFiles("..\\..\\..\\..\\samples"))
            {
                //var components = filename
                var nameComponents = System.IO.Path.GetFileName(filename).Split('.');

                if ((!filename.Contains("-old")) && nameComponents[1] == "pp")
                {
                    var noteInfo = nameComponents[2];
                    var key      = PianoKey.Parse(noteInfo);
                    if (key != null)
                    {
                        key = new PianoKey(key.Octave + 1, key.Note);
                        var ar = new CachedSound(filename);

                        soundDict.Add(key, ar);
                    }
                }
            }

            Console.WriteLine("Loaded sounds.");

            outputDevice    = new DirectSoundOut(60);
            mixer           = new MixingSampleProvider(WaveFormat.CreateIeeeFloatWaveFormat(sampleRate, channelCount));
            mixer.ReadFully = true;
            outputDevice.Init(mixer);
            outputDevice.Play();
        }
예제 #24
0
        public frmIRSignalGenerator()
        {
            InitializeComponent();

            switchSignalTimer       = new Timer();
            switchSignalTimer.Tick += SwitchSignalTimer_Tick;

            generators = new List <SignalGenerator>();

            gen0           = new SignalGenerator();
            gen0.Type      = SignalGeneratorType.Sin;
            gen0.Frequency = 400;
            generators.Add(gen0);

            gen1           = new SignalGenerator();
            gen1.Type      = SignalGeneratorType.Sin;
            gen1.Frequency = 1000;
            generators.Add(gen1);

            gen2           = new SignalGenerator();
            gen2.Type      = SignalGeneratorType.Sin;
            gen2.Frequency = 1600;
            generators.Add(gen2);

            gen4           = new SignalGenerator();
            gen4.Type      = SignalGeneratorType.Sin;
            gen4.Frequency = 2200;
            generators.Add(gen4);

            gen8           = new SignalGenerator();
            gen8.Type      = SignalGeneratorType.Sin;
            gen8.Frequency = 2800;
            generators.Add(gen8);

            gen16           = new SignalGenerator();
            gen16.Type      = SignalGeneratorType.Sin;
            gen16.Frequency = 3400;
            generators.Add(gen16);

            gen32           = new SignalGenerator();
            gen32.Type      = SignalGeneratorType.Sin;
            gen32.Frequency = 4000;
            generators.Add(gen32);

            gen64           = new SignalGenerator();
            gen64.Type      = SignalGeneratorType.Sin;
            gen64.Frequency = 4600;
            generators.Add(gen64);

            gen128           = new SignalGenerator();
            gen128.Type      = SignalGeneratorType.Sin;
            gen128.Frequency = 5200;
            generators.Add(gen128);

            provider = new MixingSampleProvider(generators);

            wo = new WaveOutEvent();
            wo.Init(provider);
        }
예제 #25
0
        public static async Task <ISampleProvider> PlaySound(this MixingSampleProvider mixer, string path,
                                                             SampleControl sampleControl)
        {
            var sound = await CachedSound.GetOrCreateCacheSound(path).ConfigureAwait(false);

            PlaySound(mixer, sound, sampleControl, out var rootSample);
            return(rootSample);
        }
예제 #26
0
        public DrumPatternSampleProvider(DrumPattern pattern)
        {
            var kit = new DrumKit();

            this.sequencer  = new PatternSequencer(pattern, kit);
            this.waveFormat = kit.WaveFormat;
            mixer           = new MixingSampleProvider(waveFormat);
        }
예제 #27
0
 public AudioPlaybackEngine(WaveOut waveOut, int sampleRate = 44100, int channelCount = 2)
 {
     _waveOut         = waveOut;
     _mixer           = new MixingSampleProvider(WaveFormat.CreateIeeeFloatWaveFormat(sampleRate, channelCount));
     _mixer.ReadFully = true;
     _waveOut.Init(_mixer);
     _waveOut.Play();
 }
예제 #28
0
 internal NAudioTrack(NAudioPlayer player, MixingSampleProvider outputMixer, AudioFileReader inputStream, string fileName)
 {
     this.player      = player;
     this.outputMixer = outputMixer;
     this.inputStream = inputStream;
     this.fileName    = fileName;
     sampleProvider   = new SampleWrapper(inputStream.ToSampleProvider());
 }
예제 #29
0
 /// <summary>
 /// Create a new instance of the playback engine.
 /// </summary>
 /// <param name="sampleRate">For all input sounds that will be played</param>
 /// <param name="channelCount">Output channel count</param>
 public AudioPlaybackEngine(int sampleRate = 44100, int channelCount = 2)
 {
     outputDevice    = new WaveOutEvent();
     mixer           = new MixingSampleProvider(WaveFormat.CreateIeeeFloatWaveFormat(sampleRate, channelCount));
     mixer.ReadFully = true;
     outputDevice.Init(mixer);
     outputDevice.Play();
 }
예제 #30
0
        public static async Task <ISampleProvider> PlaySound(this MixingSampleProvider mixer, string path,
                                                             float volume, float balance)
        {
            var sound = await CachedSound.GetOrCreateCacheSound(path).ConfigureAwait(false);

            PlaySound(mixer, sound, volume, balance, out var rootSample);
            return(rootSample);
        }