Topic: ptracker, a 1-bit tracker for the Commodore PET

I think I forgot to post this here, but the stuff I was doing on 1-bit music on the 6502 a while back turned into a fully-fledged 3½-track tracker for it: https://cowlark.com/ptracker/ It's... crunchy. There's only just barely enough CPU for it to work, meaning there isn't even a progress indicator while playing, and I'm pretty sure that it's overrunning at times but luckily you can't tell given the sound quality!

So far I've done covers of Jugi's Onward Ride: https://www.youtube.com/watch?v=iqWJeM2MKt4 (as made famous by the DOPE demo)
...and Darude's Sandstorm: https://www.youtube.com/watch?v=qeUOBw00vq4 (as made famous by... everyone?)

Both were tracked using ptracker itself. (I'll also point out that tracking a piece of music that is essentially a single phrase repeated over and over for three minutes with minor variations has melted my brain.)

It uses the CB2 FIFO on the PET's 6522 to do most of the heavy lifting so I suspect it's doubtful if the engine would port easily to other 6502 systems (unless they also use CB2 for sound; are there any?)...

2 (edited by bushy555 2025-10-21 06:02:09)

Re: ptracker, a 1-bit tracker for the Commodore PET

>...and Darude's Sandstorm

Heck yeah!  Thats brill.

Re: ptracker, a 1-bit tracker for the Commodore PET

Ah yes, I saw this on your site a while back, and completely forgot to congratulate you on this outstanding achievement. This is awesome!

A quick glance at the source suggests that it uses OR-mixing? Also, one comment that caught my eye:

        ; Every 10ms tick, we need to update the envelopes. This is more work than will fit before the next
        ; shift register byte is due, so we split it into sections and handle it once every byte. Hopefully
        ; the user won't notice.

I think you could get away with updating at half that rate, and still have perfectly usable resolution. Just in case you need to find some clock cycles somewhere at some point wink

bushy555 wrote:

>...and Darude's Sandstorm

Heck yeah!  Thats brill.

Haha, I can't help but imagine you rocking out to this in the bushy shed lol

Re: ptracker, a 1-bit tracker for the Commodore PET

Man, thank you for your hard work! So cool that humble PET gets more and more sound software!

website - 1bit music - other music - youtube - bandcamp - patreon - twitter (latest news there)

Re: ptracker, a 1-bit tracker for the Commodore PET

Thinking out loud:

One problem is that the timer doesn't run fast enough to be able to accurately play back high notes, so realistically I get about half of octave 0, octaves 1 and 2, and about half of octave 3 (and a few notes of 4). This is rather limiting.

I've been thinking about an alternative playback system, where I have a set of precomputed 'wavetables' for each note. Playback simply involves indexing into the appropriate wavetable. On the 6502 this can be super cheap:

```
lda note1, x
eor note2, x
eor note3, x
```

Changing notes is done by updating the addresses directly in the instructions. Because this is cheaper and faster, I can do it more often, and therefore increase my sample rate and get better high-pitched notes.

Except, now I need a 'sample' for every possible note. 80 notes at 16 bytes per sample is a bit over 1kB, which is fine. Except... those 16-byte samples won't necessarily contain complete waveforms. So there'll be a glitch every time the sample loops. If my sample loops every 0.01s, that'll produce a 100Hz tone.

Is this an approach anyone else has investigated? Is it at all workable? The downside is that I don't get on-the-fly waveform generation, which means no volume control; but my volume control is pretty bad anyway...