Hi. In attempt to implement an AudioSocket server, I found that all audio that I return to Asterisk is really distrorted. Simply making a loopback of my own voice works ok, but passing a Google Text-to-Speech response to Asterisk messed audio quality really bad (almost at the beginning of audio track it speeds up). At GitHub - NormHarrison/audiosocket_server: Asterisk AudioSocket server in Python I found that I have to return exactly 320 bytes of audio, yet how is it possible with GSM, where libgsm returns only 33 bytes per 160 samples. Attempting to return whole buffer at once, or only 33 bytes per request results in the same audio quality. Is there any implementation of AudioSocket server with GSM support or any mistakes that I can resolve?
According to the documentation, even the current documentation, the protocol only supports 16 bit 8kHz signed linear. You have to transcode.
I’m surprised that throwing GSM at it produced anything intelligible, at all.
I tried it before attempting to do any GSM stuff, but it provided same results. Google already returns everything, that satisfies this condition, yet audio is as distorted, as with GSM. There is not a lot of materials covering AudioSocket, yet Golang implementation (the only one I found that is using TTS) does literally same thing as I covered before - retrieves results from Google and sends them back. I haven’t tested Golang implementation of AudioSocket, and I’m not sure about audio quality there, but did it occured to anyone but me?
I’m pretty sure that the code is community maintained, and I suspect there is only one author. If that author doesn’t frequent here, you are probably not going to get any detailed support, or get any bugs fixed.
Go implementation is working flawlessly, so it’s only up to me to fix my own implementation. Thanks for responses!