ISynthBackend
Declaration
public interface Strawberry.Sound.Midi.ISynthBackend
Abstraction over a MIDI synthesis engine. Two implementations are provided: - -
Implements: System.IDisposable
Properties
SampleRate abstract
Output sample rate in Hz.
int SampleRate { get }
Channels abstract
Number of output audio channels (1 = mono, 2 = stereo).
int Channels { get }
Methods
NoteOn abstract
Start a note on the given channel.
void NoteOn(int channel, int key, float velocity)
Parameters:
| Name | Type | Description |
|---|---|---|
channel |
System.Int32 |
MIDI channel (0-15). |
key |
System.Int32 |
MIDI note number (0-127). |
velocity |
System.Single |
Velocity 0.0-1.0 (normalized from 0-127). |
NoteOff abstract
Release a note on the given channel.
void NoteOff(int channel, int key)
Parameters:
| Name | Type | Description |
|---|---|---|
channel |
System.Int32 |
|
key |
System.Int32 |
NoteOffAll abstract
Release all active notes across all channels.
void NoteOffAll()
ProgramChange abstract
Change the program (instrument) on a channel.
void ProgramChange(int channel, int program)
Parameters:
| Name | Type | Description |
|---|---|---|
channel |
System.Int32 |
|
program |
System.Int32 |
ControlChange abstract
Set a MIDI controller value on a channel.
void ControlChange(int channel, int controller, int value)
Parameters:
| Name | Type | Description |
|---|---|---|
channel |
System.Int32 |
|
controller |
System.Int32 |
|
value |
System.Int32 |
PitchWheel abstract
Set the pitch wheel position on a channel.
void PitchWheel(int channel, int value)
Parameters:
| Name | Type | Description |
|---|---|---|
channel |
System.Int32 |
MIDI channel. |
value |
System.Int32 |
Combined 14-bit value (0-16383, center = 8192). |
Reset abstract
Reset the synthesizer to a clean state: all notes off, all controllers reset to defaults, all programs reset.
void Reset()
RenderShort abstract
Render sampleFrames frames of audio into buffer starting at offset (in shorts, not frames).
int RenderShort(short[] buffer, int offset, int sampleFrames)
Parameters:
| Name | Type | Description |
|---|---|---|
buffer |
System.Int16[] |
Target buffer (interleaved 16-bit PCM). |
offset |
System.Int32 |
Starting index in the buffer (in shorts). |
sampleFrames |
System.Int32 |
Number of sample frames to render. One frame = Channels shorts. |
Returns: Number of sample frames actually rendered.