https://github.com/jacoblincool/tja-rs
TJA file parser written in Rust, working in Rust, Python, and WebAssembly.
https://github.com/jacoblincool/tja-rs
python rust tja webassembly
Last synced: 11 months ago
JSON representation
TJA file parser written in Rust, working in Rust, Python, and WebAssembly.
- Host: GitHub
- URL: https://github.com/jacoblincool/tja-rs
- Owner: JacobLinCool
- License: mit
- Created: 2024-11-30T20:17:39.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-06-05T19:58:13.000Z (about 1 year ago)
- Last Synced: 2025-07-06T03:53:54.372Z (12 months ago)
- Topics: python, rust, tja, webassembly
- Language: Rust
- Homepage: https://jacoblincool.github.io/tja-rs/report/
- Size: 298 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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! (Parse thousands of TJAs in less than 1 second) [Check out the benchmark](https://jacoblincool.github.io/tja-rs/report/).
You can also use different parsing modes (e.g. metadata-only or metadata-and-header mode) to make it even faster.
## Building Instructions
### Rust
The Rust target requires no additional feature flags.
To build the library, run:
```sh
cargo build
```
To build the CLI tool, run:
```sh
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 `.whl`, run:
```sh
maturin build -F python --release
```
To develop and test, run:
```sh
maturin develop -F python
```
> Python virtual environment is necessary. (e.g. `conda`, `micromamba`, `poetry`, `pixi`)
> To navigate variable, please check [tja.pyi](./tja.pyi)
### 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:
```sh
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](https://jacoblincool.github.io/tja-rs/report/).
To run the benchmark:
```sh
cargo bench
```
## Synthesizer
The TJA parser includes a synthesizer binary that can synthesize music along with don/ka sound effects from a TJA file:
```sh
cargo run -F audio --bin synthesize --course --branch
```