View on GitHub

ym2151-tone-editor

ym2151-tone-editor

ym2151-tone-editor

Japanese English

YM2151 (OPM) FM synthesizer 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

Will be written in the future. If Rust is installed on Windows, you can easily install it from GitHub.

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

Or, 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 server installation, startup, and readiness checks automatically.

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

Operating Modes

The editor operates in two modes:

Interactive Mode (Default)

In interactive mode, the server continuously streams audio and only sends register write commands when parameters are changed. 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 Full JSON Register Writes Only
Efficiency Low (sends all data every time) High (sends only changed parts)
Audio Continuity Restarts on parameter change Continuous streaming
Usage For comparison/verification For normal editing work

How to Use

Note: Subject to breaking changes in the future. This is for verification purposes.

Key Action
Cursor Movement  
Arrow keys (←↓↑→) Move cursor in the respective direction
Value Modification  
PageUp / e Increase value at cursor position
PageDown / q Decrease value at 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 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, What Not to Aim For

Considering Tone Save Format

Considering Keybinds