home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
files
/
music
/
musicscl
/
musscale.doc
next >
Wrap
Text File
|
1987-08-02
|
2KB
|
35 lines
The MUSSCALE program is an example of a way to play musical
notes from a Pascal program. After playing with several BASIC
programs that played music on the internal synthesizer, I thought
that BASIC was simply doing a little bit fiddling to produce the
notes. I quickly found out that there is more to it than that.
Although I have two books devoted to ST sound and the Abacus
Internals book, I couldn't figure out how to get a musical scale.
There was some non-trivial conversion required. As a matter of
fact, Internals has some information that is actually wrong. It
says the period information is divided into a 'set frequency'
field and a 'step size' field. Not so. It is one single 12 bit
number.
The scale we use for music divides an octave up into 12 notes. Two
notes F0 and F1 where F1 is one semitone higher than F0 have the
relationship: F1 := F0 * 2 ^ (1 / 12). To establish a base
frequency, I got a zero beat between the synthesizer and a
keyboard. From this I established middle C as having a period of
478 on the ST. With this background, the program should make
sense to you. Note that the sound chip can produce 27
frequencies *between* middle C and the adjacent B!
I got the number 478 by beating against a Yamaha PSR-11 keyboard
which has the pitch still at the factory setting. Someone with
better ears and/or equipment could, perhaps, refine that figure.
Please let me know of any improvements you come up with. The
program includes an easy way to tune the synthesizer channel. You
can almost 'hear' a string getting tighter and looser as you tune.
The program has code to turn the key clicker off and back on
automatically without using the CONTROL.ACC. The clicker
interferes badly with sound production.