how to get min/max from mem (audio data) directly?

For general discussion related FlowStone
Post Reply
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

how to get min/max from mem (audio data) directly?

Post by tester »

Problem.

Loaded audio file is stored in mem,

In order to calculate min/max values - the simplest way is to convert mem to array and go from there.

But if loaded audio file is large (say 400-600MB), then in such cases I get a message, that there not enough memory (task manager confirms it), which is correct. So green arrays are not in the game.

Is there a way to get min/max values directly from mem connector, or in a way, that memory is not overloaded?
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
User avatar
martinvicanek
Posts: 1334
Joined: Sat Jun 22, 2013 8:28 pm

Re: how to get min/max from mem (audio data) directly?

Post by martinvicanek »

Here is a code version, takes about 2 seconds for an entire song here. Not sure about the max file size. If your file is too big to load and process in one go break it into pieces.
Attachments
MaxFinder.fsm
(2.71 KiB) Downloaded 1032 times
tester
Posts: 1786
Joined: Wed Jan 18, 2012 10:52 pm
Location: Poland, internet

Re: how to get min/max from mem (audio data) directly?

Post by tester »

This is not going to fit in such raw form.

From what I see, 23.5MB wave file (2'20") eats 280MB of memory (38MB empty flowstone, and - 131MB after clearing the file; there is a memory issue related to releasing memory). This is because there are several places in greenery, where array of floats is created/duplicated (analyzers are the starting points). So with larger files, it will not load at all in this form.

Perhaps, loop based recalc, so that at each cycle
1) index is incresed by certain fixed amount (15 cycles per 30 mins in 2mins parts let say)
2) small fixed NS is used for analyzer (bonded with step size above)
3) all steps are queued, and max of them is sent output
4) single analyzer was used (global max for normalizing)
would to the job.

In the meantime my question is - can be the max value (for calculating normalize value) taken directly from mem connector, without pushing the whole file into green array of floats? So the output would be like a readout with blue S&H or something like it.

In FS there is a prim, for converting mem into smaller (via average) arrays of floats for creating graphs, so this indicates, that this is perhaps possible. BTW, such averaged smaller arrays from it can't be used as a normalizing baxe due to averaging.
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: how to get min/max from mem (audio data) directly?

Post by tester »

I think I have an idea.

Probably no analyzer needed.

1) Counter, with step set to play it at 1000x speed (will go at max CPU I guess)
2) Single playback limiter
3) waveread out connected to min/max modules directly on node 1, and via "1 sample delay" to node 2 (alternatively, output looped to node 2, I guess there is a 1 sample delay anyway). This approach will always send to output the maximum value of 2 points, resulting with maxpoint at the end
4) blue'ish sample and hold (maybe even not needed - greenery may hold it too) to store the final value.

So this is sample-by-sample approach, but at audio (free rendering) performance.
Need to take a break? I have something right for you.
Feel free to donate. Thank you for your contribution.
Post Reply