c# - NAudio ASIO mixing -


i'm trying make simple daw in c# naudio , winforms. goal of program @ stage able record microphone while playing couple of audio files. project far combination of asio-samples came naudio , information on internet.

i have 1 audiofilereader-object each audiofile want play:

reader = new audiofilereader("audio 8_01.wav");  reader2 = new audiofilereader("audio 9_04.wav"); reader3 = new audiofilereader("click.l.wav"); reader4 = new audiofilereader("click.r.wav"); 

when pressing play-button audio-clips should start playing , recording should start on channel 1:

private void play()     {         // allow change device         if (asioout != null &&             (asioout.drivername != getdriveroutcomboboxtext() ||             asioout.channeloffset != 0))         {             asioout.dispose();             asioout = null;         }          int recordchannelcount = 0;           mix = new mixingwaveprovider32();          //console.writeline("channels: " + mix.waveformat.channels );         mix.addinputstream(reader);         mix.addinputstream(reader2);         mix.addinputstream(reader3);         mix.addinputstream(reader4);         console.writeline("channels: " + mix.waveformat.channels);           if (asioout == null)         {             asioout = new asioout(getdriveroutcomboboxtext());             recordchannelcount = 1;             asioout.channeloffset = 0;             asioout.initrecordandplayback(mix , recordchannelcount, 96000);             asioout.audioavailable += onasiooutaudioavailable;          }          outfilename = path.combine(path.gettemppath(), guid.newguid() + ".wav");         console.writeline("file: " + outfilename);         writer = new wavefilewriter(outfilename, new waveformat(96000, recordchannelcount));          reader.position = 0;         asioout.play();         timer1.enabled = true;         //setbuttonstates();     } 

i use mixingwaveprovider able play multiple files @ same time. works somewhat, if audiofiles in readers stereo audio sound in both speakers , mix.waveformat.channels 2 before , after adding file-readers mixer. if files mono-audio played in either left or right speaker depending on asioout.channeloffset being set 0 or one. don't know how set channel each audiofile played, , want able adjust panning, ie. mono-sound being played in both speakers degrees. feel there i'm missing...i have seen patchbay-example program mark heath has written don't know how apply project. audio files in same format way.

the other problem might related, otherwise i'll post new question, audio being recorded(which works fine way) not audible in speakers during recording, ie. no monitoring during recording. how can send signal being recorded same mixer files being sent to?

thanks!

this might late answer, when have pan audio, use wavechannel32 class in naudio. simple vb.net example:

  dim mixer new mixingwaveprovider32()   dim audioreader new audiofilereader("sourcefile.mp3")   dim wav32 new wavechannel32(audioreader)    wav32.pan = -0.5    mixer.addinputstream(wav32) 

Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -