drum

package
v0.0.0-...-e04bdec Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 15, 2015 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

Package drum decodes .splice drum machine files.

Index

Constants

View Source
const (
	Rest = 0
	Beat = 1
)

Rest and Beat are possible values for steps of a track.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pattern

type Pattern struct {
	HWVersion string  // readable string
	Tempo     float32 // beats per minute
	Tracks    []Track // variable number of tracks
}

Pattern represents a drum pattern of a .splice file.

func DecodeFile

func DecodeFile(path string) (*Pattern, error)

DecodeFile decodes the drum machine file found at the given path and returns a parsed pattern.

Valid tracks following a valid header are returned without error.

An error is returned if the file header cannot be read or decoded.

If invalid track or non-track data is encountered decoding terminates and the pattern read so far is returned without error.

func (*Pattern) String

func (p *Pattern) String() string

String returns a multi-line human readable representation of a drum pattern.

type Track

type Track struct {
	ID    int32
	Name  string   // typically an instrument or sound name
	Steps [16]byte // use constants Rest and Beat
}

Track represents a single part or sound of a drum pattern.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL