audio buffer - how?

DSP related issues, mathematics, processing and techniques
Post Reply
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

audio buffer - how?

Post 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?
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: audio buffer - how?

Post 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…
Tepeix
Posts: 361
Joined: Sat Oct 16, 2021 3:11 pm

Re: audio buffer - how?

Post 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.
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: audio buffer - how?

Post 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.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
User avatar
Spogg
Posts: 3368
Joined: Thu Nov 20, 2014 4:24 pm
Location: Birmingham, England
Contact:

Re: audio buffer - how?

Post 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…
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: audio buffer - how?

Post 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.
Attachments
snapshot.fsm
(330.7 KiB) Downloaded 692 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: audio buffer - how?

Post by tester »

silly me :mrgreen: :mrgreen: :mrgreen:

(fft freezer is from Martin)
Attachments
fft-freezer.fsm
(30.31 KiB) Downloaded 703 times
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Post Reply