A toolkit for NintendoWare-format sound archives. It can read, play, convert and build the .bcsar sound archives found in 3DS software and the .bfsar archives found in Wii U software.
- Inspect archives, sequences, banks and wave files.
- Render/play sequence, stream and wave sounds.
- Convert sequences to and from MIDI and text MML, banks to and from SoundFont and TOML, and waves to and from WAV.
- Build a new archive from a project file, unpack an archive into a project, or patch sounds of an existing archive.
- Embed (Library) the playback engine in a Rust or C program. Engine core is
no_std.
| Console | Files | Read and write | Play | Build, unpack and patch |
|---|---|---|---|---|
| 3DS | .bcsar, .bcseq, .bcbnk, .bcwar, .bcwav, .bcstm … |
yes | yes | yes |
| Wii U | .bfsar, .bfseq, .bfbnk, .bfwar, .bfwav, .bfstm … |
yes | yes | yes |
| Switch | .bfsar |
no | no | no |
Switch support is planned.
Prebuilt binaries for Windows, macOS and Linux are on the releases page.
To build from source (Rust 1.85 or newer):
cargo install --git https://github.com/finthetechguy/sarkit sarkit-cliOn Linux, audio output needs the ALSA headers (libasound2-dev on Debian/Ubuntu).
Run sarkit help <command> for help with each command.
sarkit info game.bcsar # summary and table sizes
sarkit list game.bcsar # every sound with its kind, file and banks
sarkit tree game.bcsar --sound BGM_TITLE # banks, wave archives and files a sound uses
sarkit extract game.bcsar -o files/ # write each stored file on its own
sarkit disasm game.bcsar BGM_TITLE # print a sequence as text MML
sarkit census roms/ # count sequence commands across a foldersarkit render game.bcsar BGM_TITLE -o title.wav --secs 60
sarkit play game.bcsar BGM_TITLE
sarkit testnote game.bcsar BGM_TITLE 0 60 -o note.wav # one held note: program, keyUse --solo, --tracks or --mute to pick tracks, --quality to set interpolation and voice count, and --seed to fix random commands.
sarkit export game.bcsar BGM_TITLE -o title # title.mid and a matching title.sf2
sarkit compile song.mid -o song.bcseq # MIDI to sequence
sarkit asm song.mml -o song.bcseq # text MML to sequence
sarkit bank piano.bcbnk -o piano.toml # bank to TOML text, and back
sarkit decode jingle.bcwav -o jingle.wav # loop kept in a `smpl` chunk
sarkit encode loop.wav -o loop.bcstm --codec dspsarkit unpack game.bcsar -o project/
sarkit build project/project.toml -o game.bcsar --emit-ids sounds.h
sarkit patch game.bcsar --replace BGM_TITLE=new_title.mid -o patched.bcsarunpackwrites sequences as MML, banks as TOML and audio as WAV, along with MIDI and SoundFont copies.buildreads aproject.tomlmanifest of players, sounds, banks and groups.--emit-idswrites the sound IDs as a C header or Rust file. Seeexamples/projectfor a small project with every kind of sound.patchgives new sources to some sounds or banks and keeps all IDs, names and other bytes as they were. It prints how much each group grows, since games load groups into fixed-size memory;--strict-sizerefuses any growth. Apatch.tomlfile can list many changes at once, and--add NAME@LIKE=FILEadds a sound with the settings of an existing one.import-soundmakerturns a SoundMaker.cspjproject into a manifest.- The same commands work on Wii U
.bfsararchives.unpackwritesplatform = "wiiu"into the manifest, andbuildthen writes a Wii U archive.
Each sub-system has a crate.
| Crate | What it does | no_std |
|---|---|---|
sarkit-format |
Read and write archive, sequence, bank, wave, stream and group files | yes |
sarkit-codec |
PCM, DSP-ADPCM and IMA-ADPCM decode and encode | yes |
sarkit-engine |
Playback engine: sequencer, voices, envelopes, LFO, filters, mixer | yes |
sarkit-convert |
MIDI, MML, SoundFont, TOML and WAV conversion | no |
sarkit-build |
Build, unpack and patch whole archives | no |
sarkit-output |
Play the engine on the default audio device | no |
sarkit-ffi |
C interface to the engine | no |
sarkit-cli |
The CLI sarkit command |
no |
use sarkit_engine::{Engine, EngineConfig};
use sarkit_format::SoundArchive;
let archive = SoundArchive::from_bytes(&std::fs::read("sound.bcsar")?)?;
let (index, _) = archive.sound_by_name("BGM_TITLE").ok_or("no such sound")?;
let mut config = EngineConfig::default();
config.sample_rate = 44_100;
let mut engine = Engine::new(archive, config);
let handle = engine.play(index)?;
// Interleaved stereo, left then right.
let mut buffer = vec![0.0f32; 2 * 1024];
engine.render(&mut buffer);
engine.stop(handle, 500);sarkit-ffi builds a static and a shared library, with the header at crates/ffi/include/sarkit.h. examples/c/render.c loads an archive and renders one sound; cargo xtask c-example builds and runs it.
sarkit is not affiliated with or endorsed by Nintendo. Nintendo, NintendoWare, Nintendo 3DS and Wii U are trademarks of Nintendo.
No Nintendo assets or audio is provived with sarkit, you must dump audio archives from your own games and applications.
MIT.