clever scaling equation needed for maths dunderhead

Feb 21, 2008 at 8:47pm

clever scaling equation needed for maths dunderhead

So if I’m using something like ~groove, driving it with ~sig, and changing pitch within the range of, say, -2. (for double speed backwards) through to 2. (double speed forwards) then I’m happy…until:

suppose I wanted to have the resulting pitch changes to be more ‘musical’. Sort of like using ftom followed by mtof, to quantize the pitch jumps – is there a simple way to do this? To scale the musical scale to within -2. to 2. ?

Or, would there have to be a pitch detector in first (hope not) to determine which pitch jumps can be made, and still be a ‘note’? Surely not – a 5th and 8ve above any note is * 1.5 and * 2, respectively, using this method. So how about the notes in between?

Help – I’m going round in circles…

Lee Morgan

#35981
Feb 21, 2008 at 9:37pm

expr ((440. * exp(.057762265 * $f1))* 0.002273)
check out les stuck’s transratio.pat in the examples folder.

for an easier solution, you could just use scale.

#P window setfont “Sans Serif” 9.;
#P number 274 47 72 9 -12 12 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window linecount 1;
#P newex 274 73 56 196617 transratio;
#P message 303 137 50 196617 loop 1 , 0;
#P newex 195 152 29 196617 sig~;
#P newex 195 178 68 196617 groove~ bum;
#P flonum 195 124 72 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 163 47 72 9 -12 12 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 163 73 98 196617 scale -12 12 0.5 2.;
#P connect 6 0 2 0;
#P connect 1 0 0 0;
#P connect 0 0 2 0;
#P connect 7 0 6 0;
#P connect 5 0 3 0;
#P connect 2 0 4 0;
#P connect 4 0 3 0;
#P window clipboard copycount 8;

jl

#123239
Feb 21, 2008 at 9:39pm

> for an easier solution, you could just use scale.

easier, and not accurate at all.
:)

jl

#123240
Feb 21, 2008 at 11:52pm

Quote: Lee Morgan wrote on Thu, 21 February 2008 21:47
—————————————————-
> So if I’m using something like ~groove, driving it with ~sig, and changing pitch within the range of, say, -2. (for double speed backwards) through to 2. (double speed forwards) then I’m happy…until:
>
> suppose I wanted to have the resulting pitch changes to be more ‘musical’. Sort of like using ftom followed by mtof, to quantize the pitch jumps – is there a simple way to do this? To scale the musical scale to within -2. to 2. ?

Output of a slider split in 2 for forward and backward, offset/mapped and converted from semitone steps to transposition ratios where (transposition ratio * -1) is for backwards.

Now you can go round in circles in equal temperament ;)

#P window setfont “Sans Serif” 9.;
#P message 85 185 37 196617 loop 1;
#P user ezdac~ 33 257 77 290 0;
#P message 126 191 75 196617 replace 0 -1 1;
#P window setfont “Sans Serif” 10.;
#P newex 126 216 84 196618 buffer~ giraffe;
#P comment 146 38 111 196618 — forward —;
#P window setfont “Sans Serif” 9.;
#P comment 29 53 20 196617 2x;
#P comment 62 53 20 196617 1x;
#P comment 91 53 31 196617 0.5x;
#P comment 36 63 10 196617 |;
#P comment 99 63 10 196617 |;
#P comment 67 63 10 196617 |;
#P comment 224 53 20 196617 2x;
#P comment 191 53 20 196617 1x;
#P comment 156 53 31 196617 0.5x;
#P comment 165 64 10 196617 |;
#P comment 228 64 10 196617 |;
#P comment 196 64 10 196617 |;
#P message 33 179 43 196617 $1 100;
#P newex 33 197 44 196617 line~ 0.;
#P window setfont “Sans Serif” 10.;
#P newex 33 216 81 196618 groove~ giraffe;
#P flonum 33 160 89 10 0 0 164 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P window setfont “Sans Serif” 9.;
#P newex 89 118 30 196617 – 62;
#P newex 151 98 90 196617 if $i1==37 then 0;
#P newex 33 118 33 196617 !- 12;
#P newex 89 98 60 196617 split 38 78;
#P newex 121 118 118 196617 expr pow(2\,($f1/12));
#P newex 33 138 136 196617 expr pow(2\,($f1/12))*-1;
#P newex 33 98 54 196617 split 0 36;
#P user hslider 33 78 18 192 75 1 0 0;
#P window setfont “Sans Serif” 10.;
#P window linecount 4;
#P comment 131 25 10 196618 stop;
#P window linecount 1;
#P comment 29 38 118 196618 — backward —;
#P connect 2 0 3 0;
#P connect 3 0 7 0;
#P connect 7 0 4 0;
#P connect 4 0 10 0;
#P fasten 5 0 10 0 126 157 38 157;
#P fasten 8 0 10 0 156 157 38 157;
#P connect 10 0 13 0;
#P connect 13 0 12 0;
#P connect 12 0 11 0;
#P connect 30 0 11 0;
#P connect 11 0 29 0;
#P connect 11 0 29 1;
#P connect 3 1 6 0;
#P connect 6 0 9 0;
#P connect 9 0 5 0;
#P connect 28 0 27 0;
#P connect 6 1 8 0;

#123241
Feb 22, 2008 at 3:33am

yes, yummy math… if a standard octave is 12 semitones, and an octave is 2X the frequency, then you need a number that, when multiplied by itself 12 times, gives you 2… the 12th root of 2.

Using a calculator: 2 (x^y button) (1/12) = 1.0594631 (approx.)

Similar to an interest rate of (approx.) 6% — or 1.06 as exponent — it will double in about 12 years.

This is the number that you can multiply by any frequency and get the next higher semitone. You have to keep multiplying by this to get the whole step, minor third, etc… in a 12-tone scale, that is ;)

You could easily make other scales with however many (equally-spaced) notes that you want, just by taking the right root. So a whole-tone scale would be the 6th root of 2, or 1.12246205

A scale of minor 3rds (diminished 7th which repeats at the octave) has 4 separate notes, so 4th root of 2: 1.1892071

How about a scale of 10 notes? It sounds decidedly wacky to our 12-tone ears: 1.07177346

etc……..

Speaking of changing pitch using speed changes, have you looked into gizmo~ yet? This is *very* worthwhile and gives you a whole ton of new possibilities. A bit more to set up and certainly harder on the processor, but the results can be pretty amazing, even with “low-res” options on the pfft~. It also allows some minor pitch alterations without changing speed, and they sound pretty true to the original. But when you go wacky, you can get wild results… like snare drums that sound like ghostly violins, now THAT’S some serious signal processing!

–CJ

#123242
Feb 22, 2008 at 1:31pm

That’s fantastic, thanks. Especially the idea of other equal temperaments. And kjg, your patch in very neat – the perfect solution….thankyou!

Lee

#123243
Feb 26, 2008 at 10:14pm

Quote: Lee Morgan wrote on Fri, 22 February 2008 14:31
—————————————————-
> That’s fantastic, thanks. Especially the idea of other equal temperaments. And kjg, your patch in very neat – the perfect solution….thankyou!

other equal temperaments are easily achieved by replacing the 12 in the [expr] with another number,and adjusting the slider parameters, and the offsetting/mapping accordingly.

cheers!
have fun with it and, if at all possible, make some interesting music ;)

#123244

You must be logged in to reply to this topic.