Writing data to an audiosocket

Hey everyone, I’ve been experimenting with Audiosockets, and I’ve managed to get a flow to read data just fine, but I’m having some challenges with writing data. As a simple test, I recorded the raw ulaw data that I received from an audiosocket (160 bytes at a time), and then tried to write it back to the same audiosocket. This just gave me a very short, loud burst of noise, then dropped the connection. I figured this was because I was sending data too quickly, which looking at the sample go library made sense. I put a delay in and send audio in 20ms chunks, which worked, but was also very poor quality/stuttering. Just wondering if this is expected from this type of implementation, or if there’s a better way to write to an audiosocket other than putting in 20ms delays after each block is sent.

Use case here is integrating with cloud TTS services (in this case, Azure cognitive). As a workaround I can render the TTS to a file and then play that back over HTTP, but I’d like to explore the audiosocket method as well.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.