fluid-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [fluid-dev] fluidsynth increase one semitone


From: Marcus Weseloh
Subject: Re: [fluid-dev] fluidsynth increase one semitone
Date: Sun, 16 Dec 2018 21:54:01 +0100

Hi,

Am Fr., 14. Dez. 2018 um 14:46 Uhr schrieb Nadal Gonzalo García Zavala <address@hidden>:
   I basically want to play and record along with my guitar tuned at 432hz.
   So my question is: Is there a way to tell fluidsynth to increase a semitone / change the pitch ?

So you basically want fluidsynth to play with A=432Hz instead of A=440Hz, correct?

In that case, you can use the MIDI Tuning Standard, as already mentioned by JJC. Either via SysEx messages, or via the tuning commands on the FluidSynth shell. Using the shell is easier, but sadly there is quite a lot of typing involved as we currently don't expose the octave tuning feature. So you will have to tune each of the 127 MIDI keys separately.

But first you need to understand how to express what you want to achieve in cents, as that is what the tuning system uses as units.

To calculate the cent difference between two frequencies f1 and f2, you can use the following formla:
cent difference = (ln(f2 / f1) / ln(2)) * 1200
("ln" stands for "natural logarithm")

So in your case it would be: (ln(432 / 440) / ln(2)) * 1200 = -31.766653633 cents.
That means that you want to tune all notes down by -31.766653633 cents.

As there is really a lot of typing involved, I suggest you don't do it via the FluidSynth shell but create a file.

