linear vs. log Hz
linear vs. log Hz
- Subject: linear vs. log Hz
- From: Chris Rogers <email@hidden>
- Date: Tue, 15 Oct 2002 16:18:54 -0700
I think there's a difference between the "generic view" in Logic compared
with the Apple supplied Generic View. If you try out your AudioUnit
in AudioUnitHosting, I think you should see the Hz parameter displayed
with units of Hz, but on a log scale. Logic may not do the proper conversion
to display this on a log scale...
So, hosting apps - it's often a good idea to display parameters published
with units of Hertz on a log scale!
Chris
Chris,
I'm not sure I was clear enough. Maybe I should elaborate more:
ok let's say I declare my frequency parameter as:
{ "Filter Frequency" , 0 , kAudioUnitParameterUnit_Hertz
, 50.0f ,
8000.0f , 1000.0f , 0 },
in my AudioUnitParameterInfo...now I launch logic, open the AU and the
generic view creates sliders for my parameters...the frequency slider
looks good, it's says it's unit is in Hz etc...but if I move the slider
at 50% i get a frequency around 4200 Hz which is good if I want that
parameter to be scaled linearly...
if now I declare is as a generic value ranging from 0.0f to 1.0f, I can
do something like that:
myScaledFreq=pow(10.0f,3.90f*fFreq)+49.0f
this curve fits my particular needs, but then logic displays only 0.0
to 1.0 values for that parameter which is normal since i haven't
declared it as a kAudioUnitParameterUnit_Hertz this time. So my
question was: how can I declare my parameter like in the second case
and be able to tell the generic view to display my scaled frequency.
Sorry to bother you again with that...
Franck
Franck,
Please notice that the generic view will notice that a parameter's
units
are Hertz and then do the reasonable exponential curve scaling for the
slider control. We provide functions AUParameterValueFromLinear()
and AUParameterValueToLinear() in AudioUnitUtilities.h to convert back
and forth in a general way between log <-> linear.
We also have the units type kAudioUnitParameterUnit_AbsoluteCents
which publishes a parameter explicitly with a log frequency scale.
kAudioUnitParameterUnit_AbsoluteCents has the interesting property of
corresponding to the pitch of 100 times a MIDI note number!
Chris Rogers
Core Audio
Apple Computer
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.
References: | |
| >(no subject) (From: Franck STAUFFER <email@hidden>) |