TIATracker Manual
TIATracker Manual
3
Manual
Andre “Kylearan” Wichmann, 2017
[email protected]
Table of Contents
1 Quickstart..........................................................................................................................................2
2 Introduction.......................................................................................................................................3
3 VCS Audio.........................................................................................................................................3
4 For the Musician................................................................................................................................4
4.1 General Concepts.......................................................................................................................4
4.1.1 Song anatomy.....................................................................................................................4
4.1.2 Instruments.........................................................................................................................4
4.1.3 Overlay Percussion............................................................................................................5
4.2 Creating Instruments..................................................................................................................7
4.2.1 Melodic Instruments..........................................................................................................7
4.2.2 Percussion Instruments......................................................................................................8
4.3 The Piano Keyboard..................................................................................................................8
4.4 Composing Music......................................................................................................................9
4.4.1 Instrument selector.............................................................................................................9
4.4.2 Timeline.............................................................................................................................9
4.4.3 Pattern Editor...................................................................................................................10
4.4.4 Song Player......................................................................................................................12
4.5 Info and Options Tabs..............................................................................................................12
4.5.1 Info Tab............................................................................................................................12
4.5.2 Options Tab......................................................................................................................14
4.5.3 Pitch Guides.....................................................................................................................14
5 For the Coder...................................................................................................................................16
5.1 dasm/MADS............................................................................................................................16
5.2 K65...........................................................................................................................................17
5.3 CSV..........................................................................................................................................18
5.4 Adapting and optimizing the player routine............................................................................18
6 Appendix..........................................................................................................................................19
6.1.1 Licences and Third-party Code........................................................................................19
6.1.2 Acknowledgements..........................................................................................................19
6.1.3 Keyboard Shortcuts..........................................................................................................19
1 Quickstart
To quickly start composing music with TIATracker without reading the whole manual, either load
the example song that comes with the program and play around with it, or follow these basic steps:
1. Adapt the keyboard shortcuts in the file “keymap.cfg” to your keyboard layout and needs.
2. In the Options tab of TIATracker, select a preset pitch guide or create a new one if you
roughly know which notes you will mainly want to use in your song. For the latter, you need
to select the desired notes on the piano keyboard in the create guide dialog and select the
waveforms you want those notes for, then click on the “Create Guide” button.
3. Create or import instruments for your song in the “Instruments” and “Percussion” tabs.
TIATracker supports two types of instruments:
◦ Melodic instruments have a base waveform and an ADSR envelope for setting the
volume and change the frequency at which a note gets played. Depending on the
waveform, different notes are available (shown on the piano keyboard at the bottom of
the window). The duration of a note will be defined in the patterns of your song.
◦ Percussion instruments can set a different waveform, frequency and volume value each
frame. The duration of a percussion sound is determined by the number of frames, as
each frame gets played exactly once. The pitch of a percussion instrument is defined by
its frequency values and cannot be changed in the song.
In both instrument editor tabs, right-click in the envelope area to insert or delete frames. In
the percussion editor, right-click in the waveforms area to select and set a specific
waveform, left-click to set the last selected waveform, or use the mouse wheel to scroll
through all available waveforms. Press a key on the piano keyboard to hear an instrument.
4. The main track editor tab combines a pattern editor and sequencer. Right-click either in
the column with the pattern names or in the timeline (on the right side) to get a pattern
context menu. Use it to create, add, delete and move patterns, set the start patterns or edit
goto commands. Right-click a row in a pattern to get a channel and row/note context menu.
Use it to insert or delete a row and to edit notes/commands in the row.
A row can contain a percussion sound, a melodic instrument note, a hold command (“|”)
which continues to play the last note, a pause/rest command (“-”) which sends a melodic
instrument into release and then ends the note, or a slide command (“SL n”) which changes
the frequency of the currently played melodic instrument note. A pause or slide command is
only valid while a melodic instrument note is playing.
5. The Info tab displays a detailed breakdown on how many resources the song will use when
played on the VCS. Use the “export” menu item to generate .asm or .k65 files for
dasm/MADS or K65 respecively, to include in your VCS source code.
2 Introduction
TIATracker is a new music routine for the Atari VCS and a PC tracker/sequencer application for
composing music for inclusion in VCS games and demos.
This manual targets both musicians and coders. For the impatient, section 1 “Quickstart“ provides a
very brief introduction to get you started. Section 3 “VCS Audio“ explains the basic concepts and
limitations of audio on the VCS from a user’s point of view. Skip this if you know the VCS already.
Section 4 “For the Musician“ explains the concepts behind TIATracker and how to compose music
with it, and 5 “For the Coder“ provides information and instructions to the coder how to integrate
TIATracker music into their projects.
Several features and optimizations that are already planned have not yet made it into the current
version. Contact me for requests, comments and bug reports at [email protected] and watch
https://bitbucket.org/kylearan/tiatracker/ for new versions. Until then, have fun pushing the limits of
VCS music!
3 VCS Audio
The Atari VCS has 2 audio channels. For each channel there are three parameters that can be set to
produce sound:
• Waveform (“Distortion”). There are 11 different waveforms: Silence, white noise, and 9
others. Two of them have the same timbre, but different frequency ranges (see below).
• Frequency. There are only 32 frequencies that each waveform can be played at. These
frequencies unfortunately do not match traditional notes. Instead, many notes are missing
completely, and most of the notes that are available are off-tune to varying degrees. Even
worse, the frequency ranges differ across waveforms. Notes that are available for some
waveforms are missing for others. Frequencies will differ slightly depending on whether the
VCS is a PAL or NTSC machine.
4.1.2 Instruments
There are two fundamentally different types of instruments in TIATracker: Percussion and melodic
instruments. Both types get updated by the player once per frame.
Percussion instruments can set a new value for waveform, frequency and volume each frame.
When a percussion is encountered in a pattern, each frame of the respective percussion instrument
gets played exactly once, or until a new note in the pattern interrupts it and cuts it off. A percussion
instrument cannot be played at a different pitch, since each frame exactly defines which frequency
to use.
Melodic instruments have a base waveform value that stays the same for all its frames, but they can
be played at different frequencies as defined in the patterns to form melodies. To shape each note, a
melodic instrument can set a different volume value each frame and modify the note frequency by a
value between -7 and +7 for arpeggio or tremolo effects.
A melodic instrument’s lifetime is divided into three phases: Attack/Decay, Sustain, and Release.
Together they define frequency and volume ADSR envelopes for this instrument, as depicted in the
following graphics (the small ticks mark frames, the larger ticks the song tempo, in this example
case 5).
When a note starts, all frames of the Attack/Decay phase are played. Afterwards, the Sustain phase
frames are played in a loop. When a pause note is encountered in the pattern, the Release phase
frames are played once and the note ends in silence. If a new note is encountered instead of a pause,
the new note simply cuts off the current instrument without sending it into Release phase.
Since melodic instruments can be used to play different notes, they have a base waveform that
cannot be changed each frame. This is because available frequencies vary across different
waveforms, and thus playing a specific note using one waveform makes no sense for another
waveform where that note might not be available. For the same reason, percussion instruments
cannot be played at different frequencies, as they might set different waveforms each frame.
Frequency values for playing a melodic instrument notes range between 0 and 31, and that
frequency value can be changed in the envelope each frame by +/- 7. Note that this might cause an
underflow or overflow for some notes. In that case, the values simply wrap from low to high
frequencies or vice versa, which might or might not be intended by the musician.
The top picture shows the ideal situation, where the melodic and percussion instruments are played
simultaneously in different channels. The bottom picture shows what happens if the composer plays
them one after the other in the same channel. In this example with a song tempo of 5, you have a
gap of two ticks after the percussion has finished before the next note is played.
TIATracker has the option to mark a percussion instrument as an overlay instrument. When an
overlay percussion instrument has finished playing, the next note will be fetched out of order
regardless of tempo. If it is a note for a melodic instrument, it will be played immediately, skipping
its Attack/Decay phase and starting it right away in the Sustain phase. This is depicted in the
following graphics.
Since percussion instruments are often louder, this can help to create the illusion that both
instruments have been played at the same time but the percussion instrument has drowned out the
first couple of frames from the melodic instrument.
If the row following an overlay percussion instrument is another percussion instrument or a hold
command, it will get processed normally.
Note however that you cannot specify this “overlay” behavior individually per note, only per
percussion instrument. Thus, an overlay percussion instrument will always play the next melodic
note immediately once it has finished.
4.2 Creating Instruments
TIATracker supports up to 7 melodic and up to 15 percussion instruments.
In the melodic instruments editor tab, use the drop-down list in the top left corner to name your
melodic instrument and to switch between the available instruments. The import and export buttons
save and load individual instruments independent from the song, and delete clears the envelope and
name of the currently selected instrument.
You can select the base waveform using the drop-down list in the lower left. Apart from the
physically available waveforms from the VCS hardware, there is also a special convenience
waveform called “Pure Combined (4+12)”. This combines the two so-called “pure” waveforms
(Pure High (4) and Pure Low (12)) which have the same timbre but different note ranges, into one
“virtual” waveform with 64 instead of 32 frequencies. This allows the musician to compose a
melody without having to switch between the two real “pure” waveforms depending on which note
is needed. When the song gets exported and played on the VCS, TIATracker will automatically
generate two different instruments (which share the same envelope) using the two “pure”
waveforms and assigns the notes in the song accordingly. For this reason, the Pure Combined
waveform counts as two instruments.
The structure of the ADSR envelope can be defined using the envelope length, sustain start and
release start controls. Note that a melodic instrument does not need to have an attack/decay phase,
but the sustain and release phases both need to contain at least one frame. In the middle of the
window, the volume and frequency envelopes are graphically displayed, with the sustain phase
highlighted in the background. Left-click in a frame to set a new value, and right-click for a context
menu to insert and delete individual frames.
The peak volume control shows the highest volume value of the whole envelope. Use it to shift all
volumes up and down, to make the instrument as a whole louder or quieter.
Finally, click and hold on a key on the piano keyboard (see section 4.3) to hear how the melodic
instrument sounds.
4.4.2 Timeline
The timeline on the right side of the window depicts the pattern sequences for both channels, with
alternating colors signifying when a new pattern starts. Hover the mouse over a pattern to see its
name in a tooltip, and left-click on a pattern to jump to that position in the pattern editor. A right-
click opens a pattern context menu which can also be accessed by right-clicking in the pattern area
of the pattern editor, as described in the next section.
The blue line marks the current position of the editor cursor. The orange line shows the current
position of the song player.
Editing a pattern
A row in a pattern can either be a percussion instrument, a note for a melodic instrument, a “hold”
command, a “pause” command, or a “slide” command. Use the instrument selector to change the
currently active instrument.
• To enter a note for a melodic instrument, you can use the piano keyboard at the bottom of
the screen. Which notes are available for a given melodic instrument depends on the
selected pitch guide (see section 4.5.3). Alternatively, three octaves are mapped to keyboard
shortcuts (see section 6.1.3). The currently selected octaves are displayed in red on the piano
keyboard, and they can also be changed by using keyboard shortcuts.
If you want to manually enter a note with a specific frequency value not available on the
piano keyboard, use the “Change frequency...” item in the context menu.
If a “???” is displayed, it means that the frequency of that note is outside the range of C1 to
B7. It will be played normally, however.
• To enter a percussion instrument, simply press any key on the piano keyboard or use any
corresponding keyboard shortcut.
• A “Hold” command is displayed as a “|” symbol in the pattern and can be entered with the
corresponding keyboard shortcut. When playing the song, it means that the currently played
note should continue playing. In case of a percussion instrument, this means that it simply
continues to play frame after frame and that it falls silent afterwards. In case of a melodic
instrument, it means that the sustain phase is looped as long as more “Hold” commands are
encountered.
• A “Pause” command is shown as a “=” symbol in the pattern and can be entered with the
corresponding keyboard shortcut. When a melodic instrument is currently played, it will
cause it to play its release phase and fall silent afterwards.
It is not valid to place a “Pause” after a percussion instrument or a “Hold” command
following a percussion instrument. This will throw an error when the player routine of the
tracker arrives at such a row, and will cause undefined behavior in the VCS player routine.
(This is due to size optimizations of the routine.)
Sequencing
The pattern context menu, accessible via right-click either in the area with the pattern names or in
the timelime, is used to create, delete, rename and order patterns in a channel sequence as well as
set start patterns and goto commands. For each channel there is one pattern marked as the start
pattern, which is where replay begins. From there, it will play patterns in the order as they are
displayed in the sequence and the timeline.
A goto command at the end of a pattern forces the player to jump to the specified pattern. That way,
loops can be created. However, the target of a goto command has to be smaller than 128, and for a
goto command in channel 1, the number of patterns in channel 0 are added to the target number as
well. This is due to size optimizaion in the VCS player routine, and on export, the tracker will
display an error if an invalid goto is encountered.
The same pattern can be played several times during a sequence. The “insert pattern” menu item
lets you either insert an existing pattern, or create and insert a new, empty pattern. If you create a
new pattern, a dialog appears where you can specify the name and the length of the new pattern.
The “Align” button automatically sets the length to a value so that the end of the new pattern aligns
itself with the end of the pattern played at the same time in the other channel. This makes it easier to
keep patterns in both channels in sync.
You can also duplicate a pattern. This creates a copy of the current pattern which you can then edit
without changing any occurrences of the original pattern in the sequences.
“Remove pattern” removes the current instance of a pattern from the sequence; the pattern itself can
still be used elsewhere. If you remove the last instance of a pattern from the sequences, TIATracker
will ask if it should delete the pattern definition itself as well, in which case you will no longer be
able to insert it again into the song. Note that when you later export your song to assembly
language, unused patterns will not get exported and will not use up any resources, so you don’t need
to delete unused patterns if you think you might still need that pattern later.
• Goto Pattern: If you use the goto pattern feature in the sequencer. Note that if you do not
use goto, behavior of the VCS replay routine is undefined once the song has finished playing
and the programmer has to make sure nothing bad happens.
• Slide: If you modify the note of a melodic instrument anywhere in the song with the slide
feature.
• Overlay Percussion: If any of the percussion instruments used in the song has the “overlay”
feature checked.
• Funktempo: If the even and odd tempo values are different. Size requirements are
differently depending on the use of No global speed.
• No global speed: If each pattern has its individual tempo values or if only one set of values
is used for the whole song. Size requirements are differently depending on the use of
Funktempo.
• Starts with Hold: If the very first note of the song for both channels (in the start patterns) is
not a melodic or percussion instrument.
Note that the RAM usage currently is the same for all features. In future versions, different player
variants optimized for minimal RAM usage at the cost of size will be introduced.
4.5.2 Options Tab
In the options tab, you can set the TV standard that should be used for song replay. PAL means that
the music gets updated 50 times per second, NTSC 60 times per second. This affects both replay
speed, making NTSC music play slightly faster than PAL music, as well as the tuning. Waveforms
use slightly different frequencies depending on whether they are played on PAL or NTSC systems.
In addition, you can enter the song author’s name, the name of the song and a comment. Author and
song name will get exported to the assembly source as a comment, but will not affect the resulting
VCS binary in any way.
Finally, you can select the pitch guide to use from a list of currently available pitch guides (several
preset and optional user-created ones), export the currently selected pitch guide to disk or import a
previously stored one. The “Off-tune % warning at” control lets you set the percentage value for
how off-tune a note may be before it is displayed in red on the piano keyboard.
The preset pitch guides simply optimize the number of in-tune notes for a given waveform without
preferring certain notes or taking into account if the combinations of notes will be usable to a
musician or not. With TIATracker also come two example pitch guides ready for import that
optimize the number of notes in C major between C-3 and C-6 for the Pure Low and Pure High
waveforms, one for PAL and one for NTSC. Use the pitch guide creator to create different scales for
other waveforms.
• TV Standard: Frequencies for PAL and NTSC machines are slightly different, so select the
TV standard of your target architecture here.
• A4 max deviation from 440 Hz: This value specifies how many half-tones A4 may deviate
from the “real” A4 at 440 Hz. For example, a value of 12 means that the resulting A4 may
be up to one octave lower or higher than standard A4, since one octave consists of 12 half-
tones. Similarly, a value of 6 means A4 could deviate only half an octave at most.
• Note out of tune max %: This percentage value defines how off-tune each note you
requested may be allowed to be. 0% means only notes with exactly the correct frequency
will be allowed, while 100% means a note might deviate up to one half-tone.
The “Create Guide” button computes the optimal frequency for A4 so that for the waveforms you
selected, as many in-tune notes (as defined by the max deviation threshold) as possible become
available. Afterwards, the result is displayed on the piano keyboard. Select the waveform for which
you want to see the available notes in the drop-down list in the lower right to check if you are
satisfied with the results. If not, you can change your selection of waveforms, notes and parameters
and re-create the guide.
Once you are finished, you can name your pitch guide and after clicking the “OK” button, it will be
added to the list of available pitch guides and automatically becomes selected.
If you save your song, the currently used pitch guide will be saved along with it. You can also use
the “Import...” and “Export...” buttons in the options tab to manage pitch guides separately.
Note that pitch guides are a purely visual convenience for the musician and will not affect in any
way how a song will sound. Each note in a song is defined by its VCS frequency value. A pitch
guide will only change the labeling, i.e. which note name will be displayed for a given frequency in
the patterns or on the piano keyboard.
5.1 dasm/MADS
TIATracker can export the current song to assembly in dasm or MADS format for use on the VCS
in two ways, accessible via the File menu. “Export complete player to dasm/MADS...” will write
five different files:
• <filename>_init.asm: This will initialize the player variables so that the song will start at
the beginning. It assumes that all RAM variables have been initialized to 0 during startup. If
that is not the case, or if you want to restart the song at some point during your program, you
have to set some player variables to 0 yourself first (see comments in <filename>_init.asm).
Include this file anywhere in your source before your first call to the player routine.
• <filename>_player.asm: This is the player routine. It has to be executed once per frame to
replay the song, for example during vertical blank or overscan. The routine is static and does
not depend on the song to be played, except for using the compiler flags defined in
<filename>_variables.asm to strip out unneeded parts of the code during compilation.
Include this file in your source where you want to execute it once per frame. Note that it is
not a subroutine. If you want to use JSR to call the player routine, you will have to insert an
RTS instruction manually after the include statement.
The file <filename>_player_framework.asm also serves as an example of how to include and use
all necessary files to add a song to a VCS program.
The menu item “Export track data to dasm/MADS...” only exports the files that directly depend on
the current song: <filename>_variables.asm, <filename>_init.asm and <filename>_trackdata.asm.
This can be used if you have a VCS project that already has the player routine and you only want to
update the song itself.
5.2 K65
Similar to exporting to dasm/MADS format, TIATracker can either export a complete player that
compiles in K65 and plays a song, or only files that directly depend on the current song.
“Export complete player to k65...” will write four different files:
• <filename>_player.k65: This defines the inlined player routine, called “tt_player”. This
routine has to be called once per frame to replay the song, for example during vertical blank
or overscan. The routine is static and does not depend on the song to be played, except for
using the compiler flags defined in <filename>_trackdata.k65 to strip out unneeded parts of
the code during compilation.
It also contains the RAM variables used in the player. Permanent variables need to keep
their state between calls to the player routine, while temporary variables will be overwritten
by the routine but can be used for other purposes in between calls.
Caution: The variable definitions set the first variable of the player routine to be at memory
location 0x80. Adapt this to your needs if necessary.
The file <filename>_player_main.k65 also serves as an example of how to use all necessary files to
add a song to a VCS program.
The menu item “Export track data to k65...” only exports the file that directly depend on the
current song: <filename>_trackdata.k65. This can be used if you have a VCS project that already
has the player routine and you only want to update the song itself.
5.3 CSV
“Export track to csv...” creates a comma-separated values file that contains a high-level description
of the current song. Each row corresponds to a row in TIATracker and contains data about the
instruments or commands for each channel and data about the song position (sequence number,
pattern number and name). This could be imported into a spreadsheet application and annotated
with additional rows for synchronizing demo effects to music events, for example.
Caution: In the current version, the values correspond to the values displayed in the TIATracker PC
application, not to the values used in the exported VCS binary. That is because during export, only
instruments and patterns that are actually used in a song get exported, and thus numbering will be
different.
6.1.2 Acknowledgements
Big thanks to Nikola “juice” Fox for great feedback and lots of advice on TIATracker and how
trackers work in general, and for beta-testing.
Also thanks to Thomas Jentzsch for spending a lot of time with a very early alpha version of
TIATracker and coming back with good questions and suggestions.
Dok Sae was the first one to create a full song with TIATracker, used in the VCS demo “odd” by
Flush, and kindly allowed me to use it as an example song. Many thanks!
Sagamusix was kind enough to answer my newbie questions about tracker keyboard shortcuts and
German vs. international musical scales.