PeskyTone by Shiru (shiru@mail.ru)



PeskyTone is a very simple sound system to play music and sound effects 
in games for a range of 6502-powered systems. It was first developed for 
the Attack of the PETSCII Robots game by The 8-bit Guy, with Commodore 
PET being the primary target, with VIC-20 and C64 as secondary ones. 
While it didn't make it into the actual game, it was used in the Faulty 
Robots PET-only CB2 music album. As there was more work done than Faulty 
Robots actually shows, and perhaps it may come handy in some cases, I 
decided to make a public release of the complete source code. 



The system supports following targets:

Commodore PET
Commodore VIC-20 (with viznut's hidden waveforms)
Commodore 64
NES



PET is the primary platform that defines the library capabilities a lot. 
All other targets can play the same music data, but they sound much 
simpler compared to PET timbre-wise, and the system does not utilize the 
full potential of the secondary targets at all. That is, C64 target is 
way sub par of any SID tracker you can possibly ever find. This project 
can only work as a reasonable solution for PET games, as it was the main 
target. It is much less useful for any other platform, but it may serve 
as a proof of concept, or a starting point for further developments. 



The code is written for CA65 assembler from the CC65 package. There are
some compile time options. Define these names to enable them:

PT_ALL_VARS_ZP      - if you want to put all PeskyTone vars into ZP,
                      it reduces the code size a lot (all targets)

PT_VIZNUT_WAVEFORMS - to enable the viznut's hidden waveforms for the VIC-20



The system uses a very compact format that implies major limitations to 
the music content. It provides 3 virtual channels, mixed into 1-3 
hardware channels depending on a platform. The lowest note is 55 Hz 
(A-1), defined by the lowest note on the VIC-20 (PET uses IRQs to go 
below 245 Hz). Two of the virtual channels are shifted by an octave, 
like the VIC-20 sound chip does. The note range is three octaves per 
channel, four octave range overall. 

The drum channel octave is the same as the first tone channel, as the 
drums need to have low frequencies. Waveshaping is supported for the PET, 
translated to viznut's waveforms for the VIC-20, and duty cycle on the 
C64. 

There are arpeggio/pitch and waveshape/duty cycle/volume software 
envelopes. The arp/pitch envelope can be switched between two modes as 
it goes, it potentially can be also used to implement tone/noise switch 
and things like this. 

You can use my cross-platform music editor called 1tracker along with 
the supplied peskysound.1te plug-in to create music within these 
limitations. The exported binary music data can be then used in your 
programs. 



Version history

v1.0 04.01.22 - Original release, was actually prepared in the February 2021


mailto:shiru@mail.ru
http://shiru.untergrund.net
https://www.patreon.com/shiru8bit