#music #psg #audio #sequencer #ay-3-8910 #source

no-std fbd_sequencer

A sequencer for playing music using PSG or AY-3-8910 sound sources. Supports playing .fbd sequence files.

4 releases

new 0.2.2 Sep 3, 2024
0.2.1 Aug 13, 2024
0.2.0 Jul 1, 2024
0.1.0 Jun 16, 2024

#86 in Multimedia

Download history 175/week @ 2024-06-14 22/week @ 2024-06-21 209/week @ 2024-06-28 13/week @ 2024-07-05 1/week @ 2024-07-19 3/week @ 2024-07-26 106/week @ 2024-08-09 18/week @ 2024-08-16 107/week @ 2024-08-30

231 downloads per month
Used in fbd_sequencer_cli

MIT/Apache

50KB
947 lines

FBD Sequencer Library

Crates.io Documentation Build Status Crates.io License

Overview

This crate implements a sequencer (.fbd) for playing music using PSG or AY-3-8910 sound sources. This library itself does not generate PSG waveforms. The generation of PSG waveforms is delegated to external implementations that implement the PsgTrait.

The Web Application using the crate is fbdplay_wasm, and the CUI Application is fbd_sequencer_cli.

About .fbd Files

Sequence files are binary files with the .fbd extension. They are designed for PSG sound sources and have three independent channels. The term "FBD" does not have any particular meaning.

Several .fbd files mimicking game music using PSG sound chips are available in the repository. All of them are designed to resemble game music that uses the PSG sound chip on a PC (MSX).

Copyright of the music: © Nihon Falcom Corporation.

Currently, there are no tools available to create .fbd files from scratch. We are considering developing tools to convert from formats like MML.

Features

  • Software envelope (AL, AR, DR, SR, SL, RR)
  • Software LFO (vibrato)
  • Noise period setting
  • Output mode setting (tone, noise, tone & noise)
  • Tone period offset (also known as detune)
  • Nested loops
  • Tie and slur
  • Fine control in 1/60 second units

PsgTrait

This library generates PSG waveforms through the following trait.

#[derive(PartialEq)]
pub enum OutputMode {
    None,
    Tone,
    Noise,
    ToneNoise,
}

pub trait PsgTrait {
    fn sample_rate(&self) -> u32;
    fn clock_rate(&self) -> u32;
    fn set_tone_period(&mut self, channel: usize, period: u16);
    fn set_volume(&mut self, channel: usize, volume: u8);
    fn set_output_mode(&mut self, channel: usize, mode: OutputMode);
    fn set_noise_period(&mut self, period: u8);
    fn next_sample_i16(&mut self) -> i16;
    #[cfg(feature = "float")]
    fn next_sample_f32(&mut self) -> f32;
}

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

~215KB