Discussion:
[fluid-dev] Perfect, as opposed to Tempered tuning
Aere Greenway
2014-10-28 22:53:27 UTC
Permalink
FluidSynth Developers:

I had an idea today, and wondered what you might think of it.

Decades ago, when I was newly out of college, with little money, but
having a piano, I used to tune my own piano.

I didn't look up the specifications for how to tune it tempered (which
is a formula where it is tuned such that it isn't perfect in any key,
but it sounds reasonably good in all key signatures).

Instead, I tuned it so that it was nearly perfect in a set of
key-signatures I usually used for my compositions. In other
key-signatures, it sounded bad, and I just didn't use those key-signatures.

I really liked the result, and actually composed pieces that sounded
really good on my own piano, but didn't sound nearly a good on other
pianos.

But given how much I liked the sound of near-perfect tuning, I wonder
about the possibility of perfect (rather than tempered) tuning for each
key-signature, and changing the tuning accordingly when changing
key-signatures.

Is this something that could be done with FluidSynth? Has anyone
already tried this?

Just a strange idea - probably 'way out in left-field'...
--
Sincerely,
Aere
R.L. Horn
2014-10-29 04:11:48 UTC
Permalink
Post by Aere Greenway
But given how much I liked the sound of near-perfect tuning, I wonder
about the possibility of perfect (rather than tempered) tuning for each
key-signature, and changing the tuning accordingly when changing
key-signatures.
AFAIK, you've been able to do that from within MIDI files using MTS since
version 1.1.0.

If possible, that's the best way to deal with the issue. It's
more-or-less portable, there's no agreement on what would constitute
"perfect" tuning anyway, and, besides, key changes effectively happen all
the time without corresponding changes in signature.

What's more, MTS and pitch-bend are the only mechanisms provided by MIDI
for dealing with unpredictable things like commas and harmonic sevenths.

Of course, you can set up alternate *temperaments* with configuration
files. I usually use Young's tuning since I have to deal with open thirds
quite a bit.
Aere Greenway
2014-10-29 05:10:45 UTC
Permalink
Post by R.L. Horn
AFAIK, you've been able to do that from within MIDI files using MTS
since version 1.1.0.
If possible, that's the best way to deal with the issue. It's
more-or-less portable, there's no agreement on what would constitute
"perfect" tuning anyway, and, besides, key changes effectively happen
all the time without corresponding changes in signature.
What's more, MTS and pitch-bend are the only mechanisms provided by
MIDI for dealing with unpredictable things like commas and harmonic
sevenths.
Of course, you can set up alternate *temperaments* with configuration
files. I usually use Young's tuning since I have to deal with open
thirds quite a bit.
Thank you for the information. It points me in the right direction.

I still have the challenge of describing algorithmically what I did
by-ear way back then.

In your last paragraph, what sort of configuration files were you
referring to? Are they configuring the tuning of FluidSynth? Or are a
way of entering the MIDI MTS bulk data?
--
Sincerely,
Aere
Fede Galland
2014-10-29 10:48:34 UTC
Permalink
Post by Aere Greenway
Post by R.L. Horn
AFAIK, you've been able to do that from within MIDI files using
MTS since version 1.1.0.
If possible, that's the best way to deal with the issue. It's
more-or-less portable, there's no agreement on what would
constitute "perfect" tuning anyway, and, besides, key changes
effectively happen all the time without corresponding changes in
signature.
What's more, MTS and pitch-bend are the only mechanisms provided
by MIDI for dealing with unpredictable things like commas and
harmonic sevenths.
Of course, you can set up alternate *temperaments* with
configuration files. I usually use Young's tuning since I have to
deal with open thirds quite a bit.
Thank you for the information. It points me in the right direction.
I still have the challenge of describing algorithmically what I did
by-ear way back then.
In your last paragraph, what sort of configuration files were you
referring to? Are they configuring the tuning of FluidSynth? Or
are a way of entering the MIDI MTS bulk data?
I've recently been asking the same questions.

If you are working with scala http://www.huygens-fokker.org/scala/
you can export fluidsynth command files, which in turn will be parsed
with the "-f" flag.

Scala can also export 2 byte MTS files, but I don't know how to import
them with fluidsynth. I spent hours trying different things to no avail
(actually got it to work once, idk how, and then not anymore). It
doesn't seem to be that easy, the question has been asked repeatedly
over the internet but no answer is provided.
R.L. Horn
2014-10-30 07:10:28 UTC
Permalink
Post by Fede Galland
I've recently been asking the same questions.
There's been some recent discussion over ticket 103
(http://sourceforge.net/p/fluidsynth/tickets/103/).

(Which you may be part of.)

One thing that causes problems is that fluidsynth doesn't default to using
any particular tuning program. Even bank 0/program 0 has to be set
explicity.

It's probably not a bad idea always to create a "default" tuning program
and tell fluidsynth to use it for every channel except, maybe, channel 10:

# create a default tuning (fluidsynth will fill in the blanks)
tuning "bank 0/prog 0" 0 0
# assign it to all channels
settuning 0 0 0
settuning 1 0 0
settuning 2 0 0
...

That *should* fix the problem of MIDI streams that assume tuning 0/0 is
the default.

Another thing is that fluidsynth is extremely conservative about tuning —
it only tweaks the samples that are already assigned to a given key.
Many other synths, e.g. timidity, look for a best match for the requested
frequency.

Both are valid approaches. Fluidsynth's is better suited for making small
changes, and might be the only way to deal with multi-instrument programs
(you wouldn't want to press a kettledrum key and get a bongo instead, for
example).

On the other hand, fluidsynth doesn't cope well with gross tuning changes.
The sample file uploaded with ticket 103 is a good example. It sort of
tends not to do anything, and a tuning dump makes it clear why:

....
key 116, pitch 11600.00
key 117, pitch 3359.61
key 118, pitch 5040.00
key 119, pitch 4800.00
key 120, pitch 5280.00
key 121, pitch 6480.00
key 122, pitch 4559.61
key 123, pitch 5519.61
key 124, pitch 6719.61
key 125, pitch 6000.00
key 126, pitch 6240.00
key 127, pitch 6400.00

All of the action is happening on keys 117 and up, which are likely not to
have any associated samples (they're well off the right side of an 88-key
keyboard). Even if they do, pitching the samples down several octaves
won't sound very good. It's enough of a problem that a good argument can
be made for giving fluidsynth one or more alternate tuning heuristics.

All of which may, or may not, be helpful. :)
Fede Galland
2014-10-30 10:40:41 UTC
Permalink
Post by R.L. Horn
Post by Fede Galland
I've recently been asking the same questions.
There's been some recent discussion over ticket 103
(http://sourceforge.net/p/fluidsynth/tickets/103/).
(Which you may be part of.)
I am :)
Post by R.L. Horn
One thing that causes problems is that fluidsynth doesn't default to
using any particular tuning program. Even bank 0/program 0 has to
be set explicity.
It's probably not a bad idea always to create a "default" tuning
program and tell fluidsynth to use it for every channel except,
# create a default tuning (fluidsynth will fill in the blanks)
tuning "bank 0/prog 0" 0 0
# assign it to all channels
settuning 0 0 0
settuning 1 0 0
settuning 2 0 0
...
That *should* fix the problem of MIDI streams that assume tuning 0/0
is the default.
I just tried this with the latest fluid from git and after sending an
MTS mid file with pmidi (the method that works for timidity), I see the
control changes in the console, but dumptuning 0 0 shows the default
12TET tunings.
Post by R.L. Horn
Another thing is that fluidsynth is extremely conservative about
tuning — it only tweaks the samples that are already assigned to a
given key. Many other synths, e.g. timidity, look for a best match
for the requested frequency.
Both are valid approaches. Fluidsynth's is better suited for making
small changes, and might be the only way to deal with
multi-instrument programs (you wouldn't want to press a kettledrum
key and get a bongo instead, for example).
In my case, that's the reason I don't settle for timidity. The
interpolation is much worse.
Post by R.L. Horn
All of which may, or may not, be helpful. :)
Your answer didn't solve the problem, but it's still helpful as far as
I'm concerned.
Fede Galland
2014-10-30 10:44:11 UTC
Permalink
If it's of any help, I'm attaching a MTS file that works on timidity but
not on fluidsynth.
R.L. Horn
2014-10-30 13:58:17 UTC
Permalink
Post by Fede Galland
If it's of any help, I'm attaching a MTS file that works on timidity but
not on fluidsynth.
Short answer: It doesn't work because that's not how you change tunings.

