naudio-framework

How to convert Linear16 PCM wav to G711 8-bit 8-khz MULAW wav with same quality as g711.org?

送分小仙女□ 提交于 2020-01-06 07:57:12
问题 I am using NAudio to attempt to convert Linear16 PCM wav files that come out of a 3rd party Text-To-Speech API to G711 8-bit 8-khz MULAW that will work as a telephony prompt. Using techniques found in the library authors documentation and some stack overflow posts and specifically following suggestion to do a 2 step conversion. dynamic foo = JsonConvert.DeserializeObject<dynamic>(result); byte[] decoded = Convert.FromBase64String(foo.audioContent.ToString()); WaveFormat newFormat = new

Prepend WAV Header in NAudio

天涯浪子 提交于 2019-12-02 22:13:41
问题 I am resampling MP4 (Audio) file into WAV using MediaFoundationReader and ResamplerDmoStream to WaveFormat(16000, 16, 1). After resampling I send the stream to speech API for transcription, but the API fails because the stream does not contain the WAV header. If I save the stream to WAV file (using WaveFileWriter), read the file again and then send the stream to API then the API works because the stream contains the WAV header. Is there a way to prepend the WAV header to the stream after

Prepend WAV Header in NAudio

为君一笑 提交于 2019-12-02 08:40:25
I am resampling MP4 (Audio) file into WAV using MediaFoundationReader and ResamplerDmoStream to WaveFormat(16000, 16, 1). After resampling I send the stream to speech API for transcription, but the API fails because the stream does not contain the WAV header. If I save the stream to WAV file (using WaveFileWriter), read the file again and then send the stream to API then the API works because the stream contains the WAV header. Is there a way to prepend the WAV header to the stream after ResamplerDmoStream resampling in order to prevent the time-costly I/O? You can use WaveFileWriter to write

WasapiLoopbackCapture internal audio recognition gives jibberish and text when no audio

只谈情不闲聊 提交于 2019-11-28 08:27:53
问题 I finally have built a program to listen to the internal audio loopback using NAudio, and output recognized text. The problem is it listens, and always says, eg: Recognized text: had Recognized text: had Recognized text: had Recognized text: had Recognized text: had had phone Le K add phone Laton Recognized text: had phone looked had phone looked had phone looked had phone lo oked zone Recognized text: had phone lines to had, had phone looked had phone looked had p hone line had phone