Jump to content


Photo

Tuning samples to harmonics


  • Please log in to reply
2 replies to this topic

#1 Zer0 Fly

Zer0 Fly

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1186 posts
  • Gender:Male
  • Location:Oops
  • Interests:Flying

Posted 09 May 2018 - 00:11

Hello fellow renoisers!

 

 

Some time ago, I've derived a funky little formula. I want to share it with you now, as I found it immensely useful for doing sound design in renoise (or maybe even other synths as the principle is rather general).

17.31234049066756091*math.log(x)

"x" is the number of a harmonic, the multiplier to the base frequency of any note. The output will be the note offset in semitones from any base note, that defines a tuning to that harmonic. It will often result in fractional numbers - so it is targetting a "note" that lies between the usual tunings applied to keys in the equal temperament scale. You can also input fractional numbers for "x", so "0.5" will be the first subharmonic (down one octave) or "1.5" a perfect natural fifth which will be different (no beating...) from a fifth reached by transposing up 7 semitones...

 

So it will often result in a fractional number, so a tuning between the standard scale keys. In renoise you can take account to those fractions by using fine tunings, like the cent tunings, or better: the pitch modulation in the modulation sets.

 

 

let's do it for harmonic 3 and 5 which are especially useful for making a deep bass frequency sound more hollow. Let's assume the pitch modulation is set to a range of 96 semitones

>>> print (17.31234049066756091*math.log(3))
19.019550008654
>>> print (17.31234049066756091*math.log(5))
27.863137138648
>>> print (17.31234049066756091*math.log(3)/96)
0.19812031259014
>>> print (17.31234049066756091*math.log(5)/96)
0.29024101186092

As you see, you will need to add "0.19812031259014" to tune to the 3rd harmonic, and "0.29024101186092" for the 5th harmonic. Try it with three sine waves tuned to the same frequency, one unchanged and the other two with these offsets - and watch the mix of all three becoming similar to a squarewave in a scope...

 

For tuning using semitones/cents, you would tune for the 3rd harmonic 19 semitones up, and "0.019550008654*128" = 2.502401108 cents. Renoise will only allow you to tune up 2 or 3 cents, both not perfectly aligning the harmonic. Be aware that the factor 128 is only for renoise, most other programs will use the factor 100, for 100 cents per semitone.

 

 

Here be some epic table for the offsets of the first 64 natural harmonics:

harmonic             imperfect renoise tuning
    "perfect" offset

 2 - 12.0000000000000  - tune: 12 + 0 Rc
 3 - 19.0195500086539  - tune: 19 + 3 Rc
 4 - 24.0000000000000  - tune: 24 + 0 Rc
 5 - 27.8631371386483  - tune: 28 -18 Rc
 6 - 31.0195500086539  - tune: 31 + 3 Rc
 7 - 33.6882590646913  - tune: 34 -40 Rc
 8 - 36.0000000000000  - tune: 36 + 0 Rc
 9 - 38.0391000173078  - tune: 38 + 5 Rc