Longer answer:

The file contains a non-realtime 7E <responder ID> 08 01... "bulk tuning
dump" sysex. These should only be sent out in response to a "bulk tuning
dump request". Changing tunings in response to this message is not only
wrong, it's *insane*.

Tunings are changed with a realtime "single note tuning change" sysex: 7F
<target ID> 08 02....

See <http://www.midi.org/techspecs/midituning.php>.

I think I've managed to correct it. By hand. And I never, ever, ever
want to do that again.

The attached MIDI file might not do the right thing, but at least it'll do
something.
R.L. Horn
2014-10-30 03:12:14 UTC
Permalink
Post by Aere Greenway
Post by R.L. Horn
Of course, you can set up alternate *temperaments* with configuration
files.
In your last paragraph, what sort of configuration files were you
referring to?
The fluidsynth client has tuning commands which, come to think of it,
perhaps aren't described as fully as they could be. "help tunings" wlll
get you started.

Tuning is in cents starting with C. So, for 12TET, starting with MIDI
note 0 (5 octaves below middle C), it would run 0, 100, 200, 300, etc.
IOW, 12TET tuning is just the note number times 100.

Once you have a list of "tune" commands, you simply load them with the -f
option.

By way of example, this is the tuning I normally use:

tuning "Thos. Young's 1799 temperament (C)" 0 0
tune 0 0 0 6.23
tune 0 0 1 100.12
tune 0 0 2 202.08
tune 0 0 3 304.03
tune 0 0 4 397.92
tune 0 0 5 506.11
tune 0 0 6 598.17
tune 0 0 7 704.15
tune 0 0 8 802.08
tune 0 0 9 900.00
tune 0 0 10 1005.99
tune 0 0 11 1098.04
tune 0 0 12 1206.23
tune 0 0 13 1300.12
tune 0 0 14 1402.08
tune 0 0 15 1504.03
tune 0 0 16 1597.92
tune 0 0 17 1706.11
tune 0 0 18 1798.17
tune 0 0 19 1904.15
tune 0 0 20 2002.08
tune 0 0 21 2100.00
tune 0 0 22 2205.99
tune 0 0 23 2298.04
tune 0 0 24 2406.23
tune 0 0 25 2500.12
tune 0 0 26 2602.08
tune 0 0 27 2704.03
tune 0 0 28 2797.92
tune 0 0 29 2906.11
tune 0 0 30 2998.17
tune 0 0 31 3104.15
tune 0 0 32 3202.08
tune 0 0 33 3300.00
tune 0 0 34 3405.99
tune 0 0 35 3498.04
tune 0 0 36 3606.23
tune 0 0 37 3700.12
tune 0 0 38 3802.08
tune 0 0 39 3904.03
tune 0 0 40 3997.92
tune 0 0 41 4106.11
tune 0 0 42 4198.17
tune 0 0 43 4304.15
tune 0 0 44 4402.08
tune 0 0 45 4500.00
tune 0 0 46 4605.99
tune 0 0 47 4698.04
tune 0 0 48 4806.23
tune 0 0 49 4900.12
tune 0 0 50 5002.08
tune 0 0 51 5104.03
tune 0 0 52 5197.92
tune 0 0 53 5306.11
tune 0 0 54 5398.17
tune 0 0 55 5504.15
tune 0 0 56 5602.08
tune 0 0 57 5700.00
tune 0 0 58 5805.99
tune 0 0 59 5898.04
tune 0 0 60 6006.23
tune 0 0 61 6100.12
tune 0 0 62 6202.08
tune 0 0 63 6304.03
tune 0 0 64 6397.92
tune 0 0 65 6506.11
tune 0 0 66 6598.17
tune 0 0 67 6704.15
tune 0 0 68 6802.08
tune 0 0 69 6900.00
tune 0 0 70 7005.99
tune 0 0 71 7098.04
tune 0 0 72 7206.23
tune 0 0 73 7300.12
tune 0 0 74 7402.08
tune 0 0 75 7504.03
tune 0 0 76 7597.92
tune 0 0 77 7706.11
tune 0 0 78 7798.17
tune 0 0 79 7904.15
tune 0 0 80 8002.08
tune 0 0 81 8100.00
tune 0 0 82 8205.99
tune 0 0 83 8298.04
tune 0 0 84 8406.23
tune 0 0 85 8500.12
tune 0 0 86 8602.08
tune 0 0 87 8704.03
tune 0 0 88 8797.92
tune 0 0 89 8906.11
tune 0 0 90 8998.17
tune 0 0 91 9104.15
tune 0 0 92 9202.08
tune 0 0 93 9300.00
tune 0 0 94 9405.99
tune 0 0 95 9498.04
tune 0 0 96 9606.23
tune 0 0 97 9700.12
tune 0 0 98 9802.08
tune 0 0 99 9904.03
tune 0 0 100 9997.92
tune 0 0 101 10106.11
tune 0 0 102 10198.17
tune 0 0 103 10304.15
tune 0 0 104 10402.08
tune 0 0 105 10500.00
tune 0 0 106 10605.99
tune 0 0 107 10698.04
tune 0 0 108 10806.23
tune 0 0 109 10900.12
tune 0 0 110 11002.08
tune 0 0 111 11104.03
tune 0 0 112 11197.92
tune 0 0 113 11306.11
tune 0 0 114 11398.17
tune 0 0 115 11504.15
tune 0 0 116 11602.08
tune 0 0 117 11700.00
tune 0 0 118 11805.99
tune 0 0 119 11898.04
tune 0 0 120 12006.23
tune 0 0 121 12100.12
tune 0 0 122 12202.08
tune 0 0 123 12304.03
tune 0 0 124 12397.92
tune 0 0 125 12506.11
tune 0 0 126 12598.17
tune 0 0 127 12704.15
Aere Greenway
2014-10-30 15:25:43 UTC
Permalink
Thank you very much! The example is very helpful.

