1
votes

I have a recorder application(CSHARP) where i use NAudio to record/playback audio. Our need is to Insert and overwrite audio in an existing wav file. Currently, for inserting audio, i use the current position of the wav file and do a split. Merge the new wav file to original one and merge with the rest of the file. When overwrite, i take the current position of the original audio and merge the new audio from that position. This process seem to work ok but for some reason i think reading the file and writing a file takes a big toll. When we do a fast recording,stop recording, rewinding, recording, stop recording and so on.. the request to file gets clogged up and at some point i get File IO exception error saying "The file is in use by another process.." (Note: We use a footpedal equipment with 3 keys assigned for recording, play and rewind. The issue we have is when we bang on the pedals faster.)

i am really stuck at this point as i am unable to resolve this issue. I will need some expert help. Is there a way to insert audio from a specific position in a file without doing Split and Merge? PLSSSSSSSSS Help!!

1

1 Answers

0
votes

Overwriting audio in a WAV file is not too difficult, and when I need to do this, I use a customised version of WaveFileWriter that can open an existing WAV file, and lets you reposition within the data chunk.

Inserting on the other hand is always going to be problematic, since you need to shift all the audio after the insert point forwards. I'd be tempted to create a separate "insert" wav file, and then after your whole recording session is finished, stitch the parts together into a final WAV file.