Class Voice
- Namespace
- SpessaSharp.Synthesizer.Engine.Voice
- Assembly
- SpessaSharp.dll
Voice represents a single instance of the
SoundFont2 synthesis model.
That is:
A wavetable oscillator (sample)
A volume envelope (volEnv)
A modulation envelope (modEnv)
Generators (generators and modulatedGenerators)
Modulators (modulators)
And MIDI params such as channel, MIDI note, velocity
public sealed class Voice
- Inheritance
-
Voice
- Inherited Members
Constructors
Voice(int, int)
public Voice(int sampleRate, int bufferSize)
Parameters
Fields
Channel
MIDI channel number of the voice.
public MidiChannel? Channel
Field Value
ChorusSend
Chorus send of the voice, used for drum parts, otherwise 1.
public float ChorusSend
Field Value
CurrentPan
From -500 to 500. Used for smoothing.
public int CurrentPan
Field Value
DelaySend
Delay send of the voice, used for drum parts, otherwise 1.
public float DelaySend
Field Value
ExclusiveClass
Exclusive class number for hi-hats etc.
public int ExclusiveClass
Field Value
Filter
Lowpass filter applied to the voice.
public LowpassFilter Filter
Field Value
GainModifier
Linear gain of the voice. Used with Key Modifiers.
public float GainModifier
Field Value
Generators
The unmodulated (copied to) generators of the voice.
public readonly short[] Generators
Field Value
- short[]
HasRendered
Indicates if the voice has rendered at least one buffer. Used for exclusive class to prevent killing voices set on the same note.
public bool HasRendered
Field Value
IsHeld
Indicates if the voice is currently held by the sustain pedal.
public bool IsHeld
Field Value
IsInRelease
Indicates if the voice is in the release phase.
public bool IsInRelease
Field Value
LoopingMode
public Synthesizer.SampleLoopingMode LoopingMode
Field Value
MidiNote
MIDI note number of the voice. Direct number from the Note On message and is used for Note Off and external parameters: MTS and Per note Pitch Wheel.
public int MidiNote
Field Value
ModEnv
Modulation envelope.
public ModulationEnvelope ModEnv
Field Value
ModLFOPhase
public float ModLFOPhase
Field Value
ModLFOStartTime
public float ModLFOStartTime
Field Value
ModulatedGenerators
The generators in real-time, affected by modulators. This is used during rendering.
public readonly short[] ModulatedGenerators
Field Value
- short[]
ModulatorValues
The current values for the respective modulators. If there are more modulators, the array must be resized.
public short[] ModulatorValues
Field Value
- short[]
Modulators
The voice's modulators.
public readonly List<Voice.Modulator> Modulators
Field Value
NoteID
Grouping voices for specific Note On messages. Used for overlapping Note Ons.
public int NoteID
Field Value
OverridePan
From -500 to 500, where zero means disabled (use the channel pan). Used for random pan.
public int OverridePan
Field Value
OverrideReleaseVolEnv
In timecents, where zero means disabled (use the modulatedGenerators table). Used for exclusive notes and killing notes.
public int OverrideReleaseVolEnv
Field Value
PitchOffset
In cents.
public int PitchOffset
Field Value
PortamentoDuration
uration of the linear glide, in seconds.
public float PortamentoDuration
Field Value
PortamentoFromKey
Initial key to glide from, MIDI Note number. If -1, the portamento is OFF.
public int PortamentoFromKey
Field Value
Pressure
The pressure of the voice
public int Pressure
Field Value
Priority
Priority of the voice. Used for stealing.
public int Priority
Field Value
ReleaseStartTime
Start time of the release phase, absolute.
public float ReleaseStartTime
Field Value
ResonanceOffset
Resonance offset, it is affected by the default resonant modulator
public float ResonanceOffset
Field Value
ReverbSend
Reverb send of the voice, used for drum parts, otherwise 1.
public float ReverbSend
Field Value
RootKey
The root key of the voice.
public int RootKey
Field Value
StartTime
Start time of the voice, absolute.
public float StartTime
Field Value
TargetKey
Target key of the voice. This is the effective MIDI note number, used to calculate scale tuning and envelope times, and can be overridden by generators. It is also used
public int TargetKey
Field Value
TuningCents
Current tuning in cents.
public int TuningCents
Field Value
TuningRatio
Current calculated tuning. (as in ratio)
public float TuningRatio
Field Value
Velocity
MIDI Velocity of the voice. This can be overridden by generators and is the effective velocity. MIDI Note On velocity is only used for zone filtering.
public int Velocity
Field Value
VibLFOPhase
public float VibLFOPhase
Field Value
VibLFOStartTime
public float VibLFOStartTime
Field Value
VolEnv
Volume envelope.
public VolumeEnvelope VolEnv
Field Value
WaveTable
The oscillator currently used by this voice.
public WaveTableOscillator WaveTable
Field Value
Methods
ExclusiveRelease(float, float)
Releases the voice as exclusiveClass.
public void ExclusiveRelease(float currentTime, float minExclusiveLength = 0.07)
Parameters
GetModulatedGenerator(Type)
public short GetModulatedGenerator(Generator.Type type)
Parameters
Returns
ReleaseVoice(float, float)
Stops the voice
public void ReleaseVoice(float currentTime, float minNoteLength = 0.03)
Parameters
SetModulatedGenerator(Type, short)
public void SetModulatedGenerator(Generator.Type type, short value)
Parameters
Setup(MidiChannel, float, int, int)
public void Setup(MidiChannel channel, float currentTime, int midiNote, int noteID)
Parameters
channelMidiChannelcurrentTimefloatmidiNoteintnoteIDint