Forums > MaxMSP

Removing acceleration while sweeping frequencies

January 21, 2007 | 2:52 am

I have created a frequency sweep modulating the center frequency of a BP filter. Right now, the output of the modulating oscillator maps onto the values 50Hz-22.05kHz. Obviously, this creates a sweep that spends a long time in the high end, and only a very short moment in the bottom end. It seems to me that the proper map would flip the exponential curve that frequency lies on, thereby reversing the acceleration. Audibly, this would sound like a linear sweep from high to low, no?

Nonetheless, I’m lost. I have searched and searched the forum and don’t seem to find a thread that addresses this exactly. I can understand the math if you give it to me in small bites… Please help!

Beyond this, I’d like a way to do this that is changeable. In other words, I’d like to dynamically change the frequency values that are mapped onto (so, move from a sweep between 50Hz-22.05kHz to a sweep between 440Hz-2kHz.) Does anyone have an object for this? I’ve been looking at lp.scampf, but it doesn’t seem to serve my purpose. Isn’t this just a sort of alternate for zmap? If I’m missing something–like a particular scaling factor that I should use–please let me know.

Many thanks,
Brennon


January 21, 2007 | 4:08 am

If someone is able to explain the mathematics behind this as well, it would be helpful. I’d like to be able to implement this in different ways, and understanding the math will help me do this.

Thanks again,
Brennon


January 21, 2007 | 5:37 am

Have you looked at scale? It has a very nice and easy input labled "exponential base value" which lets one define a curve. You could also check out curve~ which can do this sort of thing in the signal domain – but would need some twisting to get it to do what you want. Finally, you could try running the input into mtof which will take care of the math for you (or expr for that matter – check out the .help for expr). Clearly I don’t know the math either, but boy do those objects help me out a lot.

Quote: brennon@brennonbortz.com wrote on Sat, 20 January 2007 18:52
—————————————————-
> Does anyone have an object for this?
—————————————————-


January 21, 2007 | 7:22 am

Yes, I can get scale to work…sort of. Except, I have no clue how the exponential base value works. Is there a specific value to use here to accomplish what I am trying to do?

–BB


January 21, 2007 | 11:22 am

On 21 Jan 2007, at 05:08, Brennon wrote:

>
> If someone is able to explain the mathematics behind this as well,
> it would be helpful. I’d like to be able to implement this in
> different ways, and understanding the math will help me do this.

here is one way to do it – with the maths exposed…

the idea is to take the ratio of the two frequencies, raise it to the
power of x (where x is between 0 and 1)
and use that to scale (multiply with) freqA.

you can easily make an abstraction out of it.
hope that helps.
volker.

#P window setfont "Sans Serif" 9.;
#P window linecount 1;
#P comment 242 138 67 196617 end freq;
#P comment 287 156 33 196617 Hz;
#P comment 212 156 33 196617 Hz;
#P hidden newex 325 73 65 196617 t 0 100 777;
#P hidden newex 325 49 48 196617 loadbang;
#P newex 92 363 41 196617 *~ 0.1;
#P user ezdac~ 81 406 125 439 0;
#P newex 92 326 40 196617 cycle~;
#P message 92 273 37 196617 $1 33;
#P newex 92 292 32 196617 line~;
#P flonum 92 233 52 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P user multiSlider 92 80 216 27 0. 1. 1 2680 47 0 0 2 0 0 0;
#M frgb 0 0 0;
#M brgb 255 255 255;
#M rgb2 127 127 127;
#M rgb3 0 0 0;
#M rgb4 37 52 91;
#M rgb5 74 105 182;
#M rgb6 112 158 18;
#M rgb7 149 211 110;
#M rgb8 187 9 201;
#M rgb9 224 62 37;
#M rgb10 7 114 128;
#P flonum 242 154 44 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P flonum 92 155 46 9 0. 1. 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 92 187 161 196617 expr pow(($f3/$f2)\,$f1) * $f2;
#P flonum 167 154 44 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P comment 147 235 59 196617 Hz;
#P comment 163 138 67 196617 start freq;
#P connect 12 0 11 0;
#P connect 12 0 11 1;
#P hidden connect 14 0 6 0;
#P connect 6 0 4 0;
#P connect 4 0 3 0;
#P connect 3 0 7 0;
#P connect 7 0 9 0;
#P connect 9 0 8 0;
#P connect 8 0 10 0;
#P connect 10 0 12 0;
#P hidden connect 14 1 2 0;
#P connect 2 0 3 1;
#P hidden connect 14 2 5 0;
#P connect 5 0 3 2;
#P hidden connect 13 0 14 0;
#P window clipboard copycount 18;


January 21, 2007 | 11:25 pm

Works perfectly–thank you! I just wish I new how… :(

I understand what you are doing mathematically, but I’m not sure why this works. Can anyone enlighten me?

Thanks!


January 22, 2007 | 3:10 am

Yeah, that’s pretty cool and could be very useful!

Best I can say is that the scaler takes advantage of the fact that anything to the 0 power is 1, and anything to the 1 power is itself… so anything in between… take the ratio of your two numbers… multiply by the denominator again, you get the desired log-based frequency.

or something.

-C

p.s. the expr object can be tricky to read and to get it to work sometimes, but it’s great. also look up vexpr if you want to work with lists and calculations. don’t forget the scalarmode 1 command if you do use vexpr.


January 22, 2007 | 10:27 am

On 21 janv. 07, at 03:52, Brennon wrote:

>
> I have created a frequency sweep modulating the center frequency of a
> BP filter. Right now, the output of the modulating oscillator maps
> onto the values 50Hz-22.05kHz. Obviously, this creates a sweep that
> spends a long time in the high end, and only a very short moment in
> the bottom end. It seems to me that the proper map would flip the
> exponential curve that frequency lies on, thereby reversing the
> acceleration. Audibly, this would sound like a linear sweep from high
> to low, no?

You can also make your modulator sweeping from MIDI note 0. to 136.7
(in floats!!) and convert the notes to frequencies with [mtof 0.]

p

_____________________________
Patrick Delges

Centre de Recherches et de Formation Musicales de Wallonie asbl

http://users.skynet.be/crfmw/max


January 22, 2007 | 7:54 pm

IS there any way to do this beyond this range? Or am I limited from 0-136.7?


January 22, 2007 | 8:10 pm

On 22-janv.-07, at 20:54, Brennon wrote:

>
> IS there any way to do this beyond this range? Or am I limited from
> 0-136.7?

This range maps more or less the full spectrum at 44100Hz but mtof
works with negative numbers, and with very big numbers. Just try!

p


January 24, 2007 | 6:54 pm

Brennon wrote:
> IS there any way to do this beyond this range? Or am I limited from
> 0-136.7?

Why not? but you won’t hear it or get nice aliasing frequencies
(depending on sample rate and basic material)
The hearing range is ca. 10 octaves, and its actually Midi roughly 15 to
135 for 20Hz to 20000 Hz the 0-136.8 is the theoretic range for a
sampling frequnecy of 44.1 KHz. But Midi 0 is only 8.175 Hz, you can go
down to -288 to hit 0… That means you have a pitch range from -288 to
136.8 with 44.1 kHz…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com


Viewing 11 posts - 1 through 11 (of 11 total)