Oracle Blog

Josh Simons' Coordinates in the Blogosphere

Playing Music on...a Flat Bed Scanner?

Indeed. According to the February 1997 issue
of the HP Journal, the HP ScanJet
3c/4c has a built-in music playing mode that takes advantage of the scanner's
variable speed stepping motor to generate notes of specified frequency and
duration. Here is an excerpt from the article:

The HP ScanJet 3c/4c scanner uses variable y-direction scanning. This means that the scan head travels at different speeds dependent on the y resolution. This also means that the stepper motor runs at variable frequencies.

Musical notes are air vibrations at given frequencies. Play Tune (Esc\*u0M) is an SCL (Scanner Control Language) command that can be used to make the scanner play any song downloaded into its buffer. The song can be loaded into the scanner s internal buffer using the SCSI write buffer command. The format for the song is: number of notes (2 bytes), note one, note two, etc. Each note is three bytes. All numbers are in hexadecimal format.

The first two bytes of each note specify the number of 3-MHz clock cycles between full motor steps for the desired speed. The third byte is the note duration in multiples of approximately 1/8 second. For example, middle C is 256 Hz. The clock frequency is 3 MHz, and the motor half-steps. For middle C, therefore, 3,000,000 clocks per second
X 1/256 second per full step X 1/2 full step per half step = 5859 clocks per full step, which in hexadecimal
is 16E3. For the third byte, a 4 would move the motor for 1/2 second (4/8 = 1/2). Thus, to get the
scanner to play a 1/2-second middle C, the number to download is 16E3, 4.

For a rest between notes, set the frequency to zero and the duration to the desired length of the rest. When playing notes, the scan head
always moves towards the center of the scanner and any frequency above the maximum scan rate of the scanner is truncated to the
maximum scanning speed. This gives the ScanJet 3c/4c a three-octave range with the lowest note at about D below middle C.

To listen to a tune played on the ScanJet, check out the links at the bottom of
this page.
To me, it sounds a bit...flat.

With technology having moved forward nine years, it would be nice to see an updated version
of this hack. How about a scanner that can read sheet music, parse it, and then play it back
with its stepper motor?