HARMONIC ANALYSER V2.4b

by Fred Nachbaur ©1999, 2002
(This documentation included in the distribution package as a .txt file)

What's New as of V2.4b (Apr. 18, 2002)


VERSION 2.4a (March 18, 2002):

VERSION 2.4 (March 6, 2002):

VERSION 2.3b:

VERSION 2.3a:

VERSION 2.3:

VERSION 2.2b:

VERSION 2.2a:

VERSION 2.2:

VERSION 2.11:

VERSION 2.1:

VERSION 2.0:

GENERAL:

This simple program lets you experiment with tempered n-tone scales, and the relationships of such scales with the harmonic series. Once you've built your scale of choice, the program also gives the required pitch-bends to make MIDI play your new scale. Or experiment with different tempers using the good old traditional 12-tone scale. A number of predefined temperaments are provided, or you can import from a massive database of temperaments collected by Manuel Op de Coul. Results can be exported to Midi-Temper or Piano-Tuner to automagically temper pre-existing midi files (GM format).

INSTALLATION:

The self-extracting install program will, by default, place the entire program suite (including MidiTemper and PianoTuner) and all support files into the C:\HARMONIC directory, but you can override this by specifying a different extraction directory. It will also create the following subdirectories:

\DAT - for temperament files exported from Harmonic Analyser, for reimport into PianoTuner or MidiTemper.
\DOCS - Documentation (including this file)
\MIDI - Midi files (source and destination)
\SCL - for "Scala" format .SCL files
\SOURCE- The qbasic source files for these programs. May be deleted if you don't intend to study/modify the programs.

USAGE IN DOS:
The Windows self-extracting executable HARM24.EXE can be extracted and installed using PKUNZIP.EXE, which should either be in your root directory or in your DOS path. Also place HARM24.EXE in your root directory, then use the command line:

PKUNZIP -D HARM24.EXE C:\HARMONIC


After extraction, all you have to do to run the program is change to the install directory (e.g. CD C:\HARMONIC) then enter HARMONIC at the command prompt. If you plan on importing from the SCALES.ZIP archive, you'll also need pkunzip.exe (included as a courtesy in the distribution package). You'll also need to have SCALES.ZIP in the same directory as the other executables (e.g. C:\HARMONIC)

USAGE UNDER WINDOWS:
This and the other programs in the suite will run fine under most versions of Windows, the notable exception being Win2000 (under which keyboard difficulties have been reported). After running the self-extracting install executable, you can create links ("shortcuts") to your desktop or Start Menu (32 bit Windows versions) or Program Groups (16-bit Windows versions)

WIN3.x

Using File Manager, drag-and-drop harmonic.pif into your desired program group. You'll just have a generic DOS icon at this point. Click on it to select it, then in the Program Manager window click File -- > Properties. Click on "Change Icon", Windows will tell you no icon is associated with that file. Ignore that bit of wisdom, and browse to your directory and select harmonic.ico.

To adjust window/font size, bring up the program by double-clicking its icon, then click the system button at the upper-left corner, select Fonts. . . and adjust according to taste. Windows will remember your settings in the future.

WIN9x

Using Windows Explorer, drag and drop harmonic.pif (usually shows up as just "harmonic") into your destop folder of choice. At this point you'll just have a generic DOS icon. Right-click on it, select Properties. Click the Program tab. Click the Change Icon button. Click Browse. Find your way to the directory (folder) containing harmonic.ico, click on it and then click the Open button. Click OK. Now fill in the "Working" field with the path to harmonic.exe, example c:\myfiles\music\weirdstuff\. Click OK. You'll now be all set to go.

To adjust font-size, right-click on the icon, select Properties, click on the Fonts tab, and adjust according to taste and proclivity. Windows will remember the setting the next time you use it (if all goes well...)

USING THE PROGRAM:

0: Intro

At the cover screen, you have the option of configuring the program with your desired defaults. Press "Y" to run the program configurator, which writes your preferences (including colours, default sound duration, and other defaults) to harmonic.ini in the base directory. To bypass the setup section, just press Enter. Throughout the program, Enter is used as the default input key.

