6

I'm trying to figure out how to use the "-Z" (or "--freq_table") option of timidity to assign specific frequencies to midi note numbers, but there is no clear documentation online.]

How do I specify a frequency table for timidity?

  • You may be interested in taking a look at temperanotes (albeit it's in its infancy) – Davide Dec 23 '16 at 4:29
7

The file is a list of 128 integers -- each of which is the frequency of the corresponding midi note in miliHertz. The first line gives the frequency for midi note 0, the next for midi note 1 and so on.

For A440, 12-tone equal temperament, lines 65-72 (inclusive) would be:

--lines 1-64 (midi notes 0-63) snipped >>
# next is midi 64
329628   
349228
369994
391995
415305
# next is midi 69
440000  
466164
493883
-- lines 73-128 (midi notes 72-127) snipped >>

The file can contain comment lines that start with a # character; note that placing a comment after an entry will cause problems, i.e.

414305
440000  # a comment like this will cause problems
466164

I think that putting comments after the entry causes the whole line to be ignored but I haven't tested this.

The following python snippet spits the file for A440, 12TET:

    f0=440.0
    midi0=69
    print "# A440 12-TET"
    for i in xrange(128):
        print int( f0*2.0**( (i-midi0)/12.0 )*1000+0.5 )

To have octave repetition of the same table do something like

    table=[1.0, 16.0/15, 9.0/8, 6.0/5, 5.0/4, 4.0/3, 45.0/32, 3.0/2, 8.0/5, 5.0/3, 16.0/9, 15.0/8]
    f0=440.0
    midi0=69
    print "# A440 just intonation"
    for i in xrange(128):
        (octave, index)=divmod( i-midi0, len(table) )
        print int( 2**octave*table[index]*f0*1000+0.5)
  • Correction in the code for the 12TET tuning, must cast (i-midi0) to a float before dividing print int( f0*2.0**( 1.0*(i-midi0)/12 )*1000+0.5 ) – Trevor Ian Peacock Sep 4 '16 at 14:43
  • Thanks, this description has been very useful to kickstart the development of temperanotes – Davide Dec 23 '16 at 4:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.