Documentation ¶
Overview ¶
Package drum implements the decoding of .splice drum machine files. See golang-challenge.com/go-challenge1/ for more information
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotSplice = errors.New("decode: not a SPLICE file")
ErrNotSplice indicates that a decoded file is not in a valid SPLICE format.
Functions ¶
This section is empty.
Types ¶
type Pattern ¶
type Pattern struct { Version []byte // The hardware version. Tempo float64 // The drum kit tempo as BPM. Tracks []Track // The tracks that make up the pattern. }
Pattern represents the drum pattern contained in a .splice file.
func Decode ¶
Decode reads a Splice drum machine file from r. It returns a pointer to a drum kit pattern as a Pattern and an error, if any.
func DecodeFile ¶
DecodeFile decodes the Splice drum machine file found at the provided path. It returns a pointer to a drum kit pattern as a Pattern and an error, if any.
type QuarterNote ¶
type QuarterNote [4]byte
QuarterNote represents 4 sixteenth notes as a byte with a value of 1 or 0
func (QuarterNote) String ¶
func (n QuarterNote) String() string
String returns a representation of the QuarterNote as it should appear in a drum kit measure. The sixteenth note steps are marked with 'x'. Empty steps are marked with '-'.
type Track ¶
type Track struct { ID uint32 Name []byte // Instrument name Measure [4]QuarterNote // 4 quarter notes, 16 sixteenth notes }
Track represents a drum kit track with an ID, instrument name, and a measure of 4 quarter notes.