It's suggested that you keep the "factory" defaults, as supplied, until you are familiar with the program's operation. (This is especially true for the "expert mode" option, which bypasses the tutorial info screens.)

If harmonic.ini is deleted by mistake, the next time you launch the program it will jump to the configurator utility to re-create it.

1: Computing Harmonic Tone Values

You're first asked how many harmonics you want to take into account. The upper limit is quite high (several thousand), but a practical maximum is about 2000 especially if you plan to use the "SCALA scales browser".

You may not be particularly interested in the harmonics relationships, using the program only as a means of experimenting with temperaments. No problem, just press Enter for the default of 39 harmonics.

Keep in mind that the higher the harmonics go, the less meaningful they become from a strictly physical perspective. Example: the 50th harmonic of 100 Hz (a pretty low bass sound) is at 5000 Hz (approaching the upper limit of identifiable musical tones). On the other hand, many musical scales are generated by raising integer ratios to powers, and high harmonic values can rapidly be attained.

The actual number of meaningful harmonics will of course be only 1/2 of the number you select, because all of the even harmonics either will be octaves of the tonic (2, 4, 8 etc.), or octaves of other odd harmonics (6, 10, 12, etc.).

SUBHARMONICS

A new feature of V2.4 is that subharmonics are computed also. Even though subharmonics don't exist physically, they are a useful construct musically. This is because a musical scale is actually a circle of tones, and has no real beginning or end.

To get a feel for this, take the classical Pythagorean approach. This essentially uses only the first and third harmonics; the first is of course the tonic (and its octaves) and the third harmonic is the perfect fifth. So, in the key of C, the fifth (G) would be perfectly harmonically related, and would have the tone value of 3/2 (the tonic, C, being 1). The fifth of G would be D, and would have a tone ratio of 9/4 (3/2 * 3/2). Since this number is greater than 2 (the octave) we "normalise" it by dividing by two, reducing it to 9/8. The fifth of D is A, with a tone ratio of (3/2 * 3/2 * 3/2) or 27/8, reducing to 27/16. And so on.

But what about going the other way? In the key of C, the note F is related to C in the same way that C is related to G. So a perfect fourth is just an inverted perfect fifth. Another way of thinking about this is that the fourth is a subharmonic of the tonic, having a tone value of 2/3, which, again, would be normalised by octaves (this time by multiplying instead of dividing) such that the final number is between 1 and 2, yielding a ratio of 4/3. By extension, B-flat would be (4/3 * 4/3) = 16/9.

The program computes the harmonics and subharmonics up to the specified maximum, dividing (or multiplying) by octaves such that all values fall in the range between 1 and 2. These note values are used throughout the program to normalize the tones. To help clarify this, let's say that A=440 is your chosen tonic. A note value of 1 would be 440 Hertz, a note value of 1.5 would be E at 1.5 * 440 = 660 Hertz, and so on. A note value of 2 would be the octave, A=880, so it "wraps around" and becomes 1 (A) once again.

The program then sorts the harmonic and subharmonic tone values into ascending order, in preparation for the final step - computing the "nearness" of the harmonic notes to the notes of your chosen n-tone scale. (Note that subharmonics are shown with a minus sign.)

The sorted tone values are displayed in a table, 20 entries at a time. Tap a key to get on to each successive screen.

The subharmonics can be turned off "on the fly" at the program's output screen, or can even be disabled by default. For a great many scales, however, having the subharmonic facility helps in understanding how the scale was constructed.


2: Computing the "N"-tone scale

You can now choose between analysing an n-tone, equally-tempered scale by pressing the "0" option (default), or any of the listed pre-defined tempers. If you're building your own scale, use the "0" (equal tempered) option as a starting point.

Two of the tempers, "Harmonic 1" and "Harmonic 2" were actually designed using this very program! "Harmonic 1" sets all tones to be harmonically related, up to harmonic number 27. Interestingly, there's a big jump to harmonic number 57 ("Harmonic 2") before there is any significant improvement (relative to the equally-tempered scale). It will be interesting to see whether these tempers will be of any use or interest.

Options 17, 18 and 19 are data import options, covered later. Option 20 exits the program.

