log frequency graphing

Alex Stahl's icon

Hi,

I am suffering from "patcher's block" (like writer's block) looking
for a way to graph fft amplitude frames on a log frequency scale.
Spectrograph~ is almost, but not quite, what I need for this patch.
Using the vectral~ help file as a starting point, I thought maybe
warping the signal going from the fft ramp outlet to vectral~'s index
inlets would work, but I couldn't find documentation about those
inlets and my experiments didn't seem to work. There must be an
obvious approach I am missing...any ideas, examples, or other
thoughts to help get me un-stuck on this?

Thanks a lot!!

-Alex

jim altieri's icon

Hi Alex,
Well, if you're working in pfft~, and you don't have to worry about
the mirror image at the top of your fft, just use log~, and then rescale
log~'s output to your frame size. For example, if your fft index (the
third output from fftin~) goes from 0-256, that means that log~'s output
will go from 0-8 (using the default base 2). Then multiply that signal
by 32 to get you back to your original frame size, but now you've
log-scaled your frequency. Use that signal as the middle input to
vectral~. The left input signal can just be your ordinary, unaltered
index output from the fftin~.
If you are using fft~ rather than pfft~, you'll need to split up your
index signal into its two halves and do a little math on the mirror
image part.
Other tips:
filter out the zeros going to your log~ object!
experiment with different log bases

have fun,
jim

Jean-Francois Charles's icon
Mark Pauley's icon

What about the logarithmic option in the Spectrograph~ object's option
dialog isn't working for you? What else do you need it to do?

_Mark

randall jones's icon

If you have Jitter, you can look at jit-examples/audio/audio-viz/
1.audioviz_simple_jit_fft.pat. This should do what you need. The
log display works by generating a power function in a buffer~ which
is used by lookup~ to warp the x axis of the graph.

-Randy

Alex Stahl's icon

Thanks, this approach is working for me now!

-Alex

Alex Stahl's icon

i needed a bipolar graph of the difference between two spectra.

-Alex