CALCMOD TECHNIQUES

BY EVAN MORITZ
Last updated: March 1, 2004
Contact: evanae13@aol.com
Welcome to the CalcMod v2.2 technique documentation! In this file will be fully explained the whole of creating songs for Calcmod v2.2. Be you a beginner seeking to learn or a more advanced songwriter interested in learning more, this document is for all CalcMod lovers out there.

Table of Contents:

  1. Required Programs and Development tools
  2. Required Hardware for CalcMod v2.2
  3. Basic structure of a CalcMod song
    1. Header
    2. Body (song data)
  4. Explanation of how it works
    1. Include files
    2. More Header Info
    3. Note Insertion
    4. Channels
  5. Compiling Your Song
  6. Advanced Techniques
  7. Adding Your Techniques to this file
  8. Credits and Thanks
  9. Messageboard

1. Required Programs and Develpoment Tools

In this section will be described the tools needed to write, compile, and play any songs you write for Calcmod.

DescriptionLinks
 
Lets start with the actual Calcmod program. This can be downloaded from the ticalc website at:
http://www.ticalc.org/archives/files/fileinfo/144/14445.html
This is the upgrade from previous versions. For full use of the stereo format (and for better understanding of this document) please download this program.

Seeing as CalcMod runs off of MirageOS, download that at: http://www.detachedsolutions.com/mirageos/
Make sure those two files are on your TI-83+ before attempting to run CalcMod or play any songs.

Next are the development tools needed to compile your CalcMod songs. Your song must be compiled with a Z80 compiler. I suggest use of my custom compiler for its ease and quickness.
This can be found at: http://www.ticalc.org/archives/files/fileinfo/321/32178.html
Information on how to use this will be found later in this document.

****IMPORTANT*****
If you wish to fully utilize the stereo format, please download the new CalcMod include files from:
http://www.ticalc.org/archives/files/fileinfo/321/32133.html

Also, some version of the TI-GRAPHLINK or TI-CONNECTIVITY KIT is required to send a song to your calculator.


2. Required Hardware for CalcMod v2.2

Of course, you need a TI-83+ to use the MirageOS application and CalcMod v2.2. There are two other items that are essential to listening to your songs: a set of headphones and an adapter for the linkport.

Most headphones have a 3.5mm head and require an adapter for a 2.5mm head. I purchased mine from Radio Shack for cheap. If your headphones have different dimensions, please make the neccessary changes in adapter size. Just make sure the end is a 2.5mm head.

After you have the adapter, plug it into your calculator and plug in your headphones. It is a good idea to wait until you are in the CalcMod program before you do this, because of the Silent Link technology associated with the link. The headphones reroute the circuit back to the calculator, making it think that it is receiving data. When you are in the CalcMod program, this is turned off so will not have this problem. If you insert the headphones at the homescreen, the cursor will blink and will not read any keypresses from the keyboard and you will hear a clicking sound in the headphones. Just wait until you are in CalcMod v2.2 to insert the headphones.


3. Basic Structure of a CalcMod Song

a. Header

The header is by far the most important part of your data. The CalcMod program searches through all the programs you have for compatable songs; the right header will include it in this list.

The correct header for a song looks like this:

	#define stereo		;required
	#include "notes2e.inc"	;updated inc files
	tempo .equ xxxx		;xxxx represents the tempo
	#include "tempo2e.inc"	;updated inc files

		ret		;so TI-OS wont run it
		.db "Calcmod",0	;includes song in CalcMod
		.db "Description",0	;song description
		.dw 1,0		;so old ver. wont run it
		.db 3		;required
	ds:			;data label
		.dw channel1-ds	;points to left speaker data
		.dw channel2-ds	;points to right speaker data
More on the header will be gone over in section 4b. Also note that header.txt has been included for easy copy/pasting into your program.

b. Body (song data)

After the header comes the actual data of the song. Correct setup should look like this:

	channel1:
			;
			;\
			; -left speaker song data here
			;/

	note($FF,$FFFF)	;end note

	channel2:
			;
			;\
			; -right speaker song data here
			;/

	note($FF,$FFFF)	;end note

	.end		;'end of program' marker
More info on the body will be included in section 4c + 4d.


4. Explanation of How It Works

a. Include Files

The include files explained in this document are the updated versions labeled 'notes2e.inc' and 'tempo2e.inc.' If you havent already, please view section one for the website location.

First we will look at the include file 'notes2e.inc.' This file defines all of the notes (including rests) as a numerical value read by the CalcMod program. It defines six octaves each starting at C natural and includes each ascending note, including sharps and flats. Please note that a sharp of one note is equal to the flat of another note.

At the start of notes2e.inc is an interesting set of data that looks like this:

#ifdef mono
	#define note(pitch,len) .db pitch \ .dw len \