If building your own scale, you are then prompted to input how many notes you want in your scale (i.e. the value of "N" in "N-tone"). Initially, the program will compute an equal-tempered scale with that number of tones. (You can edit it later.) The resulting tone values are computed and printed to the screen, again in normalized form.

New in V2.3: The practical limit of 24 on N has been removed by displaying only a screen at a time. Just keep pressing ENTER to page through.

3: Comparing with harmonics and evaluating "error"

Previous version now asked you whether you wanted your cents display to be "relative" or "absolute." This has been removed in V2.3, because the relative display (based on equal-tempered scales in other than 12 steps) is potentially confusing, since the "absolute" (based on 12-tET) cents format is almost universally used even in n-tone scales.

You're then asked to specify the "tonic" note that you intend to use for midi purposes. For instance, if you want your tonic to be A=440, enter 1, and so on. If you don't care about midi, just use the default (which gives the scale based on C). Note that some classical temperamentss are defined in terms of a base note (usually C); similarly, the Persian temperaments are defined in terms of E. Such defaults are automatically assigned if you press Enter.

You formerly had to specify whether you want pitch-bend output to be displayed in the "centered" format (i.e. from -8192 to +8191) like NoteWorthy Composer, or in a "zero-based" format (i.e. 0 - 16383) like some other programs. Since the output screen now display both options as well as the midi pitch-bend in cents. So there's one less decision you now have to make.

4: Setting Base frequency (Tone Centre)

Finally (new in V2.2) you are prompted for a value for your desired tone-centre (default is A=440, except for the Highland Pipes temperament which defaults at A=470). Note that this affects only the displayed and exported pitch-bend values; the tonic tone ratio is always assumed to be 1.000, so the tone ratios and harmonic comparisons will automatically "track" to your selected tone-centre.

Since the program allows the flexibility of arbitrarily chosen tonics, the tone-centre is, by default, RELATIVE TO THE CHOSEN TONIC. In other words, in anything but 12-tET, the chances are that your actual "A" note will NOT fall on the chosen A=xxx frequency. In V2.2 you had to correct for this, if desired, by using an external "Basefix" program. However, V2.3 incorporates the necessary tweaks within its user interface.

Here's how it works. If your chosen tonic is A, there's no problem; your chosen A=xxx tone centre will of course automatically relate to A. However, if you chose a tonic other than A, the program has to make some decisions. First it checks to see if you even have an "A" note in your scale. For example, if you have a pentatonic scale on C#, there won't even be an A note in the scale. In this case, your only option is to keep the "relative-to-tonic" tone-centre assignment.

If there is one (and only one) tone in your scale that falls within a quartertone of standard (i.e. 12-tET, A=440) midi "A", this tone is assumed to be the one to tweak such that its actual frequency will be as specified.

On larger scales, however, there is a good probability that several tones will be close enough to qualify as a midi "A". In this case, all likely candidates are reported, and you are asked to make a decision as to which one should carry the assigned tone-centre. Also printed is the corresponding 12-tone Equal Temperament ratio, for reference (new in 2.3b).

(New as of V2.3b): The allowable range of tone-centre frequency has been expanded to 392 - 494; just shy of plus or minus two semitones (the maximum default midi pitch-bend range). Obviously, this can result in overflow if taken to extremes; such overflows are indicated in the output window with an asterisk. (See next section.)

The Output Screen


5: The Results

Then the program proceeds to relate the tempered scale values to the available harmonic tone values. It figures out which harmonic is proportionally closest to each scale tone value, and prints the results in a table. Subharmonics are indicated with a - (minus) sign. (Again, the 24-tone limit has been removed in V2.3 by virtue of the new report/editor interface. More about that later.)

While we're at it, we also compute the nearest 12-tone note, and the required pitch-bend to make that note sound at the correct frequency using MIDI. These are shown in the last five columns of the display, i.e. which note, and how much it needs to be pitch-bent in three different formats; midi pitch bend ("relative," as used by NoteWorthy Composert and zero-based or "absolute" as written to midi) and cents (useful for keyboards, etc. which use cents deviation as input). This is the data that is exported into the .dat file should you chose to do so.

