Quantcast
Channel: naudio Work Item Rss Feed
Viewing all articles
Browse latest Browse all 738

Commented Issue: WasapiLoopbackCapture doesn't capture silence [16383]

$
0
0
Description:
When recording using WasapiLoopbackCapture, if all audio inputs go silent then the data available callback always returns 0 bytes recorded. This means that if you are recording to a file and you play one sound, it will record it, but then if you allow 10 seconds of silence in between and then play another sound, in the audio file the two sounds will appear right next to each other (without the 10 second silence).

Expected:
Silence should be included as data, even if it's empty data.

Repro:
1. Create a WasapiLoopbackCapture.
2. Register a DataAvailable callback and print out bytes received in callback
3. Call StartRecording
4. Turn off all audio
Note: Does not always occur, sometimes silence is recorded.

Other:
The silence case was also mentioned here: http://naudio.codeplex.com/discussions/203605
I looked into the code, it seems to be occurring in 'ReadNextPacket' where capture.GetNextPacketSize(); always returns 0 during silence, instead of returning a non-zero value and setting the silence flag. Not sure how to fix this :/
Comments: yes, unfortunately this is how WASAPI loopback capture works. You could fool windows by playing a stream of silence throughout the duration of the capture. Alternatively, you'd need to timestamp captured audio and insert the silence yourself. It's very annoying but not really a bug in NAudio.

Viewing all articles
Browse latest Browse all 738

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>