Max for Live: Get Instantaneous Float of Audio Signal

Ross Alger's icon

I'm a fairly new user to Max, and was hoping someone could assist in my attempt to acquire the amplitude of an Ableton live audio signal as a float value.

Max for live audio signals are transmitted through patch cords (yellow and grey wires) which cannot be connected to float objects. I'm wondering if there's an object/function that exists to decompose the audio signal into the instantaneous amplitude of the sound wave?

I'm not just looking for any kind of averaged volume value of the audio signal (since most of the objects I've found have a minimum averaging rate of 1 ms).

Comp1.amxd
amxd
Evan's icon

snapshot~ or number~ could be useful.

jninek's icon

Try sah~ or peakamp~

Reese Donohue's icon

snapshot~ and number~ both have minimums of 1ms.

Is there an audio-rate version that will output 44.1k data points/second?

Max Gardener's icon

This is one of those cases where someone would likely ask you "Why would you want to do that?" - not because they're being annoying, but because the answer might be better as a result.

For example, there are various things one might wish to do that could be done in MSP without leaving the audio domain at all.

The other bit of background for the question - as suggested by the list of objects like by those people who answered your question sah~ or number~ or snapshot~ (which sample signals from audio rate) has to do with what it is you wish to do with the values you get - the um... overhead associated with doing any kind of calculations at non-audio rates in Max is going to be considerable if you're spitting out floats or ints at 44.1 KHz..

So perhaps a little more detail on what you think you want to do would help to get you a better answer. What do you have in mind?

Andro's icon

I use snapshot to analyse audio levels for visuals at 5ms (cpu go's bonkers with a lot of instances at 1ms) and thats fast enough for no-one to see it lag.
Like Max said why do's it need to be 1ms ?

Evan's icon

If you are updating your visuals every 5 ms, then you're running at 200 fps. It's not likely that you need to grab the audio signal every 5 ms in order for no one to see it lag.

Roman Thilenius's icon

you wont need 44100 numbers per second and it will hardly be possible to caculate and display that anyway.

i would choose something like 25 frames per second: first do abs~, then get the max peak signal value every 40 ms, then convert that to a number every 40ms.

Charly Beck's icon

Hi,

i guess its like always: You need it depending on what you wanna do.

I wanted to create a FL-Studio Like waveshaper where the user can edit the function graph in a table object.

Therefor i need to lookup tha table at the x position corresponding to the sample resulting in two y values. Those i interpolate to get the output sample.

So this needs to be done in sample rate speed and has a interaction with the gui. I guess it will be hell implementing max4live in a way it can handle this.

But maybe there is another way to achieve this? How to get the info from the gui-world (table object) into the audio signal world and how to realize the lookup.

I have here a prototype. It has some bugs in the cuve generation and you can input/output samples using sliders. Nevertheless it shows how the approach should/could work.

PS: I just created account and posted the answer without verification. It didnt work so i hope it will not be duplicated now.

Cb_WaveShaper.amxd
application/octet-stream 91.72 KB
WaveShapingSliders