Audio Helm  1.0
Live audio synthesis, sequencing and sampling for Unity
AudioHelm.Sequencer Class Referenceabstract

A series of notes and velocities on a timeline that can be used to trigger synth or sampler notes. More...

Inheritance diagram for AudioHelm.Sequencer:
AudioHelm.NoteHandler AudioHelm.HelmSequencer AudioHelm.SampleSequencer

Classes

class  BeatEvent
 
class  NoteEvent
 

Public Types

enum  Division { kEighth, kSixteenth, kTriplet, kThirtySecond }
 Possible divisions of the sequencer UI. More...
 

Public Member Functions

delegate void NoteAction (Note note)
 A note event. More...
 
delegate void BeatAction (int index)
 A beat event. More...
 
abstract void AllNotesOff ()
 Triggers note off events for all notes currently on in the instrument. More...
 
abstract void NoteOn (int note, float velocity=1.0f)
 Triggers a note on event for the instrument. More...
 
abstract void NoteOff (int note)
 Triggers a note off event for the instrument. More...
 
void StartScheduled (double dspTime)
 
abstract void StartOnNextCycle ()
 Starts the sequencer on the start next cycle. This is useful if you have multiple synced sequencers and you want to start this one on the next go around. More...
 
void OnBeforeSerialize ()
 
void OnAfterDeserialize ()
 
virtual IntPtr Reference ()
 Reference to the native sequencer instance memory (if any). More...
 
float GetDivisionLength ()
 Gets the length of the division measured in sixteenth notes. More...
 
void NotifyNoteKeyChanged (Note note, int oldKey)
 Notifies the sequencer of a change to the key of one of the notes. More...
 
void NotifyNoteStartChanged (Note note, float oldStart)
 Notifies the sequencer of a change to one of the note start positions. More...
 
void NotifyNoteEndChanged (Note note, float oldEnd)
 Notifies the sequencer of a change to one of the note end positions. More...
 
void RemoveNote (Note note)
 Removes a note from the sequencer. More...
 
bool NoteExistsInRange (int note, float start, float end)
 Check if a note exists within a given range in the sequencer. More...
 
Note GetNoteInRange (int note, float start, float end, Note ignore=null)
 Gets the first note in a given range in the sequencer. More...
 
List< NoteGetAllNoteOnsInRange (float start, float end)
 Get all Note objects that have a note on in the given range in this sequencer. More...
 
List< NoteGetAllNoteOffsInRange (float start, float end)
 Get all Note objects that have a note off in the given range in this sequencer. More...
 
void RemoveNotesInRange (int note, float start, float end)
 Removes all notes that overlap a given range. More...
 
void RemoveNotesContainedInRange (int note, float start, float end, Note ignore=null)
 Removes all notes that are fully contained in a given range. More...
 
void ClampNotesInRange (int note, float start, float end, Note ignore=null)
 Removes all notes that are fully contained and trim notes that partially overlap range by removing the time inside the range. More...
 
Note AddNote (int note, float start, float end, float velocity=1.0f)
 Add a note to the sequencer. More...
 
void ReadMidiFile (Stream midiStream)
 Read a MIDI file's tracks into this sequencer. Currently in Beta. This may not work for all MIDI files or as expected. More...
 
void ReadMidiFile (MidiFile midiFile)
 Read a MIDI file object into this sequencer. Currently in Beta. This may not work for all MIDI files or as expected. More...
 
void Clear ()
 Clear the sequencer of all notes. More...
 
float GetSixteenthTime ()
 Gets the time in seconds of a single sixteenth note in the sequencer. More...
 
double GetSequencerPosition ()
 Gets the current position of the sequencer measured in sixteenth notes. More...
 

Public Attributes

NoteEvent noteOnEvent
 UnityEvent hook for a note on. More...
 
NoteEvent noteOffEvent
 UnityEvent hook for a note off. More...
 
BeatEvent beatEvent
 UnityEvent hook for a beat. Depends on the division setting of the seqeuncer. More...
 
int length = 16
 The length of the sequence measured in sixteenth notes. More...
 
int currentIndex = -1
 The current index position measured in the division of the sequencer. More...
 
NoteRow [] allNotes = new NoteRow[Utils.kMidiSize]
 All notes in the seqeuncer. More...
 
Vector2 scrollPosition = Vector2.zero
 The x/y scroll position of the inspector sequencer piano roll. More...
 
bool autoScroll = false
 Should the inspector window scroll with playback. More...
 
Division division = Division.kSixteenth
 How often a bar or a division is placed in the sequencer inspector view. More...
 
float zoom = 0.3f
 The smallest width to draw a sequencer beat in the inspector More...
 

Protected Member Functions

virtual void OnEnable ()
 
virtual void OnDisable ()
 
void RemoveSortedNoteEvents (Note note)
 
void AddSortedNoteEvents (Note note)
 
void InitNoteRows ()
 
double GetSequencerTime ()
 
void UpdateBeatTime ()
 
