View on GitHub

ym2151-tone-editor

ym2151-tone-editor

ym2151-tone-editor

Japanese English

YM2151 (OPM) FM sound source tone editor. For Windows. TUI. Written in Rust.

Status

Currently under development. Current progress is 80%. The remaining 20% involves adding keybinds and tone management.

Features

Quick Start Guide

If Rust is installed on Windows, you can easily install it from GitHub:

cargo install --force --git https://github.com/cat2151/ym2151-tone-editor/

How to use the random tone function library

https://cat2151.github.io/ym2151-tone-editor/demo-library/

Tips

YM2151 Tone Data Format

Parameters

Parameter Name Range Description
DT Detune 0-7 Fine frequency detuning (3 bits)
MUL Multiplier 0-15 Frequency multiplier (4 bits)
TL Total Level 0-99 Operator output level (7 bits, limited to 99)
KS Key Scale 0-3 Key scaling (2 bits)
AR Attack Rate 0-31 Envelope attack rate (5 bits)
D1R Decay 1 Rate 0-31 First decay rate (5 bits)
D1L Decay 1 Level 0-15 Sustain level (4 bits)
D2R Decay 2 Rate 0-15 Second decay/sustain rate (4 bits)
RR Release Rate 0-15 Envelope release rate (4 bits)
DT2 Detune 2 0-3 Coarse frequency detuning (2 bits)
AMS AM Sensitivity 0-3 Amplitude modulation sensitivity (2 bits)

Requirements

Build

cargo build --release

Run

cargo run

Alternatively, run the compiled binary directly:

./target/release/ym2151-tone-editor

Real-time Audio Feedback (Windows Only)

The editor automatically ensures the server is ready using the ensure_server_ready() function from the ym2151-log-play-server library. This handles the server installation, startup, and readiness check automatically.

# Just run the tone editor - the server will be automatically set up and started
cargo run

Operating Modes

The editor operates in two modes:

Interactive Mode (Default)

In interactive mode, the server continuously streams audio, and only register write commands are sent when parameters change. This provides more efficient and smoother audio feedback.

Legacy Mode

By default, the editor sends complete tone data in JSON format via a named pipe using send_json. Each time a parameter is changed, the entire new JSON is sent.

Comparison

Feature Legacy Mode Interactive Mode
Data Transmission Complete JSON Register writes only
Efficiency Low (sends all data every time) High (sends only changes)
Audio Continuity Restarts on parameter change Continuous streaming
Use Case For comparison/verification Normal editing workflow

How to Operate

Subject to breaking changes in the future. For verification purposes.

Key Action
Cursor Movement  
Arrow keys (←↓↑→) Move cursor in the respective direction
Value Change  
PageUp / e Increase the value at the cursor position
PageDown / q Decrease the value at the cursor position
+ / . Increase value by 1
- / , Decrease value by 1
Shift + . (>) Increase value by 10
Shift + , (<) Decrease value by 10
Home Set to maximum value for the current parameter
End Set to minimum value (0)
r / R Set to random value (within valid range)
Mouse  
Mouse wheel up Move cursor to mouse pointer position and increase value
Mouse wheel down Move cursor to mouse pointer position and decrease value
Other  
ESC Save and exit application

Command Line Options

Option Description
--value-by-mouse-move Enable legacy mouse behavior (change value at cursor position by moving mouse left/right)

Dependencies

Concept

Out of Scope, Not Aiming For

Considering Tone Storage Format

Considering Keybinds