Skip to content

jturcotte/chiptrack

Repository files navigation

Chiptrack

A programmable cross-platform sequencer for the Game Boy Advance sound chip.

image

Try the Web Player

Install using Cargo

# On Linux you might need WAMR and CPAL local dependencies, for example on Ubuntu:
# sudo apt install build-essential cmake pkg-config libasound2-dev libxft-dev

cargo install --git https://github.com/jturcotte/chiptrack

Features

Runs natively on the Game Boy Advance

image

The built-in sound chip is used for sound production in this case. The desktop and Web versions will produce the sound in software by emulating sound register commands.

Slint models are used as cross-platform abstraction, read from a custom renderer to take advantage of the GBA's hardware acceleration.

Instruments are programmable

pub fn press(freq: u32, note: u8, param0: i8, param1: i8) callconv(.C) void {
    _ = note; _ = param0; _ = param1;
    gba.EnvDutyLen
        .withDuty(gba.dut_1_8)
        .withEnvStart(10)
        .writeTo(gba.square1);
    gba.CtrlFreq.init()
        .withTrigger(1)
        .withSquareFreq(freq)
        .writeTo(gba.square1);
}

Each song carries a little WebAssembly program that converts sequenced notes to Game Boy Advance sound commands. This gives almost complete control over the sound chip to each song.

Default instruments are provided for empty projects and can be customized.

Songs can be distributed and played from GitHub gists

## Pattern 16

| S1 | T2 | W2 | N1 | N2 | N3 |
|----|----|----|----|----|----|
|A-4 |A-2 |B-3 | -  |C-2.| -  |
| -  | -  | -  | -  | -  | -  |
|A-4 | -  |C#4 |C-2.| -  | -  |
| -  | -  | -  | -  | -  | -  |
|A-4 |A-2 |E-4 |C-2.| -  | -  |
...

Songs are saved as Markdown and are human-readable and can be discovered by searching by using GitHub's search: https://gist.github.com/search?q=%23chiptrack

Basic MIDI support in the desktop version

An external MIDI keyboard can be used to play or record notes.

Key / Button Mapping

Function Desktop Game Boy Advance
Move cursor ||| |||
Switch panel (Patterns, Steps, Instruments) Shift + (|) R + (|)
Select previous/next song pattern B + (/) B + (/)
Select previous/next pattern non-empty instruments Z + (/) B + (/)
Cycle the selected pattern/note/param value X + (|) A + (|)
Copy X A
Cut Z + X B + A
Paste (on empty slot) X A
Play song Enter Start
Play pattern Ctrl + Enter Select + Start
Reset sound channels Esc Select
Save Ctrl + S L + Start
Export song to GBA save file Ctrl + G N/A
Toggle recording mode . N/A
Black notes W|E|T|YU N/A
White notes A|S|D|F|G|H|J|K N/A
Erase step (or hold during playback) Backspace N/A

Song Patterns Panel

Function Desktop Game Boy Advance
Cycle pattern X + (|) A + (|)
Duplicate pattern Shift + (Z, X) R + (B, A)
Copy X A
Cut (only on the last non-empty slot ) Z + X B + A
Paste (only on the placeholder slot) X A
Insert an empty pattern instead of pasting X, X A, A

Pattern Steps Panel

Function Desktop Game Boy Advance
Cycle note/param X + (|) A + (|)
Cycle note/param (large amount) X + (|) A + (|)
Enter selection mode Shift + Z R + B
Select all rows (in selection) Shift + Z R + B
Copy (in selection) Z B
Cut (in or not in selection) Z + X B + A
Cancel selection Shift R
Paste selection clipboard Shift + X R + A
Paste edit clipboard (on empty slot) X A

Notes:

  • B + A means that B must be held first*
  • The selection clipboard is set when copy/cutting in selection mode
  • The edit clipboard is set after a note/param cycle (also if unchanged)
  • Cutting when not in selection mode sets both the selection and edit clipboards

Based on the awesome work of

License

The source code is available under the terms of the MIT license (See LICENSE-MIT for details).

However, because of the use of GPL dependencies, Chiptrack compiled binaries are licensed under the terms of the GPLv3 (See LICENSE-GPL).

"Game Boy Advance" is registered trademark of Nintendo