Page 1 of 1

audio buffer - how?

Posted: Mon Oct 03, 2022 8:47 pm
by tester
I just lost ability to think clearly on this one. Is it possible (and how) to make live audio buffer, that will store last few seconds of ongoing live source?

It would have to be something that as it adds new content on top, it removes the beginning, and shifts everything by amount of removed stuff, I guess. The buffer autoupdate could be paused, ant thus - stored content would be used as a sort of file.

Anyone did something like this?

Re: audio buffer - how?

Posted: Tue Oct 04, 2022 5:56 am
by Spogg
I may have completely misunderstood but it seems like you’re describing a delay with a control input. This input would pause the internal counter when activated. The tricky part would be to get the paused contents of the delay out into a file but I feel it in my bones that it could be done. Not sure how though…

Re: audio buffer - how?

Posted: Tue Oct 04, 2022 1:21 pm
by Tepeix
Hi,
I tried to make some memin code.. But i let those for later before succeeding avoiding crash..

But why not to use the wave write mono or stereo prim ?
(take time for me to find them.. (in 3.6) you need to open the option, in advanced, check the R&D Components)
Don't know for the others R&D components but the Write and read mem was always working for me.

Re: audio buffer - how?

Posted: Tue Oct 04, 2022 5:08 pm
by tester
Spogg, you might be right on the concept, delay is an equivalent of such buffer, I guess. But this buffer is not accessible as mem or array. But I may change the way how I think of what I have in mind. Maybe the 3 second buffer can be just recorded after pressing record, with an info, to wait for 3 secs. I want to combine live preview / file playback of audio with Martin''s implementation of Paul's stretch in "infinite" mode. A sort of FFT sound freezer.

Tepeix, these prims rather don't offer this. They record as the counter/ramp is progressing, and then you can re-record the content, it's like a radar.

Re: audio buffer - how?

Posted: Wed Oct 05, 2022 7:13 am
by Spogg
tester wrote:... this buffer is not accessible as mem or array. ...


Yeah that’s the problem. I suspect custom-made DSP code is needed.
One idea I had is you pause the delay counter then at that point the DSP code starts the recorder (which has the same memory size as the delay) and scans out the whole delay memory from start to end. Then the last 3 seconds or whatever can be saved into a wav file.
But I don’t know if this would function in the way you want…

Re: audio buffer - how?

Posted: Wed Oct 05, 2022 9:32 am
by tester
I thnink, this could be done using "mono to graph" prim, to sync things properly. But this produces single channel array, so before sending this to "array to mem" prim, the array would have to be interleaved with 0's or itself, I guess. This is because the "Wave read" prim outputs two channels (stereo).

// attaching a rough approach, I'm not certain of one thing yet.

Re: audio buffer - how?

Posted: Wed Oct 05, 2022 12:28 pm
by tester
silly me :mrgreen: :mrgreen: :mrgreen:

(fft freezer is from Martin)