sequencer

package
v0.0.0-...-a4aebfb Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: BSD-3-Clause, MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AtomEvent

type AtomEvent struct {
	TrackNo  int
	Pos      uint8       // in 32th
	Duration uint8       // in 32th for noteOn messages, it is the length of the note, for all other messages, it is 0
	Message  smf.Message // may only be channel messages or sysex messages. no noteon velocity 0, or noteoff messages, this is expressed via Duration
	// contains filtered or unexported fields
}

func (*AtomEvent) AbsTicks

func (e *AtomEvent) AbsTicks(b *Bar, ticks smf.MetricTicks) (start, end int64)

func (AtomEvent) Inspect

func (e AtomEvent) Inspect() string

func (*AtomEvent) Position

func (ev *AtomEvent) Position() uint8

func (*AtomEvent) TrackEvents

func (ev *AtomEvent) TrackEvents(b *Bar, ticks smf.MetricTicks) (evts smf.TrackEvents)

type Bar

type Bar struct {
	Number   uint
	TimeSig  [2]uint8
	Events   Events
	Key      *smf.Key // TODO a key change, if != nil
	AbsTicks int64
}

func (*Bar) AddEvent

func (b *Bar) AddEvent(ev Event)

func (Bar) Len

func (b Bar) Len() uint8

func (*Bar) SortEvents

func (b *Bar) SortEvents()

func (*Bar) TrackEvents

func (b *Bar) TrackEvents(ticks smf.MetricTicks) (evts smf.TrackEvents)

type Bars

type Bars []*Bar

func (Bars) Len

func (b Bars) Len() int

func (Bars) Less

func (br Bars) Less(a, b int) bool

func (Bars) Renumber

func (br Bars) Renumber()

func (Bars) Swap

func (br Bars) Swap(a, b int)

type EmptyEvent

type EmptyEvent uint8

func (EmptyEvent) Inspect

func (e EmptyEvent) Inspect() string

func (EmptyEvent) Position

func (ev EmptyEvent) Position() uint8

func (EmptyEvent) TrackEvents

func (ev EmptyEvent) TrackEvents(b *Bar, ticks smf.MetricTicks) (evts smf.TrackEvents)

type Event

type Event interface {
	Position() uint8
	TrackEvents(b *Bar, ticks smf.MetricTicks) (evts smf.TrackEvents)
	Inspect() string
}

type Events

type Events []Event

func (Events) Len

func (e Events) Len() int

func (Events) Less

func (e Events) Less(a, b int) bool

warning: only works within a bar

func (Events) Swap

func (e Events) Swap(a, b int)

type MultiEvent

type MultiEvent []*AtomEvent

MultiEvent are multiple AtomEvents at the same time

func (MultiEvent) Inspect

func (mev MultiEvent) Inspect() string

func (MultiEvent) Len

func (e MultiEvent) Len() int

func (MultiEvent) Less

func (e MultiEvent) Less(a, b int) bool

warning: only works within a bar

func (MultiEvent) Position

func (mev MultiEvent) Position() uint8

func (MultiEvent) Swap

func (e MultiEvent) Swap(a, b int)

func (MultiEvent) TrackEvents

func (mev MultiEvent) TrackEvents(b *Bar, ticks smf.MetricTicks) (evts smf.TrackEvents)

TODO: test

type NTupleEvent

type NTupleEvent struct {
	Duration uint8
	// contains filtered or unexported fields
}

NTupleEvent are AtomEvents spread evenly over the time

func (*NTupleEvent) Inspect

func (ntev *NTupleEvent) Inspect() string

func (*NTupleEvent) Len

func (e *NTupleEvent) Len() int

func (*NTupleEvent) Less

func (e *NTupleEvent) Less(a, b int) bool

warning: only works within a bar

func (*NTupleEvent) Position

func (ntev *NTupleEvent) Position() uint8

func (*NTupleEvent) Swap

func (e *NTupleEvent) Swap(a, b int)

func (*NTupleEvent) TrackEvents

func (ntev *NTupleEvent) TrackEvents(b *Bar, ticks smf.MetricTicks) (evts smf.TrackEvents)

TODO: test

type Song

type Song struct {
	Title      string
	Composer   string
	TrackNames []string
	Ticks      smf.MetricTicks
	// contains filtered or unexported fields
}

func FromSMF

func FromSMF(sm smf.SMF) *Song

func New

func New() *Song

func (*Song) AddBar

func (s *Song) AddBar(b Bar)

func (*Song) Bars

func (s *Song) Bars() Bars

func (*Song) FindBar

func (s *Song) FindBar(absTicks int64) (found *Bar)

func (*Song) SetBarAbsTicks

func (s *Song) SetBarAbsTicks()

func (*Song) ToSMF0

func (s *Song) ToSMF0() smf.SMF

func (Song) ToSMF1

func (s Song) ToSMF1() smf.SMF

Jump to

Keyboard shortcuts

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