for spectral visualisation and editing of an audio signal it would be nice to have a logarithmic xscale for an array (for example for an fft equalizer). afaik, this is not possible with the native puredata arrays, am i right? has somebody a good idea, how to realize something like this?


I've also wondered about that, how logarithmic xscales of spectra are done in other applications. But recently I had a peek into Hardoff's sound editor, and the answer is hidden there. He is copying samples from the signal buffer into the visual buffer at fractional speed.
The same could be done, but with exponentially increasing speed, to create a 'logarithmic' frequency scale. You will read some bin values more than once in the low frequencies, and skip bins in the high frequency range. If you read with [tabread4], this could still give a good representation. But to calculate the exact rate of the exponential function could be tricky. I have not tried it yet.
Katja

sounds like a lot of work... would be nice, if pd would feature something like differnt scale modes for arrays (like for the sliders and num2) one day...

I've found it easiest to avoid the headache of logarithmic frequency mapping by making [mtof] or [mtof~] do it for me. Just figure out the frequency range and that convert to midi notes. Then, do a linear sweep of the midi range and run it through [mtof~] to get the logarithmic scale.
I found in this case that if you do the full FFT range, [tabread4~] produces an ugly dip in the lower part of the spectrum. The sudden jump from the DC amplitude to the next bin causes the interpolation to "overshoot". So I used [tabread~] here instead, but you probably could just ignore the lower bin for better graphing if you wanted.

thank you, maelstorm! this is amazing!
nevertheless it would be cool, if there was a log scaling feature for arrays, since you sometimes want to use it like an eq, not only to visualise a spectre, but edit it. 
Maelstorm, I've done your patch with base 2 logarithm and exponent instead of [mtof] and [mtof~]. In the end it was much simpler than I thought, because fft sizes are always a power of 2.
[tabread~] shows a more realistic figure than [tabread4~], it's just the bin content and those bins are stretched / squeezed in horizontal direction, that's just how it is.
Well maybe it is possible to do faithful interpolation, but I think the fft frames should at least be windowed and averaged for that.
@toxonic' said:
it would be cool, if there was a log scaling feature for arrays, since you sometimes want to use it like an eq, not only to visualise a spectre, but edit it.
After editing a log mapped graph, you could map the data back to linear, not? Ok it's a bit more work than if the feature were just built in.
Katja

Hi
I have been tweaking Katjav's patch, in order to have a bit more definition on the lower frequencies. I added a highpass filter (to get rid of DC) and changed the fft analysis for a whole new patch.
I wanted to add more "steps" to the log sweep, in order to have a more reliable representation of the fft. The $0logsweep is made of 2048 steps, which means that there are 2048 values of x and the correspondent y values. Is there any way of expanding this array, in order for it to have (for example) four times more values (8192)? I feel like, this way, it'd have a much more reliable graphical representation of the fft.
Thanks very much!
Filipe 
Hi
I am finishing up my comparative EQ with visual feedback (FFT analysis) and I was able to make my FFT "screens" (arrays) logarithmic. The problem is that my EQ is based on the I03 patch in the audio examples folder, which is linear. I assume I have to introduce some kind of anti log feature in the patch in order to make the Gain array match up with the FFT arrays. Any ideas of how to do this?
Thank you very much!
Cheers,
Filipe
Prototype8.0.pd