#else
#ifndef stereo
	#define note(l,r,time) .db r,l \ .dw time \
#else
	#define note(note,time) .db note \ .dw time \
#endif
#endif
This set of commands defines how the setup of notes is to be. It is important to define the correct format before including this file. For mono, at the top put '#define mono.' For the old stereo format, you need not put anything. For full use of CalcMod v2.2 and for the sake of this document, put '#define stereo' at the top of your header.

More on note insertion will be described in section 4c.

The next include file is 'tempo2e.inc.' In this file is defined all of the note lengths and durations (or for you non- musical people, its the time the note is held out).

Just as you had to define the stereo format before you included notes2e.inc, you have to define the tempo the song is to play at before you include tempo2e.inc. The tempo is the number of beats per minute, or the speed of the music. If you are not acquainted with musical terms, it is highly recommended you find someone to explain it to you in depth.

The first section of tempo2e.inc defines the basic note lengths, ie. quarter, whole, etc. In a stroke of genius the creator of CalcMod discovered that a set number divided by the tempo would give you the perfect note duration called the quarter note, which is the basis for defining all other notes. It is possible to make notes shorter than sixtyfourth, but more testing is required before I can positively say anything about that.

The second part of the include file is a special section I compiled for dotted notes, ie. the note plus 1/2 the note duration.

The third section is all about triplets. Triplets are three notes of equal length that take up the space of two. So, for instance, if you had three quarter note triplets, they would take up the space of two normal quarter notes, or a half note.

The fourth section is short but can be expanded to fit your needs. Dblwhole is an eight note duration, or two whole notes tied together. If you wanted to make more like this, then you would insert this:

#define dblNOTE		NOTE*2
The last section of the include file is something I made special for the needs of musicality (whatever). I defined a note that had a sixtyfourth part of it cut off at the end. Notes like these (ex. rhalf) MUST BE FOLLOWED BY A SIXTYFOURTH REST FOR DESIRED EFFECT. This is to allow distinction between two consecutive notes of the same pitch. It used to be that when two notes were side by side they meshed into one long note. Now, the 'r' notes followed by a sixtyfourth rest can allow the listener to hear the seperate notes.

The very last part is where you get to make custom note durations.Say you want a quarter, eighth, and sixtyfourth duration called 'tienote.' Insert code like this:

#define tienote		(quarter)+(eighth)+(sixtyfourth)
Make sure this is after those individual notes are defined and that there are parenthases around the notes, because of the multiplication/addition. In other words, make sure there put there.

b. More Header Info

In this section will be described in detail how the header works. Lets take a look at each line of commands.

	#define stereo
This should be the first thing put in the header and should be immediately followed by "#include notes2e.inc" This first line defines the format you will be using to describe notes and their durations. You only need to know about the new stereo format, all the other formats are outdated.
	#include "notes2e.inc"
This tells the compiler to copy all of notes2e.inc into your program. It defines all of the notes in seperate octaves and should come right after you #define stereo.
	tempo .equ xxxx
xxxx is the number of beats per minute (speed of music). Please note that the tempo must be greater than or equal to 60 bpm. #include tempo2e.inc immediately on the next line.
	#include "tempo2e.inc"
Tells the compiler to copy all of tempo2e.inc into your program. It defines all of the note lengths and should come right after you set the tempo.
	ret
This is the 'return' function that quits the program if you try to run it outside of CalcMod. If this is missing then your calculator could be screwed up.
	.db "Calcmod",0
This is read by the CalcMod program to include your song for playing. If its not there, it wont play your song.
	.db "description",0
This is the description of your song that will show up on the screen. This should be kept short and should be relevant to the song, such as the song title.
	.dw 1,0
This is put into the header so old versions of CalcMod wont play your song. They are formatted differently and arent compatable with the stereo format. If they tried to play it they would have a breakdown and could ruin your calculator.
	.db 3
I am not entirely sure what this part is for, but I think it is some sort of token of how the song is formatted. Make sure it is put in your program.
	ds:
		.dw channel1-ds
		.dw channel2-ds
This is where CalcMod reads the pointers to the seperate stereo data and is extremely important this is put in there. Also make sure that '-ds' is put after channel1 and 2 because if it isnt CalcMod will read your data differently and your song will sound like crap.

c. Note Insertion

Since it is highly recommended you make songs for CalcMod v2.2 I will only cover how to write for the new stereo format. If you have any questions about the other formats, please email me at evanae13@aol.com.

To place a note into your song, the function must be set up like this:

	note(pitch,length)
Its as simple as that. Since the new version uses two seperate channels, make sure you write in both places. More on that in section 4d.

To end your song, place the following function at the end of your data:

	note($FF,$FFFF)
This tells CalcMod to stop immediately. It is recommended that you put this at the end of both channels to make sure that your data is correct and ends at the same time.

