termtab-0.1.0.0: TUI guitar tablature and score editor
Safe HaskellNone
LanguageGHC2021

Termtab.Audio.Playback

Description

Simple, blocking note/beat playback built directly on AudioEngine — no transport control (play/pause/stop), no position tracking, just "turn this on, sleep, turn it off" for as many beats as given. Used where a single synchronous sequence needs to be auditioned (e.g. previewing a track in isolation); full Song playback with pause/resume/seek instead goes through Termtab.Audio.PlaybackThread, which reuses durationToMicroseconds from here for its own timing.

Synopsis

Documentation

durationToMicroseconds :: Duration -> Tempo -> Int Source #

Convert a Duration at a given Tempo (BPM) to microseconds.

A quarter note at 120 BPM = 500,000 µs (0.5 seconds).

playNote :: AudioEngine -> MidiChannel -> Pitch -> Velocity -> Duration -> Tempo -> IO () Source #

Play a single note for the given duration, then turn it off.

playSequence :: AudioEngine -> MidiChannel -> Tempo -> [Beat] -> IO () Source #

Play a sequence of beats on a given channel at a given tempo.