If one or more notes have an asterisk after the note name, this indicates that the limit of midi pitch-bend range has been exceeded. This is usually caused by specifying an excessively low (or high) tone centre (e.g. A=392), or by using an excessive midi note shift (see below). If this happens, you should be aware that using this data in a DAT export will *not* give the expected result. The best thing to do in this situation is to transpose your midi file up (or down) by one semitone, using the new tonic and a more reasonable tone centre. For example: your tonic is A, and you're trying to use a tone centre of A=400. Some of your notes end up with overflows. Solution: transpose your midi down a semitone (to G#/Ab), and re-run Harmonic Analyser with a tonic of G#/Ab. Compute your new tone centre using the following formula:

TC(new) = TC(old) * 1.0594631

In the example, your new tone centre would therefore be about 423.78.

Going the other way, let's say you got an overflow when specifying a tone centre of A=480. In this case, transpose your midi file UP by one semitone (to A#/Bb) and compute your new tone centre using the formula:

TC(new) = TC(old) / 1.0594631

Again to continue the example, your tone centre would move from A=480 to A=453.06.

6: Editing

Finally, you have the option of changing note values to get them closer (or further!) from the nearest harmonic tone value, or manipulate your data according to whatever criteria suits your fancy. Use the cursor keys, in conjunction with Page Up/ Page Down (for scales with more than 20 tones) to navigate around the note values. The menu bar at the bottom of the screen shows your keyboard options.

Pressing Enter with the cursor on one of the note entries allows you to edit the ratio for that note. This ratio can be expressed as an integer. For example, if you want to make it equal to the 11th harmonic of the tonic, you can just enter 11. It can also be expressed as a decimal quantity greater than 1, e.g. 1.50.

You can also enter the value as a fraction, e.g. 3/2, 19/16, etc. As before, quantities greater than 2 are automatically divided down as required.

Finally, you can enter the value as "Cents Absolute", by appending the character "c" (or "C") to the end of a decimal number. So, for example, "200 C" would be two 12-tET semitones higher than the tonic. The tonic will always be 1.000, and cannot be edited.

These options are summarized by the menu bar at the bottom while in edit mode. If you enter invalid input, a bright red flag lets you know about it. After a second the screen is redrawn with the original value, and you can try again.

You may notice that it is possible to position the cursor at either the tonic (at the top of the table) or at its octave (bottom of the table). However, you can't edit these; this is because this program takes the tonic as the reference point, or tone ratio 1.00000. The cursor is only allowed to be positioned at these points to accomodate the "Sound" options.

The table is then recomputed and redisplayed with your modification. Continue editing for as long as you like.

You can get hard-copy at any screen using the PrintScreen key (remember that?)

Type ESC to exit the editing routine and go to the "End menu."

7: OTHER EDITING FEATURES:

As indicated in the menu bar at the bottom of the editor screen, you have a number of other editing options:

DEL = The current entry is deleted from the table using the DELete key. Use with caution, as there is no "undo" (except to use the INSERT command and enter the value again.)

INS = The INSert key does exactly that - insert a new tone value into the table after the current cursor location. The new value is always assigned a tone ratio of 1.00 (corresponding to the tonic), so you have to change this to your desired value using the Edit command (Enter).

R (or r) = Re-order table. This can be convenient to re-arrange the table from lowest to highest tone ratios after editing or inserting. It is recommended to re-order the table before exporting a DAT file for use with MidiTemper or PianoTuner.


8: MIDI NOTE SHIFTING

One of the main difficulties with the midi protocol is that it is essentially a 12-tone, equally tempered system. The "equally tempered" part we can easily do something about, but we're still limited to 12 tones. In other words, midi does not discriminate between enharmonics, e.g. C# and Db. Both have the midi note value of 61 (or its octaves). This has traditionally made life difficult indeed for tempering projects involving enharmonics.

The + and - keys (shifted or not, standard keyboard or number keypad) can be used to force any tone value other than the tonic to adjacent values. This can be quite useful in scales with enharmonics. For instance, if you have both an A# and a Bb in your scale, but no "B" notes, you can force the Bb to "B", and write your midi composition accordingly. Anywhere you want an A#, use A#/Bb as usual; where you want a Bb, write a B.