10 - 39.8631371386484  - tune: 40 -18 Rc
11 - 41.5131794236476  - tune: 42 -62 Rc
12 - 43.0195500086539  - tune: 43 + 3 Rc
13 - 44.4052766176931  - tune: 44 +52 Rc
14 - 45.6882590646913  - tune: 46 -40 Rc
15 - 46.8826871473022  - tune: 47 -15 Rc
16 - 48.0000000000000  - tune: 48 + 0 Rc
17 - 49.0495540950041  - tune: 49 + 6 Rc
18 - 50.0391000173078  - tune: 50 + 5 Rc
19 - 50.9751301613230  - tune: 51 - 3 Rc
20 - 51.8631371386483  - tune: 52 -18 Rc
21 - 52.7078090733451  - tune: 53 -37 Rc
22 - 53.5131794236476  - tune: 54 -62 Rc
23 - 54.2827434726842  - tune: 54 +36 Rc
24 - 55.0195500086539  - tune: 55 + 3 Rc
25 - 55.7262742772967  - tune: 56 -35 Rc
26 - 56.4052766176931  - tune: 56 +52 Rc
27 - 57.0586500259616  - tune: 57 + 8 Rc
28 - 57.6882590646913  - tune: 58 -40 Rc
29 - 58.2957719415309  - tune: 58 +38 Rc
30 - 58.8826871473022  - tune: 59 -15 Rc
31 - 59.4503557246425  - tune: 59 +58 Rc
32 - 60.0000000000000  - tune: 60 + 0 Rc
33 - 60.5327294323014  - tune: 61 -60 Rc
34 - 61.0495540950041  - tune: 61 + 6 Rc
35 - 61.5513962033396  - tune: 62 -57 Rc
36 - 62.0391000173078  - tune: 62 + 5 Rc
37 - 62.5134403875474  - tune: 63 -62 Rc
38 - 62.9751301613230  - tune: 63 - 3 Rc
39 - 63.4248266263470  - tune: 63 +54 Rc
40 - 63.8631371386484  - tune: 64 -18 Rc
41 - 64.2906240554170  - tune: 64 +37 Rc
42 - 64.7078090733451  - tune: 65 -37 Rc
43 - 65.1151770564252  - tune: 65 +15 Rc
44 - 65.5131794236476  - tune: 66 -62 Rc
45 - 65.9022371559561  - tune: 66 -13 Rc
46 - 66.2827434726842  - tune: 66 +36 Rc
47 - 66.6550662201317  - tune: 67 -44 Rc
48 - 67.0195500086539  - tune: 67 + 3 Rc
49 - 67.3765181293825  - tune: 67 +48 Rc
50 - 67.7262742772967  - tune: 68 -35 Rc
51 - 68.0691041036579  - tune: 68 + 9 Rc
52 - 68.4052766176931  - tune: 68 +52 Rc
53 - 68.7350454547584  - tune: 69 -34 Rc
54 - 69.0586500259616  - tune: 69 + 8 Rc
55 - 69.3763165622959  - tune: 69 +48 Rc
56 - 69.6882590646913  - tune: 70 -40 Rc
57 - 69.9946801699769  - tune: 70 - 1 Rc
58 - 70.2957719415309  - tune: 70 +38 Rc
59 - 70.5917165923421  - tune: 71 -52 Rc
60 - 70.8826871473022  - tune: 71 -15 Rc
61 - 71.1688480507546  - tune: 71 +22 Rc
62 - 71.4503557246425  - tune: 71 +58 Rc
63 - 71.7273590819990  - tune: 72 -35 Rc
64 - 72.0000000000000  - tune: 72 + 0 Rc

As a demonstration I will add a renoise 3.1 instrument, that uses the principle to tune 12 sine waves in additive synthesis (renoise instruments have a limit of 12 voices per note, sad...), one as the fundamental and 11 of them as its harmonics. If you move the first macro, it scans though the harmonics, always mixing ~ 3 of them - it will sound like an impossible bandpass filter, although no filtering is involved in shaping the sound this way - only the gain of each harmonic is modulated to create the sweeps.

 

Play with the math in action - look at the macros to have some fun...

Attached Files


  • Djeroek, random, Neurogami and 2 others like this

#2 Zer0 Fly

Zer0 Fly

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1186 posts
  • Gender:Male
  • Location:Oops
  • Interests:Flying

Posted 09 May 2018 - 16:18

Oh and I almost forgot...

 

You can also tune the modulation comb filter and ring mod to harmonics using these numbers/this formula.

 

Just divide the calculated offset by 119, and add via operator after the key tracker. Just like 12/119 would be an octave offset...



#3 Paul Buck

Paul Buck

    Member

  • Normal Members
  • PipPip
  • 30 posts
  • Gender:Male
  • Location:Drain

Posted 09 May 2018 - 19:35

Awesome. Can't wait to play with this info.