<?xml version="1.0" encoding="iso-8859-1"?>
<feed version="0.3" xmlns="http://purl.org/atom/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
  <title>Making Microtonal Music with Software</title>
  <link rel="alternate" type="text/html" href="http://www.parnasse.com/microtonal/" />
  <modified>2004-10-16T13:13:27Z</modified>
  <tagline>A blog documenting my experiments in inherently ill-documented experimental music production systems</tagline>
  <id>tag:www.parnasse.com,2004:/microtonal/11</id>
  <generator url="http://www.movabletype.org/" version="2.661">Movable Type</generator>
  <copyright>Copyright (c) 2004, jeff</copyright>
  <entry>
    <title>Timidity and Soundfonts - Getting Started</title>
    <link rel="alternate" type="text/html" href="http://www.parnasse.com/microtonal/archives/000267.html" />
    <modified>2004-10-16T13:13:27Z</modified>
    <issued>2004-10-16T14:13:27+00:00</issued>
    <id>tag:www.parnasse.com,2004:/microtonal/11.267</id>
    <created>2004-10-16T13:13:27Z</created>
    <summary type="text/plain">Thanks to the MakeMicroMusic Yahoo group and in particular Graham Breed and Manuel Op de Coul, I&apos;ve successfully learned how to create arbitrarily tuned musics with the software audio compiler system, Timidity, the popular microtonal tuning software, Scala and public...</summary>
    <author>
      <name>jeff</name>
      <url>http://jeffharrington.org</url>
      <email>jeff@parnasse.com</email>
    </author>
    
    <content type="text/html" mode="escaped" xml:lang="en" xml:base="http://www.parnasse.com/microtonal/">
      <![CDATA[<p>Thanks to the <a href="http://launch.groups.yahoo.com/group/MakeMicroMusic/messages">MakeMicroMusic Yahoo group</a> and in particular Graham Breed and Manuel Op de Coul, I've successfully learned how to create arbitrarily tuned musics with the software audio compiler system, Timidity, the popular microtonal tuning software, Scala and public domain soundfonts.  This article is an attempt at documenting this powerful, but needlessly difficult to learn process.  </p>

<p><h2>Getting and Installing Timidity and Basic Links</h2></p>

<p><a href="http://timidity.sourceforge.net/">Timidity at Sourceforge</a><br />
<a href="http://timidity.s11.xrea.com/index.en.html">Timidity Windows Binaries</a><br />
<a href="http://parnasse.com/temp/Timidity-2.13.0-en.msi">Windows Binary at Parnasse</a><br />
<a href="http://www.xs4all.nl/~huygensf/scala/">Scala Homepage</a><br />
<a href="http://www.hum.aau.dk/~bovbjerg/piano3.html">Free Piano Soundfont - Fazioli Concert Grand</a><br />
<a href="http://www.hum.aau.dk/~bovbjerg/piano4.html">Free Piano Soundfont - Steinway Model C</a></p>

<p><img src='http://parnasse.com/images/timidity1.jpg'><p></p>

<p>This document will focus chiefly on solving problems I encountered with the Windows implementation of Timidity, but most of the information will be usable across Linux and other platforms.  After running the windows installer you'll end up with a directory, somewhere, with a Timidity CFG file.  This file is the way you tell Timidity what soundfont to use and it is a bit particular in how that is expressed.  </p>

<p>First though I had to decompress those 2 piano soundfonts.  This turned out to be a pain in itself.  I was only successful with a shareware program, <a href="http://www.synthfont.com/">SynthFont</a>.  And that even was problematic.  Download, and install SynthFont and then under the File menu item use Select Default Soundfont.  A lot of great SoundFonts use a compression scheme, particular to the SoundFont community - the sfArk file format.  Both of the piano SoundFonts I wanted to use, relied on that deployment mechanism.  Once you have your sfArk file selected, use the Setup button, at the top of the app's toolbar and select - Retain sfArk-extracted Sf2 files for later use.  It will leave the decompressed SF2 file that Timidity can read in the same directory.  </p>

<p>Now back to Timidity.  Here's my complete CFG file which resides in C:\WINDOWS\TIMIDITY.CFG.</p>

<p>soundfont "C:\\Program Files\\Timidity++ Project\\Timidity++\\SteinwayGrandPiano1.2.sf2"</p>

<p>It has one entry, <b>soundfont</b> and a path to that SF2 file.  You can edit it through the Timidity Config(C) menu item, Preferences.</p>

<p><img src='http://parnasse.com/images/timidity2.jpg'><p> Be aware that it does not seem to appreciate spaces in the SoundFont name and that I also had to escape the path listing with 2 "\\" per directory.   </p>

<p><h2>Realizing Audio</h2><br />
Open up the Console window using menu item Window(W) and then Console(C) to see error output and to confirm its finding your SoundFont.  </p>

<p>The menu item, Output(O) is where you configure how Timidity will produce audio, either as compiled directly to an audio file such as a WAV file or direct to your Windows audio device.  I have two soundcards, and the Timidity output menu item, has one Windows Audio Driver selection, which never produced audio output, so I had to rely on WAV output  RIFF WAV OUTPUT to hear my realizations.  Select either one to get started.  </p>

<p>Go to File(F) and Open File(F) to load a MIDI file.  Hitting the tiny play button on the bottom of the app will start audio output, either directly to a file as I configured it or to your speakers.  </p>

<p><h2>Tuning Your MIDI File - How Microtonal Settings are Set</h2></p>

<p>There are two ways to get Timidity to accept tunings, either through giving Timidity a MIDI Tuning Dump SYSX chunk or through the -Z argument and a file which is expected to be a column of 127 frequencies expressed as cents.  I couldn't get the latter method to work yet, so I used Scala to 'retune' my MIDI file.  This is not a tutorial on running Scala, it's fairly well documented.  I basically created a 19ET scale, saved it and then used it to retune my MIDI files through the menuitem under Tools/Retune MIDI File.  I then loaded Timidity with that MIDI file and voila, the expected excellently rendered piano prelude output.  Here's my 19ET Scale file: <br />
<code><br />
! C:\Scala22\19ET.scl<br />
!<br />
19 ET<br />
 19<br />
!<br />
 63.15789<br />
 126.31579<br />
 189.47368<br />
 252.63158<br />
 315.78947<br />
 378.94737<br />
 442.10526<br />
 505.26316<br />
 568.42105<br />
 631.57895<br />
 694.73684<br />
 757.89474<br />
 821.05263<br />
 884.21053<br />
 947.36842<br />
 1010.52632<br />
 1073.68421<br />
 1136.84211<br />
 2/1<br />
</code></p>

<p>Here is the 'retuned' MIDI files for my Prelude 3: <a href="http://parnasse.com/midi/prelude3-19ETuned.mid">Prelude 3 MIDI 19ET Tuned</a></p>

<p>I have not been able to successfully use the latter method, using the -Z argument to a command line run timidity.  Timidity can be run, as just implied, like Csound as a app from within DOS or another shell, and by giving it arguments, it produces the same output.  </p>

<p>The command line I used was this:</p>

<p><code><br />
./timidity -Z freq19.txt -Ow -oprelude3-19ET.wav prelude3-19ET.mid<br />
</code></p>

<p>This produced some obviously re-tuned audio, but not using the scale as expected.  Since I have the MIDI Tuning Dump method working, I'll probably not investigate this methodology further.  </p>

<p>Thanks to Graham Breed for the example:</p>

<p># mean-tone tuning (in A minor)<br />
8278<br />
8587<br />
9236<br />
9581<br />
10305<br />
11083<br />
11497<br />
12366<br />
12828</p>

<p>Here's a Perl script for generating such a column of data appropriate for an equal-tempered tuning:<br />
<code><br />
print "# equal temperament\n";<br />
foreach $i (0..127) {<br />
$f = (440 * (2.0 **( ($i - 69) / 12.0)) * 1000 + 0.5);<br />
print int($f), "\n";<br />
}</code></p>]]>
      
    </content>
  </entry>

</feed>
