#music #gameboy #chiptune

lsdj

Library for interfacing with LSDJ files and memory

1 unstable release

0.1.0 Apr 29, 2022

#1305 in Encoding


Used in lsdj-tools

MIT/Apache

59KB
1K SLoC

LSDJ

LittleSoundDj, or LSDJ for short, is popular music tracker software for the original Nintendo Game Boy. While the handheld console originally was released in 1989, (chiptune) musicians still use its hardware to create and perform electronic music nowadays.

While LSDJ has a built-in filesystem for managing tracks, you need tools to get out the individual files for back-ups or constructing new save files from exported tracks. This crate provides a library for manipulating LSDJ save files/SRAM, in combination with a command-line utility crate for managing your songs. It was inspired by my work on liblsdj, an equivalent library in C.

The developer behind LSDJ has also made LSDPatcher, a GUI package for managing your songs.

Example

use lsdj::{
    sram::SRam,
    fs::{Index, File}
};

// Load a save file from disk
let sram = SRam::from_path("bangers.sav").expect("Could not load SRAM");

// Access one of the files
if let Some(file) = sram.filesystem.file(Index::new(0)) {
    // Convert the file to an .lsdsng (common song format)
    let lsdsng = file.lsdsng().expect("Could not convert file to LsdSng");

    // Store the song on disk
    lsdsng.to_path("put_yo_hands_up.lsdsng").expect("Could not save LsdSng");
}

Features

The crate currently supports the following functionality:

  • SRAM serialization and deserialization
  • Filesystem manipulation (querying, inserting and removing files)
  • LsdSng serialization and deserialization
  • Full implementation of the compression algorithm (verified with tests)

Wishlist

These are features I'm interested in exploring/adding at a certain point:

  • SongMemory parsing into song structures per format version. (This would allow manipulating songs.)
  • .lsdprj support
  • ROM handling, mainly for sample manipulation

Support

If you like this crate and want to support me somehow, consider buying some of my music.

Dependencies

~2.7–4.5MB
~107K SLoC