sequencer

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: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultTempo = 120.0

The Default BPM of the step sequencer

View Source
var InputChannels = 0

The number of portaudio input channels. This value is set to 0 since we're reading from disk.

View Source
var Microsecond = 1000000000

The number of microseconds in a Second.

View Source
var Minute = 60.0

The number of seconds in a Minute as a float.

View Source
var OutputChannels = 2

The number of portaudio output channels.

View Source
var Ppqn = 24.0

Pulses Per Quarter Note. A synchronization primative used in music technology.

View Source
var SampleRate = 44100

The standard audio sampling rate of 44.1kHz (44100)

Functions

func LoadSample

func LoadSample(filename string) ([]float32, error)

LoadSample loads an audio sample from the passed in filename Into memory and returns the buffer. Returns an error if there was one in audio processing.

Types

type Sequencer

type Sequencer struct {
	Timer   *Timer
	Bar     int
	Beat    int
	Pattern *drum.Pattern
	Stream  *portaudio.Stream
}

Sequencer describes the mechanism that Triggers and synchronizses a Pattern for audio playback.

func NewSequencer

func NewSequencer() (*Sequencer, error)

NewSequencer creates and returns a pointer to a New Sequencer. Returns an error if there is one encountered During initializing portaudio, or the default stream

func (*Sequencer) PlayTrigger

func (s *Sequencer) PlayTrigger(index int)

PlayTrigger triggers a playback for any track that is active for the passed in index. Triggers a playback by resetting the playhead for the matching tracks.

func (*Sequencer) ProcessAudio

func (s *Sequencer) ProcessAudio(out []float32)

ProcessAudio is the callback function for the portaudio stream Attached the the current Sequencer. Writes all active Track Samples to the output buffer At the playhead for each track.

func (*Sequencer) Start

func (s *Sequencer) Start()

Start starts the sequencer. Starts counting the Pulses Per Quarter note for the given BPM. Triggers samples based on each 16th note that is triggered.

type Timer

type Timer struct {
	Pulses chan int
	Done   chan bool
	Tempo  float32
}

Timer is a struct that defines the basic synchronization behavior of the step sequencer

func NewTimer

func NewTimer() *Timer

NewTimer creates and returns a new pointer to a Timer.

func (*Timer) SetTempo

func (t *Timer) SetTempo(tempo float32)

SetTempo sets the current Timer's tempo

func (*Timer) Start

func (t *Timer) Start()

Start starts the timer. It sends 24 pulses per quarter note for the current tempo.

Jump to

Keyboard shortcuts

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