This information is exported into your .DAT file for use with the tempering programs, so files you compose in this manner will be much easier to temper. For a more involved example, let's say that you have a piece in A harmonic minor that modulates to E at one point, and to C minor at another. While in E it uses a B7 chord (including a D#), and while in Cm it uses an Eb. Midi treats these identically, but by using the Midi Shift feature you can discriminate between them. To summarise, let's say your piece uses the notes in the left column of the table below; the right column shows what notes to shift to:

Actual
note:
Midi
note:
 
AA(tonic - not shiftable)
BbA#/Bb(unchanged)
BB"
CC"
DC#/Db(shift down one)
D#D(shift down one)
EbD#/Eb(unchanged)
EE"
FF"
F#F#/Gb"
GG"
G#G#/Ab"


Then, anywhere in your piece where there is a D, write C# (or Db) instead. Where there is a D#, write D instead. Where there is an Eb, write D#/Eb as usual. All other notes - write as usual. When you play it before tempering, it will probably sound all wrong; however, once you temper it using an appropriate note-shifted .DAT file, it will be all fixed up and the D#'s and Eb's will be properly discriminated.

Midi shifts can be one or two semitones in either directions. Note, however, that a shift of two semitones will cause a midi overflow (as indicated by a warning asterisk) in one of the two directions.

This is also very handy in scales with modified (sharped or flatted) octaves. Inclusion of this facility is specifically what renders the old "Sharp Octave" temperament obsolete.


9: SOUND OPTIONS:

Placing the cursor at any tone and pressing "s" (unshifted) plays the tone at the correct frequency via your PC's internal speaker. The default duration is a bit under a second; you can change this by pressing the "<" key (reduces duration by about 20%) or the ">" key (increases duration by about 20%). You can apply these successively for as long or short a tone as you like. The default sound duration can also be set in the Program Configurator.

Pressing "S" plays the entire scale in sequence, from the tonic to the octave, returning to the tonic when done. Each note will have the same duration, the same as for single notes. The cursor follows the notes as they are played, from tonic to octave. When done, there is a slight delay, and the tonic is played again for reference.

THE END MENU:

EXPORTING DATA:

After you type ESC to exit the editing routine, you have the option of exporting the current data into a ".dat" file for use by Midi-Temper or Piano-Tuner. If you don't specify a name (i.e. use the Enter key alone), a file called harmonic.dat is generated in the /DAT subdirectory below your default directory. Any other name will do, as long as it's in DOS "8.3" format. I strongly suggest using the .dat extension to help keep down confusion when swapping files with other users. Alternately, enter the complete filespec (path), for example "C:\MYSTUFF\DATFILES\COOLDAT.DAT".

A new facility as of V2.3 is the ability to directly call MidiTemper or PianoTuner from the end menu, using the current data. This is very convenient if you wish to temperament one or several midi files using a variety of different temperaments. This shortcut allows you to temper midis using either approach, and return right where you left off. This is accomplished by writing a temporary data file called ________.DAT (eight underscores dot DAT), then launching the selected external program. If MidiTemp or PianoTuner finds the temporary file, it processes the selected midi file according to the temp file's data, deletes the temporary file, and returns to Harmonic Analyser.

The End Menu also allows you to toggle the status of the subharmonics. You might want to compare your scale with harmonics only (multiples of the tonic), and look at it again with subharmonics included in the comparison. Simply press ESC from the output screen, press "6" to toggle the subharmonic option, then press "1" to return to the output screen.

The other End Menu options are pretty much self-explanatory.


IMPORTING DATA:

From the Temperament selection menu you have two data import options:

#17 - RE-IMPORT A .DAT FILE: This is handy if you have a previously exported .dat file, and wish to edit it further or change the tonic or tone-centre. You're prompted for a filename, default is harmonic.dat. As for export, the .dat file is assumed to be in the \DAT subdirectory if you type the filename only. If it's located elsewhere, enther the complete path (filespec).

