Spectrogram inversion

Francesco Maccario's icon

Hi,
I was wondering if it's possible to invert the spectrogram view.
I would like to create a symmetric spectrum for stereo signals. I tried to invert the range for the y axis but it automatically sort it and place the min in the lowest part.

Thanks in advance,
Francesco Maccario



Roman Thilenius's icon


if the display is linear, what about inverting the spectrum of the audio to display it reversed?

Francesco Maccario's icon

What do you mean with inverting the spectrum?
I also thought about having a full spectra and subtract the true spectra from it, like getting HPF from LPF, but there is something weird. I would like to have an option in the spectrum inspector.

Roman Thilenius's icon


i mean to process the actual audio signal. but it seems that the display cant be changed to linear.

Roman Thilenius's icon


no wait, what i am talking, linear is default.

so you can invert the spectrum and then it will be displayed from left to right, in a way.


Francesco Maccario's icon

No we misunderstood, I would like to have this:

Roman Thilenius's icon


then we need somebody who can inverse the intensity. :D

Francesco Maccario's icon

I can't figure it out, there was someone who said "!- 1" and it obviously doesn't work.
I'm looking for an easy method, a simple "object content inverter". I know that one can achieve this by using FFT and kinda inverting the amplitude of each bin, but it's not convenient.

Luigi Castelli's icon

Guys, think about it... even if you manage to invert the amplitude of each bin, the bins will still be drawn starting at the bottom of the display. What you need is to invert the way [spectroscope~] redraws itself. You need the spectrum to be drawn upside-down starting at the top, which is impossible given the current implementation. You would have to swap background and foreground colors and maybe even mess with the range attribute. It gets super confusing to even think about it. In my opinion your best bet, Francesco, is to file a feature request with C74. It is a trivial feature to implement at the code level, and it would certainly be a cool feature to have.

Roman Thilenius's icon


"I can't figure it out, there was someone who said "!- 1" and it obviously doesn't work."

i know that sometimes it is hard to tell where i am joking and where not. welcome to the club.

👽'tW∆s ∆lienz👽's icon

"I can't figure it out, there was someone who said "!- 1" and it obviously doesn't work." i know that sometimes it is hard to tell where i am joking and where not. welcome to the club.

haha, that was me, i wrote "!- 1" as a joke(a way to inverse something), but then thought it might be obscure and stupid so i removed it. (i think like Luigi said, we'd need a different implementation of the object to allow for more open-ended customization)

Francesco Maccario's icon

Ahaha it made me laugh because I also thought this way would work, it's the logical process

Roman Thilenius's icon


it would work "somehow" if you could at least invert the background and foreground colors´ functionality.

for i example i have been doing exactly that once with a multislider; it differs for one pixel, but it is generally possible to switch red and white and when you then put 1 of the reversed beside 3 normal ones it actually looks like going from top to bottom.

btw, it would be a nice addition to the waveform object, too. though there...

👽'tW∆s ∆lienz👽's icon

it would work "somehow" if you could at least invert the background and foreground colors´ functionality

i don't think this would give the look they're looking for... but if you wanted to do that much, also for the waveform object, you could write a mod with a 'jspainter' file, i think:
https://docs.cycling74.com/max8/vignettes/jspainter
(i wish there were more examples of 'jspainterfile' usage, though... i can only seem to work with the toggle example, to create....(☝️wait for it).....yet another type of toggle!
(🕺tada! 👏😑 "bravo, raja, bravo... that's a very nice looking toggle" 👏😑), but to mod other things seems a bit hard to grasp🤷‍♂️)

Roman Thilenius's icon


sure, for the spectrogram that DSP change had to happen inside.

eventually it is easier to write your own using jitter in that case.

for waveform ist is doable as long as the audio doesnt exceed -1./1. and you dont use transparency.

L: [abs] or integrate + and - with [maximum], write to new buffer (and eventually downsample)

R: the same as L, but !- 1 and reverse colors.

not sure if it really has a higher priority than vertical comments.

Ernest's icon

There is an example of how to use the fft~ object to display spectral characteristics of a signal under the plot~ object in maxhelp, spectral tab. It would be easier to invert the value list from this and map them to colors.