Playhead

Reads the notes of a track in the order they sound, from any tick on, going back at the loop of the track.

Import

import { Playhead } from '@halleyfante/chiptune';

Playing what a playhead reads

Constructor

new Playhead({ track: Track<Settings>, tick: number })
OptionDescription
tickWhere in the track to start reading, counted from its first tick without going back at the loops. A note that was already sounding there is read from that tick on.

Methods

MethodDescription
until(tick: number): Sound<Settings>[]The notes that start before a tick and were not read yet, in the order they start. A track that loops goes back to its loop start each time it reaches its loop end, so the notes before the loop start are read once.
tick: Counted from the first tick of the song without going back at the loops.