Python - treat file as a sliding window with continuously incrementing pointer?

36 views Asked by At

I'm playing around with a middleware solution for streaming audio from my computer to a Sonos Play:1 speaker that has no Bluetooth, but can read files from a network location.

The basic structure I have in mind is that I would record audio output from the windows Stereo Mix to a fixed-size file object that could be read by the speaker.

The challenges I'm running up against are figuring out how to essentially treat a file like a FIFO queue, with older audio data being removed as new audio data is written, while also allowing the file pointer value to continuously increment.

Any help, thoughts, or links to questions that this might duplicate would be appreciated, thanks!

Just trying to work this out conceptually. I have used pyaudio to record the stereo mix to a file. I just need to figure out the file handling part and it's difficult to wrap my head around.

0

There are 0 answers