void UpdatePosition ()
 Update the position of the sequencer and fire any events that have occurred. More...
 

Protected Attributes

double beatTime = 0.0
 

Events

NoteAction OnNoteOn
 Event hook for a note on event. More...
 
NoteAction OnNoteOff
 Event hook for a note off event. More...
 
BeatAction OnBeat
 Event hook for a beat event. More...
 

Detailed Description

A series of notes and velocities on a timeline that can be used to trigger synth or sampler notes.

Member Enumeration Documentation

◆ Division

Possible divisions of the sequencer UI.

Member Function Documentation

◆ AddNote()

Note AudioHelm.Sequencer.AddNote ( int  note,
float  start,
float  end,
float  velocity = 1.0f 
)

Add a note to the sequencer.

Returns
The Note object added to the seqeuncer.
Parameters
noteThe MIDI note.
startThe start of the note measured in sixteenths.
endThe end of the note measured in sixteenths.
velocityThe velocity of the note (how hard the key is hit).

◆ AllNotesOff()

abstract void AudioHelm.Sequencer.AllNotesOff ( )
pure virtual

Triggers note off events for all notes currently on in the instrument.

Implements AudioHelm.NoteHandler.

Implemented in AudioHelm.HelmSequencer, and AudioHelm.SampleSequencer.

◆ BeatAction()

delegate void AudioHelm.Sequencer.BeatAction ( int  index)

A beat event.

Parameters
indexThe current beat index.

◆ ClampNotesInRange()

void AudioHelm.Sequencer.ClampNotesInRange ( int  note,
float  start,
float  end,
Note  ignore = null 
)

Removes all notes that are fully contained and trim notes that partially overlap range by removing the time inside the range.

Parameters
noteThe MIDI note to match.
startThe start of the range measured in sixteenths.
endThe end of the range measured in sixteenths.

◆ Clear()

void AudioHelm.Sequencer.Clear ( )

Clear the sequencer of all notes.

◆ GetAllNoteOffsInRange()

List<Note> AudioHelm.Sequencer.GetAllNoteOffsInRange ( float  start,
float  end 
)

Get all Note objects that have a note off in the given range in this sequencer.

Returns
A list of all Note objects with note offs in the given range.
Parameters
startThe search start position measured in sixteenths.
endThe search end position measured in sixteenths.

◆ GetAllNoteOnsInRange()

List<Note> AudioHelm.Sequencer.GetAllNoteOnsInRange ( float  start,
float  end 
)

Get all Note objects that have a note on in the given range in this sequencer.

Returns
A list of all Note objects with note ons in the given range.
Parameters
startThe search start position measured in sixteenths.
endThe search end position measured in sixteenths.

◆ GetDivisionLength()

float AudioHelm.Sequencer.GetDivisionLength ( )

Gets the length of the division measured in sixteenth notes.

Returns
The division length measured in sixteenth notes.

◆ GetNoteInRange()

Note AudioHelm.Sequencer.GetNoteInRange ( int  note,
float  start,
float  end,
Note  ignore = null 
)

Gets the first note in a given range in the sequencer.

Returns
The first found note. Returns null if no note was found.
Parameters
noteThe MIDI note to look for.
startThe start of the range measured in sixteenths.
endThe end of the range measured in sixteenths.
ignoreA note to ignore if found.

◆ GetSequencerPosition()

double AudioHelm.Sequencer.GetSequencerPosition ( )

Gets the current position of the sequencer measured in sixteenth notes.

Returns
The current position of the sequencer measured in sixteenth notes.

◆ GetSixteenthTime()

float AudioHelm.Sequencer.GetSixteenthTime ( )

Gets the time in seconds of a single sixteenth note in the sequencer.

Returns
The time in seconds of a sixteenth note.

◆ NoteAction()

delegate void AudioHelm.Sequencer.NoteAction ( Note  note)

A note event.

Parameters
noteThe Note object that triggered the event.

◆ NoteExistsInRange()

bool AudioHelm.Sequencer.NoteExistsInRange ( int  note,
float  start,
float  end 
)

Check if a note exists within a given range in the sequencer.

Returns
true, if a note exists in the range, false otherwise.
Parameters
noteThe MIDI note to check the range in.
startThe start of the range measured in sixteenths.
endThe end of the range measured in sixteenths.

◆ NoteOff()

abstract void AudioHelm.Sequencer.NoteOff ( int  note)
pure virtual

Triggers a note off event for the instrument.

Parameters
noteThe MIDI keyboard note to turn off. [0, 127]

Implements AudioHelm.NoteHandler.

Implemented in AudioHelm.HelmSequencer, and AudioHelm.SampleSequencer.

◆ NoteOn()

abstract void AudioHelm.Sequencer.NoteOn ( int  note,
float  velocity = 1.0f 
)
pure virtual

Triggers a note on event for the instrument.

Parameters
noteThe MIDI keyboard note to play. [0, 127]
velocityHow hard you hit the key. [0.0, 1.0]

Implements AudioHelm.NoteHandler.