This takes you back to the temperament data display screen for verification. Press a key to continue. You can now choose a new tonic (the original tonic will be the default), output display format, and tone-center (reference frequency). Again, the original tone-centre will be the default (unless modified by chosing to relate it to A rather than your non-A tonic) . You can then further edit the temperament values, re-export, etc.

One thing you _can't_ do is redefine the number of notes in the scale. Creative use of a hex editor might be just the ticket here (see the section on .DAT file format below).

There are a few sample .dat files included in the distribution package for you to experiment with:

voidsens.dat - this is a hexatonic harmonic scale used in my composition "Void of Sensation"
persharm.dat - I noticed an interesting correlation between the "Persian 1" temperament and the harmonic series; all values fall very close to a 39-limit harmonics scale. This .dat file moves the values to fit the series exactly.

#18 - IMPORT A TEMPERAMENT FROM SCALES.ZIP

Harmonic.exe now (as of V2.2) includes an automatic means for importing Manuel Op de Coul's massive (now up to over 2500 temperaments) scales archive. You only need to have SCALES.ZIP in your default directory, the program does the rest. The first time you use the import option (#18 in the main temperament menu) it generates an index file, then subsequently uses it to extract desired temper, convert to harmonic.exe's file format, and import for viewing/editing/exporting to .dat file. As new versions of SCALES.ZIP appear, you only have to replace the old one with the new one, and delete the SCALES.NDX index file. Harmonic.exe will automatically recreate it based on the contents of the new zip file. Get the latest SCALES.ZIP archive from:

http://www.tiac.net/users/xen/scala/

The import should work for any file that follows the SCALA specification for .SCL files. However. if any files deviate from the "usual" format, they may not import properly or at all. I've tested it with quite a few files, and so far all have loaded properly. If you encounter any that don't load, please let me know and I'll have a look at it.

Many of the scales in the archive consist of more than 12 tones; some a lot more (e.g. 70!). Such scales can be blithely imported, but what are you going to do with them from there? The editing limitation has been overcome with the new editor, but even then you would have to cull the resulting file on import to miditemp or pianotun to allow midi tempering (with its inherent 12-tone limitation).
For most applications, it would probably be wise to stick with the 12-tone (or smaller) scales. Only the more adventurous will find it interesting to work with larger scales, making any necessary midi corrections "after the fact".

The selection UI has been considerably expanded as of version 2.4. The available temperaments and scales are arranged a page at a time, in five columns of 22 rows. They are arranged alphabetically, going down each column from top to bottom. The cursor keys, Page Up/Down, and Home operate pretty much as you'd expect; the beginning and end of the archive wrap around for convenience. Pressing Enter gives you a preview of that scale by printing the *.scl file to the screen, from whence you can choose to import it (default) or not (by pressing N). ESC is also active at this point, should you want to return to the main menu.

#19 - DIRECTLY IMPORT A SCALA .SCL FILE

If you have a scala file in standard Scala .scl format in the \SCL directory, you can directly import it using this option. (As in other cases, if it's anywhere else you'll have to type the full filespec.)

Two sample .SCL files are (voidsens.scl and circle17.scl) are included in the distribution package.

"Circle17.scl" is the classical 17-tone piano scale, where each black key is split into two separate keys to accomodate the enharmonics according to the Pythagorean Circle of Fifths/Fourths. This scale is constructed by taking a tonic (for example, C) and going around the circle of fifths with a ratio of 3/2 (third harmonic) at each step. So G would be 3/2, D would be (3/2 * 3/2) = 9/8, and so on as far as G#. Going the other way uses fourths (subharmonics with a ratio of 4/3), so F is 4/3, Bb is (4/3 * 4/3) = 16/9, and so on. This results in distinctly different tones for Db as compared to C#, and so on. Note that the tone for C# is actually higher than that for Db, contrary to what might be intuitively expected.

"Voidsens.scl" is the hexatonic harmonic scale I used in my spectralist composition "Void of Sensation." This uses tones on harmonics 3, 5, 7, 9 and 11.



PROGRAM CONFIGURATOR:

The program configuration utility is pretty straightforward. You're first asked to set your colours; as supplied, foreground is bright green (10), background is black (0) and highlight is bright red (12). If you change them, you're given a preview to verify that your chosen colours will be readable.