-----------copy the following into a file (I use "tuning.cfg" as an example filename) -------------------
settuning 0 0 0
settuning 1 0 0
settuning 2 0 0
settuning 3 0 0
settuning 4 0 0
settuning 5 0 0
settuning 6 0 0
settuning 7 0 0
settuning 8 0 0
settuning 9 0 0
settuning 10 0 0
settuning 11 0 0
settuning 12 0 0
settuning 13 0 0
settuning 14 0 0
settuning 15 0 0
tune 0 0 0 -31.7666536334
tune 0 0 1 68.2333463666
tune 0 0 2 168.233346367
tune 0 0 3 268.233346367
tune 0 0 4 368.233346367
tune 0 0 5 468.233346367
tune 0 0 6 568.233346367
tune 0 0 7 668.233346367
tune 0 0 8 768.233346367
tune 0 0 9 868.233346367
tune 0 0 10 968.233346367
tune 0 0 11 1068.23334637
tune 0 0 12 1168.23334637
tune 0 0 13 1268.23334637
tune 0 0 14 1368.23334637
tune 0 0 15 1468.23334637
tune 0 0 16 1568.23334637
tune 0 0 17 1668.23334637
tune 0 0 18 1768.23334637
tune 0 0 19 1868.23334637
tune 0 0 20 1968.23334637
tune 0 0 21 2068.23334637
tune 0 0 22 2168.23334637
tune 0 0 23 2268.23334637
tune 0 0 24 2368.23334637
tune 0 0 25 2468.23334637
tune 0 0 26 2568.23334637
tune 0 0 27 2668.23334637
tune 0 0 28 2768.23334637
tune 0 0 29 2868.23334637
tune 0 0 30 2968.23334637
tune 0 0 31 3068.23334637
tune 0 0 32 3168.23334637
tune 0 0 33 3268.23334637
tune 0 0 34 3368.23334637
tune 0 0 35 3468.23334637
tune 0 0 36 3568.23334637
tune 0 0 37 3668.23334637
tune 0 0 38 3768.23334637
tune 0 0 39 3868.23334637
tune 0 0 40 3968.23334637
tune 0 0 41 4068.23334637
tune 0 0 42 4168.23334637
tune 0 0 43 4268.23334637
tune 0 0 44 4368.23334637
tune 0 0 45 4468.23334637
tune 0 0 46 4568.23334637
tune 0 0 47 4668.23334637
tune 0 0 48 4768.23334637
tune 0 0 49 4868.23334637
tune 0 0 50 4968.23334637
tune 0 0 51 5068.23334637
tune 0 0 52 5168.23334637
tune 0 0 53 5268.23334637
tune 0 0 54 5368.23334637
tune 0 0 55 5468.23334637
tune 0 0 56 5568.23334637
tune 0 0 57 5668.23334637
tune 0 0 58 5768.23334637
tune 0 0 59 5868.23334637
tune 0 0 60 5968.23334637
tune 0 0 61 6068.23334637
tune 0 0 62 6168.23334637
tune 0 0 63 6268.23334637
tune 0 0 64 6368.23334637
tune 0 0 65 6468.23334637
tune 0 0 66 6568.23334637
tune 0 0 67 6668.23334637
tune 0 0 68 6768.23334637
tune 0 0 69 6868.23334637
tune 0 0 70 6968.23334637
tune 0 0 71 7068.23334637
tune 0 0 72 7168.23334637
tune 0 0 73 7268.23334637
tune 0 0 74 7368.23334637
tune 0 0 75 7468.23334637
tune 0 0 76 7568.23334637
tune 0 0 77 7668.23334637
tune 0 0 78 7768.23334637
tune 0 0 79 7868.23334637
tune 0 0 80 7968.23334637
tune 0 0 81 8068.23334637
tune 0 0 82 8168.23334637
tune 0 0 83 8268.23334637
tune 0 0 84 8368.23334637
tune 0 0 85 8468.23334637
tune 0 0 86 8568.23334637
tune 0 0 87 8668.23334637
tune 0 0 88 8768.23334637
tune 0 0 89 8868.23334637
tune 0 0 90 8968.23334637
tune 0 0 91 9068.23334637
tune 0 0 92 9168.23334637
tune 0 0 93 9268.23334637
tune 0 0 94 9368.23334637
tune 0 0 95 9468.23334637
tune 0 0 96 9568.23334637
tune 0 0 97 9668.23334637
tune 0 0 98 9768.23334637
tune 0 0 99 9868.23334637
tune 0 0 100 9968.23334637
tune 0 0 101 10068.2333464
tune 0 0 102 10168.2333464
tune 0 0 103 10268.2333464
tune 0 0 104 10368.2333464
tune 0 0 105 10468.2333464
tune 0 0 106 10568.2333464
tune 0 0 107 10668.2333464
tune 0 0 108 10768.2333464
tune 0 0 109 10868.2333464
tune 0 0 110 10968.2333464
tune 0 0 111 11068.2333464
tune 0 0 112 11168.2333464
tune 0 0 113 11268.2333464
tune 0 0 114 11368.2333464
tune 0 0 115 11468.2333464
tune 0 0 116 11568.2333464
tune 0 0 117 11668.2333464
tune 0 0 118 11768.2333464
tune 0 0 119 11868.2333464
tune 0 0 120 11968.2333464
tune 0 0 121 12068.2333464
tune 0 0 122 12168.2333464
tune 0 0 123 12268.2333464
tune 0 0 124 12368.2333464
tune 0 0 125 12468.2333464
tune 0 0 126 12568.2333464
tune 0 0 127 12668.2333464
------ this is the end of tuning.cfg (don't copy this line into the file) ---------------

In the above commands, we first set the (newly created) tuning on tuning bank 0 and tuning program 0 to all 16 MIDI channels, via the "settuning" command. Then we proceed to tune each of the 127 MIDI keys in that tuning (bank 0, prog 0) to a slighly modified cent value, via the "tune" commands. For normal equal temperament tuning, each MIDI key tuning is exactly the key number * 100. So key 60 (middle C) would have 6000 as the cent tuning. In the above commands, I've already added the -31.766653633 cents to each tuning, so all keys should now sound much lower and in tune with your guitar.

To use that tuning configuration, you start FluidSynth as you normally would, but also give it the "tuning.cfg" file on the command line:
$ fluidsynth [your normal startup options] -f tuning.cfg -o "player.reset-synth=0"

The -f tuning.cfg loads the tuning configuration file you've just created. The -o "player.reset-synth=0" is required if you want to play MIDI files from the command line, otherwise FluidSynth resets all tuning before starting the playback.

So with that, you can setup fluidsynth to play in any temperament or tuning, simply change the numbers to your needs.

All the best,

    Marcus


reply via email to

[Prev in Thread] Current Thread [Next in Thread]