fsh::stk
fantastic spatial holophonic synthesis toolkit
Loading...
Searching...
No Matches
fsh::synth::Voice Class Reference

Represents a single voice of a polyphonic synthesizer. More...

#include <Voice.h>

Classes

struct  Params
 Voice parameters. More...
 

Public Member Functions

void setSampleRate (double sampleRate)
 Set the sample rate in Hz.
 
void setParams (const Params &)
 Set the voice's parameters.
 
void noteOn (uint8_t noteVal, uint8_t velocity)
 Start a note with the given note value and velocity.
 
void noteOff (uint8_t noteVal, uint8_t velocity)
 Stop a note with the given note value. (Velocity is ignored for now.)
 
void pitchBend (uint16_t bendVal)
 Set the pitch bend value using MIDI pitchbend data (14 bytes)
 
void render (juce::AudioBuffer< float > &audio, size_t numSamples, size_t bufferOffset)
 Compute the next block of audio samples.
 
auto getNoteVal () const -> uint8_t
 Returns the MIDI value of the currently playing note, or 0 if no note is playing.
 
auto isActive () const -> bool
 Returns true if a note is currently being played.
 
void reset ()
 Reset the voice's state.
 

Detailed Description

Represents a single voice of a polyphonic synthesizer.

Before using:** set the sample rate using setSampleRate() and set the voice's parameters using setParams().

To use:** call noteOn() to start a note, noteOff() to stop a note, and render() to compute the next block of audio samples.

‍This class is loosely based on code from the JX10 synthesizer by Matthijs Hollemans.

Member Function Documentation

◆ render()

void Voice::render ( juce::AudioBuffer< float > & audio,
size_t numSamples,
size_t bufferOffset )

Compute the next block of audio samples.

Parameters
audioaudio buffer to write to
numSamplesnumber of samples to compute
bufferOffsetindex of the first sample in the audio buffer to change

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