It helps a lot to have a piano or keyboard handy when writing your songs. You can quickly tell if your notes sound right and it also helps with choosing what notes to put in.

Legal notes range from c0 to b5. Flats and sharps are the black keys and are put in your song with the note then 's' or 'f' (ex. A-sharp 3 would be as3).

The number following the letter is the octave which the note is in. Most songs use octaves 3 and 4 but you can use any you want.

If you have more questions about this or I left something out please email me at evanae13@aol.com.

d. Channels

The unique thing about this version of CalcMod is that it reads two seperate lines of data at the same time and sends each one to a seperate speaker. Channel 1 is the left speaker and Channel 2 is the right speaker. This can be used to your advantage for some special effects. Please read section six on advanced techniques (thats what you all wanted to read anyway)

Here's a table that shows it:

Channel1:Channel2:
note(a3,quarter)
note(b3,quarter)
note(c3,quarter)
note(d3,quarter)
note(e3,quarter)
note(f3,quarter)
note(g3,quarter)
note(g3,quarter)
note(f3,quarter)
note(e3,quarter)
note(d3,quarter)
note(c3,quarter)
note(b3,quarter)
note(a3,quarter)

In the right speaker you would hear notes going down and in the left speaker you would hear notes going up.

Since this is a table, I dont want you believing that is how you set your song. In a program it would look like this:

;header goes here

channel1:
	note(a3,quarter)
	note(b3,quarter)
	note(c3,quarter)
	note(d3,quarter)
	note(e3,quarter)
	note(f3,quarter)
	note(g3,quarter)

	note($FF,$FFFF)

channel2:
	note(g3,quarter)
	note(f3,quarter)
	note(e3,quarter)
	note(d3,quarter)
	note(c3,quarter)
	note(b3,quarter)
	note(a3,quarter)

	note($FF,$FFFF)
.end
Just making sure you got that. For an example song, please download MYSTIQUE.zip at: http://www.ticalc.org/archives/files/fileinfo/321/32132.html


5. Compiling Your Song

This is where everything comes together and is made into a song that can be transferred onto your calculator.

If you are using my custom compiler (see section 1), follow the instructions on COMPILING ONLY and completly disregard anything it says about headers and data setup; use the format described in this document. If you are using a differnet compiler, use their instructions but use this header instead of theirs.

After you have written your song in some form of Notepad, save it as *.asm or *.z80,depending on what compiler you have. Compile it and then send it to your calculator. MAKE SURE NOTES2E.INC AND TEMPO2E.INC ARE IN THE FOLDER WITH THE COMPILER OTHERWISE IT WILL NOT COMPILE. After everything is done you can play your song by opening MirageOS and running CalcMod. Go to your song, insert headphones, hit play and ENJOY!


6. Advanced Techniques

This is the part everyone has been waiting for! In this section I reveal all of my secrets on making songs and tweaking the program to your advantage. Please utilize these techniques to your programming heart's content.

Some of the techniques are included in the 'MYSTIQUE' song that is described at the end of section 4d.

Chorus
Say you have a part of your song that gets played many times (ie. the chorus). Isnt it annoying having to write it over and over again? Well, instead of doing that you only have to write it once! Heres how you do it:

1-Open a completely new Notepad file. Write in the chorus just as it would look in the song; no header, no channels, just pure notes.

2-Save it as something youll recognize, such as "chorus.asm" Make sure it is saved in the same folder as tasm (ie. the compiler).

3-In your song, where you want the chorus to be, place:
#include "chorus.asm" or whatever you named it.

4-Compile your song and its done! Just make sure the chorus include file is in the same folder as tasm.exe.

Tempo Changing
Some songs require a different tempo at different times in the song. To change a tempo in the middle of the song, place 'tempo .set xxxx' right before the notes where xxxx is the new tempo. You can get really crazy switching from slow tempos to really fast ones. Remember to change it on the other channel too.

Channel Switching
This is a very simple technique that can produce very satisfying effects. Say you have your high notes on the left speaker and your low notes on the right speaker. After playing the melody or tune or what ever, switch each part to the other speaker, in this situation high to right and low to left It sounds really cool but dont do it all the time because it might sound monotonous. Its kind of catchy though.

Stuttering
You know on cartoons when they flash two colors in an area really fast over and over? Well its like that except for your ears. On one channel, play a note, usually short, and on the other channel play a rest of the same duration. Then switch the two and the effect should be a note played on one speaker at a time and really fast, creating a stutter effect. Ex:

Channel1:Channel2:
note(a3,sixteenth)
note(rest,sixteenth)
note(a3,sixteenth)
note(rest,sixteenth)
note(a3,sixteenth)
note(rest,sixteenth)
note(a3,sixteenth)
note(rest,sixteenth)
note(rest,sixteenth)
note(a3,sixteenth)
note(rest,sixteenth)
note(a3,sixteenth)
note(rest,sixteenth)
note(a3,sixteenth)
note(rest,sixteenth)
note(a3,sixteenth)

This can be changed to sound even cooler. Instead of rests every other note, put the notes equivelent on a higher octave after it and the low one on the other channel. Like this:

Channel1:Channel2:
note(a3,sixteenth)
note(a4,sixteenth)
note(a3,sixteenth)
note(a4,sixteenth)
note(a3,sixteenth)
note(a4,sixteenth)
note(a3,sixteenth)
note(a4,sixteenth)
note(a4,sixteenth)
note(a3,sixteenth)
note(a4,sixteenth)
note(a3,sixteenth)
note(a4,sixteenth)
note(a3,sixteenth)
note(a4,sixteenth)
note(a3,sixteenth)

Instead of sounding like stutter it sounds like a siren in the middle of your head. See the next section for more info.

Messing with your head
In addition to playing notes on two speakers, you can create the effect that its playing in the middle of your head. Just play the same note at the same time on both channels and !bam! it happens. This can be tweaked to create a 'surround sound' effect. What you do is play a note on one channel, then do it on both, and then on the other channel, over and over. It sounds really cool and you can play stuff on the other channel at the same time.

Staccato
Staccato is basically cutting a note short but still keeping the entire length of the note. It sounds like quick little taps on the keys. To do it, take the length of the note, cut it in half, and then make it that note and a rest. For example, an eighth note will look like this in staccato:
note(a3,sixteenth)
note(rest,sixteenth)
It still has the length of an eighth but sounds short and quick.

Tied Notes
Tied notes are a string of the same note all played as one long note. You can just insert all the notes on after another, but it makes a slight clicking sound. To get rid of that, make a custom note length (bottom of section 4a).

Techno Buzz Waves
Its kind of hard to describe this but Ill try my best. Since octave 0 is so low, the headphones cant play it accurately and it sounds like a low buzz. To make wavering, play a low note and then a note a couple of steps higher and then back down again. If you do this repeatedly and use channel switching you can get a very cool effect. Also if you try 'messing with your head' it can get real crazy. This technique is best used for background and building but Im sure someone can find an even cooler use for it. Just keep trying!

Tweaking
After inserting an 'r' note, instead of placing a rest after it put in a sixtyfourth note a step or two higher. This will make the note 'tweak' up a little bit. Sounds real cool.

Waves
This is like techno buzz waves except using higher notes. Choose a starting note and go up and down a bunch of notes very fast. Used with channel switching, this can create an interesting effect.

Combining Techniques
It is highly recommended that you experiment and try to combine techniques to create new effects. For instance, use stuttering with extremely high notes and do waves with them is really cool. If you discover anything new please contact me so I can add it to my list.

FOR IMPORTANT INFORMATION ON ADDING TECHNIQUES SEE NEXT SECTION>>>


7. Adding your techniques to this file

I ecourage everyone out there to play around and find new techniques that can be used by everyone. If you do come up with a new technique, email me and supply your name, email address, and description of your technique. I will review your entry and get back to you on your technique. If it is valid then I will include it in the Advanced Techniques section with YOUR NAME AND EMAIL on it!!! That means you get credit for it. If you dont want your name or email in it then just tell me and I will place ANONYMOUS as the author. I will upload updates to this document periodically so if I get your technique it will be included in the update. Think of the exposure!!!

Please contact me with any new techniques you discover.


8. Credits and Thanks

I give extremely special credit to Paul Marks for developing CalcMod and his provision of wonderful enjoyment to everyone who plays CalcMod songs.

I would like everyone to know that I wrote this entire document myself (your techniques excluded) based on my experiences with CalcMod and lots of development and research.

I thank everyone who downloaded this documentation and I hope it helped lots of people out there.

I also thank everyone who provided me with their techniques and encourage everyone to develop new ones. If you do, send 'em to me and I will include them in this file.

I have a small beef with the ticalc website because they do not rank the media section, therefore disallowing me to see how many people have downloaded this and have been helped. If you would like to thank me just email me telling me so. And if you have something unpleasant then you can email me too

If I have missed anything in this document or you would like to see some additions then contact me and I will see what I can do.

Peace to all you CalcMod lovers out there!


MESSAGE BOARD

Hey all you people out there this is the new message section where people who have relevant things to say can put their messages. To add something to this file, contact me and Ill see that it gets in here.

The first item of discussion is about a new section labeled "Songs" in which will contain links to all the web locations of known songs. Author and other information will be included, creating a directory to the songs. I appreciate all comments on this, so email me on what you think.


Questions? Comments? New techniques? Contact me at: evanae13@aol.com.

Look for more of my stuff at: http://www.ticalc.org/archives/files/authors/80/8013.html


© 2004 Hackard Programming