Pages Navigation Menu

SHOWFUN - Show & Fun & More!

Block Transfers, Buffers, and Audio

Waiting for Visual Studio to update, so I thought I’d write something.

When working with streams such as file or audio processing, you usually run into the same problem: How to copy the most data without knowing how large the stream of data is. I solved a similar problem at work and in my audio synthesizer. In the case of the synthesizer, I wanted an echo effect that fed back N stored seconds of audio.

Here’s how a simple block transfer could look:

For a block_size of 100 and a src_size of 550, you would make 6 writes of sizes:100 100 100 100 100 50The echo effect was a bit different: I have two buffers of known length, but one of the buffers is circular and has a read and write head at two different positions within that buffer.Stepping through, you might see something like this for an audio buffer sized 50, and an echo buffer sized 190, and a delay of 85 samples:As you can see, the entire audio buffer is covered: sum(`take`) group by `buf#`And neither rdx+take nor wdx+take extends past the echo buffer’s 190 samples.Okay, that’s all for now.See you around.

Leave a Comment

Captcha image