Closed vcidst closed 2 years ago
Hey, for anyone debugging this. Two things helped me working with G711 u-law audio,
type
variable should be 0. referencebuf.length
in my case was 160. I was observing overlapping audio playback, changing that to timestamp += 160
helped for smooth playback.I'm not precisely working with dialogflow so YMMV.
hey @vcidst ! Sorry for no reply over the weekend, I was ill.
I remember having this exact problem with ulaw and never put any real effort into solving it from memory. So you got further than me!
You think we could make this configurable? Would you be interested in doing a PR?
Thanks for following this up on the issue so others can take advantage of it :)
Hey Dan, hope you're doing well now. I'll share a PR soon with some configuration changes
I'm trying to get this repo to work with
OUTPUT_AUDIO_ENCODING_MULAW
encoding of dialogflow. However the audio playback to Asterisk is corrupted.There's a lot of things going on in
_sendAudioToAsterisk()
method. How did you debug/figure out this sorcery? I believe you're splitting the audio data into 320 byte packets and then playing them back in 20ms intervals (320 bytes/0.02s = 16k audio). Since I'm dealing with 8k audio, I tried changing theaudioByteSize
to 160 with 20ms intervals however I still hear corrupted audio.https://github.com/nimbleape/asterisk-dialogflow-rtp-audioserver/blob/5e5d014a7fcfeb526b9640d0963c3cc510d6775d/lib/DialogFlowConnector.js#L162-L191
I saved the audio data as binary file and was able to play it back correctly from
sox
(rate 8k, 8 bit, single channel, ulaw encoding)