Music: Practice & Theory Stack Exchange is a question and answer site for musicians, students, and enthusiasts. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 2 down vote accepted

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
# next is midi 69
-- 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.

440000  # a comment like this will cause problems

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:

    print "# A440 12-TET"
    for i in xrange(128):
        print int( f0*2.0**( (i-midi0)/12 )*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]
    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)
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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