When I was in college (DeVry BSEET course) my Junior Class Project was a uC based clock using the Heathkit ET-3400 Trainer (the Lab Class supplied equipment). The requirement was ASM programmed
Sound Generator chip (don't remember the number) and audio amplifier with time display. Minimum
requirement was 7-segment time display, audible "tick" sound every second, and a musical tune played
every hour. Minimum requirement was 6 to 8 "notes" (actually "sounds" since they didn't have to conform
to musical scale known frequencies so they could be "out of tune" and still meet the requirement). One
of my classmates was another tech with many years of experience (I had 12 yrs hands on tech experience,
I don't remember how many he had). Everyone else was fresh out of HS with no electronics experience.
So my classmate and I were always competing with each other because there was no competition from anyone else in the class. After we received the assignment I vowed (to my classmate) that I would program the uC to play the entire 1 min, 35 sec theme to Deep Space 9. DS-9 THEME
I paid a professional musician $40 to convert a tape recording to sheet music, looked up the frequencies
and proceeded to write the program. The problem I encountered was the uProcessor clock frequency was
too low to give me the resolution to get from a whole note to a sharp or a flat and the notes always sounded sour. After thinking about it, I decided to "hack the Trainer" and replaced the 4 Mhz crystal with
a 6 Mhz crystal. The CPU chip started to heat up so I put a huge heatsink on it. I was able to get the
frequencies close enough that only a musician could tell they were still slightly off. The note durations
were so long I had to use a 16 register for the duration timing loop (everyone else used 8-bit).
After many code revisions I finally nailed it and added a VFD (Vacuum Flourescent Display) so I could
"scroll" the time (everyone else used 7-segment displays incrementing). The frosting on the cake was
the 5 W audio amplifier circuit (everyone else used 1/2W) and the 6" speaker (everyone else used 1" or
2"). On Presentation Day it blew everything else out of the water.
That was the last time I used a uProcessor (with the exception of the
Senior Class Project which required a 68000 based project (a story for another day) until I got into arduino in Oct of last year.
Now I would like to revisit the project with arduino and hardcode the music notes using an array for the
88-notes (I don't need that many for DS-9 but what the heck...) I want to create constant names for
the notes and then an array of the notes so if you have sheet music you can use a function that takes
two arguments, the note and the duration. The idea is that each "tune" would be split into two arrays,
one for the notes and one for the durations. If you write down these two values for each note, and plug
in the notes into the note array and the associated durations into the duration array. The program would
cycle through the arrays using an index limit which is the number of notes in the tune. The number of
durations would have to be the same.
The problem is I am having a hard time finding a sound generator chip to use for the project. It has to
be one that has an 8-bit port to write the values (I think there is a High byte,Low byte register and you
write to the address for that byte. I haven't done any Memory Mapped Peripheral projects with the
arduino and I really don't know where to start. I think the ET-3400 had a 16-bit address bus but I'm not sure because that was so long ago.
My Project TO-DO List is as follows:
1- find a suitable sound chip (and of course look up the musical note frequencies, readily available)
2- Determine if I need to add memory
3- Add an audio amplifier breakout bd.
4- Figure out how to program the sound chip.
5- Figure out how to write the arduino code.
Questions:
1- Is this something that can be done with an UNO ?
2- Is my programming approach correct ? (the arrays)
3- Is there a better way to do it ?
Project Goal
Create a circuit and program so anyone can play any sheet music by coding in the notes and durations.
Obviously, it would be more convenient to have that information in a notepad plain text file on an SD card and read it in as "3rd Octave whole C,1200 ms"
Any thoughts ?