'My Code for Playing Tunes on a 16C84'
My reader has been flooded (with about 60 notes) in the past three days with
requests for the tune code. I guess there's some interest in it. So, I've
spent a few hours, cleaning everything up and making sure it works properly
(actually, I only found one major error where F# was actually using D#'s value).
The hardware required is a PIC16C84 running at 1MHz (Using a crystal) and
driving a 0.47uF cap and Piezo-Speaker in series connected to RA0 and Vcc.
Now, looking at it, I could put all the source in a note and beam it off.
The problem is, the note would be roughly 2K Lines Long.
I don't really want to do this because I'm sure I'll be swamped with
requests for compiling the "C" Code (I don't think that many people are
using the old IBM "C/2" Compiler Version 1.10), so I would like to send out
that code as .EXE's and avoid all the questions about how to compile the code.
Does anybody have an ftp site I could dump the exe's, docs, and sample
tunes? I'm also interested in finding out what people want in the package,
so after reading this note, if you feel there's something that you feel
should be added, please let me know or forever hold your peace.
What I am proposing to put in the package:
1. A (very) brief Description of how everything works.
2. The NOTES.EXE Program. This Program produces Counter Values for the
various notes, their frequencies and durations (for 1/eigth, 1/quarter,
3/eigths, 1/half, 3/quarters, 4/quarters) for user specified beats per
minute. The program is designed for a clock frequency of 1MHz. It could be
changed for different frequencies, I just don't know if I'm that energetic.
NOTES.EXE produces NOTES.FYL which is a set of Equates for the SOUND.ASM
Source and SOUND.FYL Program. NOTES.EXE produces Notes from the "A" below
middle "C" to the "D" One Octave above middle "C". Again, I don't know how
energetic I am in increasing the note range and I don't know how high I can
go with the current Interrupt Handler (I did cut it down from the original
"FROSTY" Application) - maybe two or three more notes. Sharps of all the
notes are included (if ya want a flat, go to the Sharp). Just for the
purists out there; none of the frequencies are off from their respective
notes by more than 0.3%.
3. The MUSICMKR.EXE Program. This Program takes a tune input file
(Basically the note and the duration) and converts it into Assembler Table
Routines. The Table Routines Produced can ONLY be used in the SOUND.ASM
Source. MUSICMKR produces a *.FYL file, where "*" is the name of the Tune
Source File (Defaulting to type ".SRC"). The *.FYL file should be renamed
to SOUND.FYL before SOUND.ASM is Assembled. MUSICMKR can be thought of as a
(very) simple compiler.
4. SOUND.ASM Source. This is the shell that sets up the Timer and the
Interrupts and plays the tune. The tune stops when a note with a timer
value of "0" is encountered and starts playing over. The code was produced
using a compiler I have written. I am not willing to distribute the
compiler at this time (largely because there are a lot of problems with it I
have to debug). Having said this, the code produced is quite efficient,
although there are two source statements which have 16 bit operations which
would be hard to understand. SOUND.ASM calls in two include files,
NOTES.FYL and SOUND.FYL, which are the Notes and Duration Equates and the
Tune Tables, respectively. SOUND.ASM should be compiled using MPASM, NOT MPALC.
5. Sample Tunes. I'll go through my kid's basic piano books and make up a
few sample tunes for the program.
That's about it. When we have concensus on how the code should be
distributed I'll send it out.
Have a great New-Year!
More... (looser matching)
- Last day of these posts
- In 1995
, 1996 only
- New search...