#python #music

bin+lib tja

TJA file parser written in Rust, working in Rust, Python, and WebAssembly

4 releases (2 breaking)

new 0.3.2 Dec 13, 2024
0.2.0 Apr 27, 2024
0.1.1 Apr 21, 2024
0.1.0 Apr 20, 2024

#177 in WebAssembly

Download history 16/week @ 2024-09-23 16/week @ 2024-11-04 1/week @ 2024-11-18 117/week @ 2024-12-09

118 downloads per month
Used in taiko-core

MIT license

165KB
1.5K SLoC

tja-rs

An efficient TJA file parser, written in Rust, that supports Rust, Python, and WebAssembly environments.

It is highly optimized for speed and includes features such as a synthesizer for synthesizing music along with don/ka sound effects from a TJA file.

It's fast! Check out the benchmark.

Building Instructions

Rust

The Rust target requires no additional feature flags.

To build the library, run:

cargo build

To build the CLI tool, run:

cargo build --bin tja

Python

We use maturin to build the Python package. The Python package requires the python feature flag to be enabled.

To build the Python package, run:

maturin develop -F python

WebAssembly

We use wasm-pack to build the WebAssembly package. The WebAssembly package requires the wasm feature flag to be enabled.

To build the WebAssembly package, run:

wasm-pack build --features wasm

Performance Benchmarks

The parser is highly optimized for performance.

It can parse a typical TJA file in under 1 ms in full mode, and in metadata-only mode in under 5 µs.

For detailed benchmarks and comparisons, check out our benchmark report.

To run the benchmark:

cargo bench

Synthesizer

The TJA parser includes a synthesizer binary that can synthesize music along with don/ka sound effects from a TJA file:

cargo run -F audio --bin synthesize <TJA file> <music file> <don sound file> <ka sound file> --course <course> --branch <branch>

Dependencies

~0.7–3MB
~70K SLoC