Music#
Notes#
-
namespace YSE
Public API of libYSE — sound playback, mixing, and 3D positional audio.
Entry points:
YSE::System(lifecycle and audio device),YSE::Listener(3D origin),YSE::sound(a playable source),YSE::channel(mixing tree),YSE::reverb(positioned reverb zone),YSE::patcher(modular DSP graph),YSE::player(note sequencer). Sub-namespaces group domain-specific types:YSE::DSPfor signal processing,YSE::MIDIfor MIDI I/O,YSE::MUSICfor note / chord / motif primitives.Note
Apart from their constructors, the oscillator and
vcfclasses must only be invoked from inside a DSP callback /processbody.-
namespace MUSIC#
Music-theory primitives: notes, chords, positioned notes for motifs.
These types feed
YSE::scale,YSE::motif, andYSE::playerto drive generative composition.Functions
-
note operator+(Flt pitch, const note &n)#
Add a note’s pitch to a value.
The result carries the note’s velocity.
-
note operator-(Flt pitch, const note &n)#
Subtract a note’s pitch from a value.
The result carries the note’s velocity.
-
note operator*(Flt pitch, const note &n)#
Multiply a value by a note’s pitch.
The result carries the note’s velocity.
-
class note#
A single musical event — pitch, volume, length, and MIDI channel.
noteis the fundamental unit for the music subsystem: chords are collections of notes, motifs are sequences of pitched notes (pNote), and players generate notes within ascaleconstraint.The arithmetic operators (
+/-/*//) operate onpitchonly;volume,length, andchannelare preserved.See also
See also
See also
Subclassed by YSE::MUSIC::pNote
Public Functions
-
note(Flt pitch = 60.f, Flt volume = 1.f, Flt length = 0.f, Int channel = 1)#
Construct a note.
- Parameters:
pitch – MIDI pitch (60 = middle C).
volume – Velocity in [0.0, 1.0].
length – Duration in seconds. 0 means use the default length.
channel – MIDI channel (1-16).
-
note &set(Flt pitch, Flt volume = 1.f, Flt length = 0.f, Int channel = 1)#
Replace all four fields in one call.
-
Flt getPitch() const#
Current pitch.
-
Flt getVolume() const#
Current velocity.
-
Flt getLength() const#
Current duration.
-
Int getChannel() const#
Current MIDI channel.
-
bool update()#
Advance the note one tick.
Returns
falseonce the note has finished.
-
bool update(Flt delta)#
More precise variant of
updatedriven by an explicit delta.Note
Audio-thread only.
-
Bool operator==(Flt pitch)#
Compare pitch against a value.
-
Bool operator!=(Flt pitch)#
Compare pitch against a value.
-
Bool operator<(Flt pitch)#
Compare pitch against a value.
-
Bool operator>(Flt pitch)#
Compare pitch against a value.
-
Bool operator<=(Flt pitch)#
Compare pitch against a value.
-
Bool operator>=(Flt pitch)#
Compare pitch against a value.
-
note(Flt pitch = 60.f, Flt volume = 1.f, Flt length = 0.f, Int channel = 1)#
-
note operator+(Flt pitch, const note &n)#
-
namespace MUSIC#
-
namespace YSE
Public API of libYSE — sound playback, mixing, and 3D positional audio.
Entry points:
YSE::System(lifecycle and audio device),YSE::Listener(3D origin),YSE::sound(a playable source),YSE::channel(mixing tree),YSE::reverb(positioned reverb zone),YSE::patcher(modular DSP graph),YSE::player(note sequencer). Sub-namespaces group domain-specific types:YSE::DSPfor signal processing,YSE::MIDIfor MIDI I/O,YSE::MUSICfor note / chord / motif primitives.Note
Apart from their constructors, the oscillator and
vcfclasses must only be invoked from inside a DSP callback /processbody.-
namespace MUSIC
Music-theory primitives: notes, chords, positioned notes for motifs.
These types feed
YSE::scale,YSE::motif, andYSE::playerto drive generative composition.-
class pNote : public YSE::MUSIC::note#
A
notewith a time position — the building block of amotif.Where a plain
noterepresents a sound event in isolation,pNotefixes it to a moment in a motif’s timeline. Position is measured from the start of the containing motif, in seconds.Public Functions
-
pNote(Flt position, Flt pitch, Flt volume, Flt length, Int channel = 1)#
Construct a positioned note.
- Parameters:
position – Offset from the start of the motif, in seconds.
pitch – MIDI pitch (60 = middle C).
volume – Velocity in [0.0, 1.0].
length – Duration in seconds.
channel – MIDI channel.
-
Flt getPosition() const#
Current time position.
Private Members
-
Flt position#
-
pNote(Flt position, Flt pitch, Flt volume, Flt length, Int channel = 1)#
-
class pNote : public YSE::MUSIC::note#
-
namespace MUSIC
-
namespace YSE
Public API of libYSE — sound playback, mixing, and 3D positional audio.
Entry points:
YSE::System(lifecycle and audio device),YSE::Listener(3D origin),YSE::sound(a playable source),YSE::channel(mixing tree),YSE::reverb(positioned reverb zone),YSE::patcher(modular DSP graph),YSE::player(note sequencer). Sub-namespaces group domain-specific types:YSE::DSPfor signal processing,YSE::MIDIfor MIDI I/O,YSE::MUSICfor note / chord / motif primitives.Note
Apart from their constructors, the oscillator and
vcfclasses must only be invoked from inside a DSP callback /processbody.-
namespace MUSIC
Music-theory primitives: notes, chords, positioned notes for motifs.
These types feed
YSE::scale,YSE::motif, andYSE::playerto drive generative composition.Functions
-
class chord#
An unordered collection of
noteobjects sounding together.Build a chord additively or pass several notes to the variadic constructor. The arithmetic operators add notes to / remove notes from the chord, and
transposeshifts every note’s pitch by a fixed amount.
-
class chord#
-
namespace MUSIC
Scales#
-
namespace YSE
Public API of libYSE — sound playback, mixing, and 3D positional audio.
Entry points:
YSE::System(lifecycle and audio device),YSE::Listener(3D origin),YSE::sound(a playable source),YSE::channel(mixing tree),YSE::reverb(positioned reverb zone),YSE::patcher(modular DSP graph),YSE::player(note sequencer). Sub-namespaces group domain-specific types:YSE::DSPfor signal processing,YSE::MIDIfor MIDI I/O,YSE::MUSICfor note / chord / motif primitives.Note
Apart from their constructors, the oscillator and
vcfclasses must only be invoked from inside a DSP callback /processbody.
-
namespace YSE
Public API of libYSE — sound playback, mixing, and 3D positional audio.
Entry points:
YSE::System(lifecycle and audio device),YSE::Listener(3D origin),YSE::sound(a playable source),YSE::channel(mixing tree),YSE::reverb(positioned reverb zone),YSE::patcher(modular DSP graph),YSE::player(note sequencer). Sub-namespaces group domain-specific types:YSE::DSPfor signal processing,YSE::MIDIfor MIDI I/O,YSE::MUSICfor note / chord / motif primitives.Note
Apart from their constructors, the oscillator and
vcfclasses must only be invoked from inside a DSP callback /processbody.-
class scale#
A set of allowed pitches.
Drives the
playerso its generated notes stay in key, and constrains the transpositions amotifcan take. Pitches are added with an optional step that controls automatic octave replication.See also
See also
Public Functions
-
scale()#
-
~scale()#
-
scale &add(Flt pitch, Flt step = 12)#
Add a pitch to the scale.
- Parameters:
pitch – The MIDI pitch to add.
step – Octave step.
12(default) replicates the pitch at every octave. Values <= 0 add only the exact pitch.
-
scale &remove(Flt pitch, Flt step = 12)#
Remove a pitch from the scale.
- Parameters:
pitch – The MIDI pitch to remove.
step – Octave step — by default the pitch is removed at every octave.
-
Bool has(Flt pitch)#
Whether
pitchis a member of the scale.
-
Flt getNearest(Flt pitch) const#
Nearest in-scale pitch to
pitch.
-
UInt size() const#
Number of pitches in the scale.
Friends
- friend class player
- friend class motif
-
scale()#
-
class scale#
Motifs#
-
namespace YSE
Public API of libYSE — sound playback, mixing, and 3D positional audio.
Entry points:
YSE::System(lifecycle and audio device),YSE::Listener(3D origin),YSE::sound(a playable source),YSE::channel(mixing tree),YSE::reverb(positioned reverb zone),YSE::patcher(modular DSP graph),YSE::player(note sequencer). Sub-namespaces group domain-specific types:YSE::DSPfor signal processing,YSE::MIDIfor MIDI I/O,YSE::MUSICfor note / chord / motif primitives.Note
Apart from their constructors, the oscillator and
vcfclasses must only be invoked from inside a DSP callback /processbody.
-
namespace YSE
Public API of libYSE — sound playback, mixing, and 3D positional audio.
Entry points:
YSE::System(lifecycle and audio device),YSE::Listener(3D origin),YSE::sound(a playable source),YSE::channel(mixing tree),YSE::reverb(positioned reverb zone),YSE::patcher(modular DSP graph),YSE::player(note sequencer). Sub-namespaces group domain-specific types:YSE::DSPfor signal processing,YSE::MIDIfor MIDI I/O,YSE::MUSICfor note / chord / motif primitives.Note
Apart from their constructors, the oscillator and
vcfclasses must only be invoked from inside a DSP callback /processbody.-
class motif#
A sequence of positioned notes — a re-usable phrase or pattern.
Add notes (with positions) via
add, optionally constrain the starting pitch with ascale, and hand the motif to aplayerwhich will trigger it at appropriate moments.See also
See also
Public Functions
-
motif()#
-
~motif()#
-
motif &setFirstPitch(const scale &validPitches)#
Restrict legal starting pitches.
When a player picks a transposition for this motif it picks one whose starting note belongs to
validPitches.
-
inline Flt getLength()#
Current motif length in seconds.
-
inline Bool empty()#
Whether the motif contains any notes.
-
inline UInt size()#
Number of notes.
Private Functions
-
void sort()#
Friends
- friend class player
-
motif()#
-
class motif#