I have been working on a small background utility in Csound that monitors online utility metrics and triggers ambient audio notifications and sonified alerts whenever reference data updates. I wrote a Python opcode routine inside my Csound instrument loop to fetch and parse billing data directly from here, but I keep running into audio stutter and buffer underruns whenever the HTTP request experiences high latency or handshake delays.
The k-rate processing thread seems to block while waiting for the network response, which causes severe dropouts in the real-time DAC output. Along with the thread-blocking issue, I am also having trouble figuring out how to handle network timeouts and SSL certificate exceptions cleanly without crashing the entire Csound engine instance.
Has anyone implemented an asynchronous, non-blocking method or a separate worker thread with OSC/named pipes to feed external web data into Csound without choking the main audio synthesis loop? Any advice on best practices for handling asynchronous polling alongside real-time DSP would be greatly appreciated.