Implemented in AudioHelm.HelmSequencer, and AudioHelm.SampleSequencer.

◆ NotifyNoteEndChanged()

void AudioHelm.Sequencer.NotifyNoteEndChanged ( Note  note,
float  oldEnd 
)

Notifies the sequencer of a change to one of the note end positions.

Parameters
noteThe MIDI note that was changed.
oldEndThe previous end position of the note.

◆ NotifyNoteKeyChanged()

void AudioHelm.Sequencer.NotifyNoteKeyChanged ( Note  note,
int  oldKey 
)

Notifies the sequencer of a change to the key of one of the notes.

Parameters
noteThe MIDI note that was changed.
oldKeyThe key the note used to be.

◆ NotifyNoteStartChanged()

void AudioHelm.Sequencer.NotifyNoteStartChanged ( Note  note,
float  oldStart 
)

Notifies the sequencer of a change to one of the note start positions.

Parameters
noteThe MIDI note that was changed.
oldStartThe previous start position of the note.

◆ ReadMidiFile() [1/2]

void AudioHelm.Sequencer.ReadMidiFile ( Stream  midiStream)

Read a MIDI file's tracks into this sequencer. Currently in Beta. This may not work for all MIDI files or as expected.

Parameters
midiStreamThe MIDI file stream.

◆ ReadMidiFile() [2/2]

void AudioHelm.Sequencer.ReadMidiFile ( MidiFile  midiFile)

Read a MIDI file object into this sequencer. Currently in Beta. This may not work for all MIDI files or as expected.

Parameters
midiFileThe MIDI file object.

◆ Reference()

virtual IntPtr AudioHelm.Sequencer.Reference ( )
virtual

Reference to the native sequencer instance memory (if any).

Returns
The reference the native sequencer. IntPtr.Zero if it doesn't exist.

Reimplemented in AudioHelm.HelmSequencer.

◆ RemoveNote()

void AudioHelm.Sequencer.RemoveNote ( Note  note)

Removes a note from the sequencer.

Parameters
noteNote.

◆ RemoveNotesContainedInRange()

void AudioHelm.Sequencer.RemoveNotesContainedInRange ( int  note,
float  start,
float  end,
Note  ignore = null 
)

Removes all notes that are fully contained in a given range.

Parameters
noteThe MIDI note to match.
startThe start of the range measured in sixteenths.
endThe end of the range measured in sixteenths.

◆ RemoveNotesInRange()

void AudioHelm.Sequencer.RemoveNotesInRange ( int  note,
float  start,
float  end 
)

Removes all notes that overlap a given range.

Parameters
noteThe MIDI note to match.
startThe start of the range measured in sixteenths.
endThe end of the range measured in sixteenths.

◆ StartOnNextCycle()

abstract void AudioHelm.Sequencer.StartOnNextCycle ( )
pure virtual

Starts the sequencer on the start next cycle. This is useful if you have multiple synced sequencers and you want to start this one on the next go around.

Implemented in AudioHelm.HelmSequencer, and AudioHelm.SampleSequencer.

◆ UpdatePosition()

void AudioHelm.Sequencer.UpdatePosition ( )
protected

Update the position of the sequencer and fire any events that have occurred.

Member Data Documentation

◆ allNotes

NoteRow [] AudioHelm.Sequencer.allNotes = new NoteRow[Utils.kMidiSize]

All notes in the seqeuncer.

◆ autoScroll

bool AudioHelm.Sequencer.autoScroll = false

Should the inspector window scroll with playback.

◆ beatEvent

BeatEvent AudioHelm.Sequencer.beatEvent

UnityEvent hook for a beat. Depends on the division setting of the seqeuncer.

◆ currentIndex

int AudioHelm.Sequencer.currentIndex = -1

The current index position measured in the division of the sequencer.

◆ division

Division AudioHelm.Sequencer.division = Division.kSixteenth

How often a bar or a division is placed in the sequencer inspector view.

◆ length

int AudioHelm.Sequencer.length = 16

The length of the sequence measured in sixteenth notes.

◆ noteOffEvent

NoteEvent AudioHelm.Sequencer.noteOffEvent

UnityEvent hook for a note off.

◆ noteOnEvent

NoteEvent AudioHelm.Sequencer.noteOnEvent

UnityEvent hook for a note on.

◆ scrollPosition

Vector2 AudioHelm.Sequencer.scrollPosition = Vector2.zero

The x/y scroll position of the inspector sequencer piano roll.

◆ zoom

float AudioHelm.Sequencer.zoom = 0.3f

The smallest width to draw a sequencer beat in the inspector

Event Documentation

◆ OnBeat

BeatAction AudioHelm.Sequencer.OnBeat

Event hook for a beat event.

◆ OnNoteOff

NoteAction AudioHelm.Sequencer.OnNoteOff

Event hook for a note off event.

◆ OnNoteOn

NoteAction AudioHelm.Sequencer.OnNoteOn

Event hook for a note on event.


The documentation for this class was generated from the following file: