logarithmic scale for spectrum CHOP ?

   4736   4   2
User Avatar
Member
113 posts
Joined: Dec. 2007
Offline
Hi,

I've been playing with the spectrum node a bit, I can display a nice 3d eq with it, using the shift/trim/resample chops, but I'm wondering how I could display it with a logarithmic scale on the horizontal axis ? So it represents better human hearing.

Vertical scaling is ok with an expression and/or function chop.

I've tried with the warp, look up and expression chop, but didn't succeed. log and exp function gave me weird results.
Is it possible with the base chops ? Could I do it with VEX else ?

I've played with filters too and it works quite well to get a nice 3d eq, but it uses a lot more memory and crashes a lot, so I'd like to do it with spectrum.

Thanks a lot for your help!
I'm quite new to houdini so I may have missed something.
User Avatar
Member
539 posts
Joined: Dec. 2005
Offline
I would think it would be a matter of using the expression CHOP with the log function and just getting the math right (which I would have to look up). Are you using the real time option or the cooked channel?

I'd like to know what you find out, or if you can't get it I'll give it a shot.

By the way, with the cooked option does anyone know how far across the channel the frequencies are supposed to propagate? Basically, what are the ends of the graph?
User Avatar
Member
113 posts
Joined: Dec. 2007
Offline
Hi, thank you for your interest.

my spectrum goes from 1 to 2048 samples after shifting and trimming.

What I would like is an expression like :
(pseudo C code mixed with expression code)

for (n=1; n< samples+1; n++) {
if ( $I == log(n) ) { /* same as exp($I) == n
$V = ic (0, $C, $I);
}
}

but I don't think it's possible to have a for loop in an expression ? and the if condition would probably always be false since $I is the current index and thus always an integer.

So I tried stuff like (not too sure about it though) :

ic(0, $C, exp($I)*icl(0)/exp(icl(0))),

which should be sampleRate independent, but changes with the sample rate for simple examples, and gives 0 with higher sample rates (like the spectrum which is still 44100 at that point).

something like ic(0, $C, pow($I,2)*icl(0)/pow(icl(0),2)), works well and is indeed sample rate independent.

So I'm quite stucked with expression chops!

I'm using cooked expressions, haven't looked into time slice since I wasn't sure how it worked.

Thanks a lot for any advice!

ps : I won't be home for a few days.
User Avatar
Member
539 posts
Joined: Dec. 2005
Offline
I think that should work but everything doesn't have to be in a single expression. Samples can be represented with $I, and the recursive stuff with the oc() outgoing channel.

I'll take a look after christmas!
User Avatar
Member
113 posts
Joined: Dec. 2007
Offline
Your encouraging post made me look at it one more time before I leave, and I finally got it, the correct expression seems to be :

ic(0,$C, exp($I*log(icl(0))/icl(0)))

the exp function returns 0 with values above 88, so the expression in my previous post couldn't work with $I going up to 2048…

it still changes a little with the sampling rate, but I guess it is because of rounding errors.

Will check it more when I get back.

Thanks again for your interest, will probably have plenty more questions when I dig deeper, but pretty happy that a single line did the trick in this case

Merry christmas!
  • Quick Links