### Realtime/dynamic mp3 compression (used as an effect)?

Has anyone come across a realtime mp3 encoder/decoder in Max?

More specifically where you can control the bit rate in dynamic fashion (ie, with a number box).

The idea is to use the loss of resolution as a sort of ‘digital tone knob’ of sorts.

My understanding of how mp3 analysis/encoding is not great, but I know it’s an FFT-based process, so I’m wondering if it’s possible to do something like that in Max, in realtime.

Or at the very least try to emulate the ‘sound’ of what’s happening.

I found this pseudo-code that sort of summarises what’s happening:

algorithm MP3 {

/*Input: An audio signal in the time domain

Output: The same audio signal, compressed

/*

Process the audio signal in frames

For each frame {

Use the Fourier transform to transform the time domain data to the frequency domain, sending

the results to the psychoacoustical analyzer {

Based on masking tones and masked frequencies, determine the signal-to-masking noise

ratios (SMR) in areas across the frequency spectrum

Analyze the presence and interactions of transients

}

Divide the frame into 32 frequency bands

For each frequency band {

Use the modified discrete cosine transform (MDCT) to divide each of the 32 frequency bands

into 18 subbands, for a total of 576 frequency subbands

Sort the subbands into 22 groups, called scale factor bands, and based on the SMR, determine

a scaling factor for each scale factor band

Use nonuniform quantization combined with scaling factors to quantize

Encode side information

Use Huffman encoding on the resulting 576 quantized MDCT coefficients

Put the encoded data into a properly formatted frame in the bit stream

}

}

Also curious if anyone has done ‘data moshing’ type processing on audio, keeping frequencies static until new ones take over (similar to the i/p frame stuff in datamoshing).

Hate to bump a somewhat old post, but does anyone have any ideas about this? I’d like to try and emulate something like http://mashable.com/2010/06/03/youtube-i-am-sitting/ – IE, really, really nasty audio codec compression. Doesn’t seem to be much literature on the subject, that I can find.

I’ve actually got something super handy going, though it uses a custom external by Alex Harker, with some additional code by a good friend of mine.

I tweaked it a bit so you can select an arbitrary range that wraps around the spectrum (it makes sense if you look at it). I’ve also got a stereo 1-band version, and a stereo multi-band version kicking around.

###### Attachments:

Wow, I was just looking for that! Thanks Rodrigo!

I was messing around with pfft~ a bit today, trying to get something like what I wanted. I think this works! At the very least, it’s… interesting. And sorta gross.

Bitcrush/sample rate reduce the phase/amplitude of a signal seperately from each other, as well as rounding the amplitude (but not the phase), and multiplying the phase (but not the amplitude). Try putting the phase at -1, it’s amusing. :D

It’s all pretty simple patching but it amuses me no less.

###### Attachments:

That sounds pretty slick too.

I’ve got mine incorporated with the ‘lofi’ module of my patch, along with regular sample/bit reduction type stuff. It plays real nice with that stuff.

Forums > MaxMSP