You can then set the default sound duration. If you just press Enter at this point, the duration is set to 9 (about 1/2 second). You can't enter values less than 1 (about 1/20 sec.) or greater than 100 (over 5 seconds).

Another option is whether the program uses subharmonics in comparisons, or not. This might be handy if you're working on "spectralist" scales (e.g. the "Void of Sensation" scale), for which subharmonics are meaningless.

The final option is "Expert" mode. After you've used the program for awhile, you might want to turn this on to disable the "info" screens that help orient new users to what is going on in the program.


PROBLEMS:

The old problem of DOS-generated errors (e.g. by non-existant paths or invalid filenames) is now internally trapped. Such errors should now return you to the point just before the error occurred, or allow you to terminate the program using ESCape. Reports of any difficulties with this would be greatly appreciated.

If very large numbers of harmonics are specified (over 2000 or thereabouts) you can run out of conventional memory when using the "browse scales.zip" import option. If this happens, the choices are to either specify a lower number of harmonics, or else extract the scala file from SCALES.ZIP and use the "import single SCL file" option.

Although CNTL-BREAK will abort the program just about anywhere, it's not recommended unless it manages to get into some bizarre loop condition (which I'd very much like to hear about, especially if you can make it happen again.) Aborting this way *could* leave files open, with resulting contentions later. If this /does/ happen, you might have to reboot, and then delete any leftover *.tmp, *.mid, or *.scl files you find in the program directories.


APPENDIX:
.DAT FILE FORMAT


Here is how the generated .dat files are structured:

Byte 1: Tonic note number, 1-12 (1 = A, 2 = A#/Bb, ... 12 = G#/Ab)
Byte 2: 00 (Reserved)
Byte 3: Number of tones in scale (N = 1-255)
Byte 4: 00 (Reserved)

What follows is N chunks of two pairs of 16-bit signed integers (two's complement, Intel low/high order), one chunk for each note in the scale. Since each chunk is 4 bytes long, it follows that the total file length will always be (N + 1) * 4 bytes in size. (In fact, this is one of the criteria that Miditemp and Pianotun look at to check for a valid .dat file). You can use this fact to help identify .dat files by looking at the length, subtracting four, and dividing by four. So the usual 12-tone chromatic scales will come up with .dat files 52 bytes long.

As mentioned, each chunk consists of two byte pairs or "words". The first word gives the note number, 1 = tonic. For example, if your tonic number is 4 (C) then note number 1 is C, 2 is C#/Db, ... 12 is B. For MOST 12-tone (chromatic) scales, the note numbers will follow in order 1, 2, ... 12. However, this is not necessarily always the case. For scales with less than 12 tones, obviously some of the notes will be missing. For scales with more than 12 tones, there will be more than one entry for some of the notes (enharmonics). It's up the the importing program as to how this data is interpreted. Miditemp.exe and pianotun.exe both ignore missing note values (no pitch-bend from equal-tempered default), and make you decide on which enharmonics to use in the other case.

The second word (two bytes) specifies the pitch-bend from equal- temperament required to implement the desired pitch. A value of zero indicates no pitch-bend. NOTE: The resolution is four times that of GM-standard pitch-bend values, i.e. 16384 per semitone instead of 4096. This is to accomodate synths with higher pitch-bend resolution in the future, without having to change the file format again. The importing program (e.g. miditemp or pianotun) has the obligation to divide these pitch-bends by four to conform with the GM standard.

It should be noted that the specified tone-centre is implicit in the first data entry (the entry for the tonic). If this is zero, it implies the default tone-centre of A=440. This is used by the .dat file re- import option to recover the tone-centre information, so a separate data entry for this is un-necessary.

Comment? Suggestions? E-mail me at fnachbaur@netscape.net

Website: http://www3.telus.net/dogstarmusic


Back to Midi Utilities Page

Copyright ©1999, 2002 by Fred Nachbaur



To get in touch with me, please e-mail Dogstar Music at fnachbaur@netscape.net

Back to "Fred's Freebies"

Go to Dogstar Music's Main Page


---This page last updated Apr. 18, 2002.---