#ay-3-8910 #music #command-line-tool #psg #sequencer #audio-devices #sample-rate

app fbd_sequencer_cli

A command-line tool for playing music using PSG or AY-3-8910 sound sources. It supports playing .fbd sequence files and can output directly to audio devices or generate .wav files.

1 unstable release

0.1.0 Jul 1, 2024

#89 in Multimedia

MIT/Apache

17KB
264 lines

FBD Sequencer

Crates.io Documentation Build Status Crates.io License

Overview

This crate implements a sequencer for playing music using PSG or AY-3-8910 sound sources. No actual PSG hardware is required as the PCM is generated and played through software. Currently, it only supports playing .fbd sequence files.

Installation Instructions

Using cargo install

cargo install fbd_sequencer_cli

Download Pre-built Binaries

Pre-built binaries are available on the release page of the repository.

!!! Due to the nature of containing only executable files, they may be falsely detected as a virus, leading to complex operations for download or execution. If possible, it is recommended to use cargo install.

Contents of assets

Filename Description
fbdplay-x86_64-unknown-linux-gnu.zip fbdplay binary for Linux x64
fbdplay-x86_64-pc-windows-msvc.zip fbdplay binary for Windows x64
fpdplay-aarch64-pc-windows-msvc.zip fbdplay binary for Windows arm64
fddplay-aarch64-apple-darwin.zip fbdplay binary for macOS (with Apple silicon)

The fbd_files.zip (Archive of .fbd files) can be found here: fbd_files.zip

How to Use fbdplay

fbdplay is a CLI tool for playing .fbd files. It can output to audio devices and generate .wav files.

The fbd_files can be found in the fbd_files directory of the repository. Alternatively, you can download the fbd_files.zip from the release page.

FBD Music player

Usage: fbdplay [OPTIONS] <INPUT> [OUTPUT]

Arguments:
  <INPUT>   Sets the input .fbd file
  [OUTPUT]  Sets the generated .wav file

Options:
  -p, --psg-crate <PSG_CRATE>      Sets the crate for waveform generation [default: psg] [possible values: psg, psg-lite]
  -c, --clock-rate <CLOCK_RATE>    Sets the clock rate (MHz) (e.g., 2.0, 1.7897725...) [default: 2]
  -s, --sample-rate <SAMPLE_RATE>  Sets the sample rate (Hz) [default: 44100]
  -h, --help                       Print help
  -V, --version                    Print version

Example: Playing a file

fbdplay fbd_files/YS200.fbd

Example: Generating a .wav file

fbdplay fbd_files/YS200.fbd YS200.wav

Example: Specifying a sample rate of 48KHz

fbdplay fbd_files/YS200.fbd -s 48000

About PSG Waveform Generation

To generate PSG waveforms, two crates can be used interchangeably:

The crate to be used can be changed with the -p option in fbdplay. The psg crate is the default as it generates higher quality waveforms compared to the psg-lite crate. psg-lite is lightweight as the name suggests but sacrifices sound quality (though with a sample rate around 44.1KHz, the difference in sound quality is not extreme).

  • The psg crate generates waveforms with clock rate precision internally and then downsamples to the specified sample rate.
  • The psg-lite crate thins out the generated waveforms using the clock rate and sample rate. It does not perform downsampling.

When using it on a PC, there are no disadvantages to using the psg crate, but I made it switchable since I implemented it. (The reason for implementing psg-lite was that I was unaware of the existence of the psg crate and for studying Rust).

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies

~1.5–4.5MB
~70K SLoC