- Aere
Post by R.L. Horn
Post by Aere Greenway
Post by R.L. Horn
Of course, you can set up alternate *temperaments* with
configuration files.
In your last paragraph, what sort of configuration files were you
referring to?
The fluidsynth client has tuning commands which, come to think of it,
perhaps aren't described as fully as they could be. "help tunings"
wlll get you started.
Tuning is in cents starting with C. So, for 12TET, starting with MIDI
note 0 (5 octaves below middle C), it would run 0, 100, 200, 300, etc.
IOW, 12TET tuning is just the note number times 100.
Once you have a list of "tune" commands, you simply load them with the
-f option.
tuning "Thos. Young's 1799 temperament (C)" 0 0
tune 0 0 0 6.23
tune 0 0 1 100.12
tune 0 0 2 202.08
tune 0 0 3 304.03
tune 0 0 4 397.92
tune 0 0 5 506.11
tune 0 0 6 598.17
tune 0 0 7 704.15
tune 0 0 8 802.08
tune 0 0 9 900.00
tune 0 0 10 1005.99
tune 0 0 11 1098.04
tune 0 0 12 1206.23
tune 0 0 13 1300.12
tune 0 0 14 1402.08
tune 0 0 15 1504.03
tune 0 0 16 1597.92
tune 0 0 17 1706.11
tune 0 0 18 1798.17
tune 0 0 19 1904.15
tune 0 0 20 2002.08
tune 0 0 21 2100.00
tune 0 0 22 2205.99
tune 0 0 23 2298.04
tune 0 0 24 2406.23
tune 0 0 25 2500.12
tune 0 0 26 2602.08
tune 0 0 27 2704.03
tune 0 0 28 2797.92
tune 0 0 29 2906.11
tune 0 0 30 2998.17
tune 0 0 31 3104.15
tune 0 0 32 3202.08
tune 0 0 33 3300.00
tune 0 0 34 3405.99
tune 0 0 35 3498.04
tune 0 0 36 3606.23
tune 0 0 37 3700.12
tune 0 0 38 3802.08
tune 0 0 39 3904.03
tune 0 0 40 3997.92
tune 0 0 41 4106.11
tune 0 0 42 4198.17
tune 0 0 43 4304.15
tune 0 0 44 4402.08
tune 0 0 45 4500.00
tune 0 0 46 4605.99
tune 0 0 47 4698.04
tune 0 0 48 4806.23
tune 0 0 49 4900.12
tune 0 0 50 5002.08
tune 0 0 51 5104.03
tune 0 0 52 5197.92
tune 0 0 53 5306.11
tune 0 0 54 5398.17
tune 0 0 55 5504.15
tune 0 0 56 5602.08
tune 0 0 57 5700.00
tune 0 0 58 5805.99
tune 0 0 59 5898.04
tune 0 0 60 6006.23
tune 0 0 61 6100.12
tune 0 0 62 6202.08
tune 0 0 63 6304.03
tune 0 0 64 6397.92
tune 0 0 65 6506.11
tune 0 0 66 6598.17
tune 0 0 67 6704.15
tune 0 0 68 6802.08
tune 0 0 69 6900.00
tune 0 0 70 7005.99
tune 0 0 71 7098.04
tune 0 0 72 7206.23
tune 0 0 73 7300.12
tune 0 0 74 7402.08
tune 0 0 75 7504.03
tune 0 0 76 7597.92
tune 0 0 77 7706.11
tune 0 0 78 7798.17
tune 0 0 79 7904.15
tune 0 0 80 8002.08
tune 0 0 81 8100.00
tune 0 0 82 8205.99
tune 0 0 83 8298.04
tune 0 0 84 8406.23
tune 0 0 85 8500.12
tune 0 0 86 8602.08
tune 0 0 87 8704.03
tune 0 0 88 8797.92
tune 0 0 89 8906.11
tune 0 0 90 8998.17
tune 0 0 91 9104.15
tune 0 0 92 9202.08
tune 0 0 93 9300.00
tune 0 0 94 9405.99
tune 0 0 95 9498.04
tune 0 0 96 9606.23
tune 0 0 97 9700.12
tune 0 0 98 9802.08
tune 0 0 99 9904.03
tune 0 0 100 9997.92
tune 0 0 101 10106.11
tune 0 0 102 10198.17
tune 0 0 103 10304.15
tune 0 0 104 10402.08
tune 0 0 105 10500.00
tune 0 0 106 10605.99
tune 0 0 107 10698.04
tune 0 0 108 10806.23
tune 0 0 109 10900.12
tune 0 0 110 11002.08
tune 0 0 111 11104.03
tune 0 0 112 11197.92
tune 0 0 113 11306.11
tune 0 0 114 11398.17
tune 0 0 115 11504.15
tune 0 0 116 11602.08
tune 0 0 117 11700.00
tune 0 0 118 11805.99
tune 0 0 119 11898.04
tune 0 0 120 12006.23
tune 0 0 121 12100.12
tune 0 0 122 12202.08
tune 0 0 123 12304.03
tune 0 0 124 12397.92
tune 0 0 125 12506.11
tune 0 0 126 12598.17
tune 0 0 127 12704.15
_______________________________________________
fluid-dev mailing list
https://lists.nongnu.org/mailman/listinfo/fluid-dev
--
Sincerely,
Aere
Loading...