Skip to content

rough-rat/abc-note-stream

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

abc-note-stream

abc-note-stream is a tiny no_std parser for the ABC music notation. It reads a static ABC tune definition and produces an iterator of note events that can be consumed by microcontroller audio tasks (PWM, DAC, etc.).

The library was originally extracted from the papajbadge-rs firmware and focuses on very small targets where heap allocations and floating point math are unavailable.

Features

  • no_std compatible API that only depends on core.
  • Parses the tune header (L: and M:) and exposes basic validation errors.
  • Iterates over the body to emit frequency/duration pairs ready for playback.
  • Designed to be extended with additional ornaments, accidentals, or scales as the player evolves.

Example

use abc_note_stream::AbcIter;

static TUNE: &[u8] = br#"
X:1
T:Barka
M:6/8
L:1/8
K:C
C6 | A3 A3- | AAB cBA | G3 G3- | G3 F2 E | F3 F3- | FFG AGF | E3 E3- |
E3 C2 C | A3 A3- | AAB cBA | G3 G3- | G3 F2 E | F3 F3- | FDE FED | C6 |
"#;

let iter = AbcIter::new(TUNE, 320).expect("valid header");
for event in iter {
    // Drive your PWM/DAC here using event.freq and event.duration
}

Status

The parser currently supports a subset of the ABC specification (C major/A minor scale without ornaments).

License

MIT. See LICENSE.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages