|
Swadge ESP32-S2
2.0.0
APIs to develop for the Magfest Swadge
|
Tracks the state of a single voice, playing a single note.
A single voice could use multiple oscillators to achieve a particular timbre.
#include <midiPlayer.h>
Data Fields | |
| uq8_24 | curVol |
| The current volume as a fixed-point value. | |
| q8_24 | volRate |
| Rate-of-change of the volume per tick, can be positive or negative. | |
| q8_24 | volAccel |
| Acceleration of the volume per tick, which will be added to the rate. | |
| uint32_t | voiceTick |
| The monotonic tick counter for this voice since starting. | |
| uint32_t | sampleTick |
| The non-monotonic tick counter for playback of sampled timbres. | |
| uint32_t | stateChangeTick |
| The next tick at which state will change. | |
| uq16_16 | pitch |
| The ultimate pitch of this voice after pitch bending, etc. | |
| uint8_t | note |
| The MIDI note number for the sound being played. | |
| uint8_t | velocity |
| The MIDI note velocity of the playing note. | |
| uint8_t | channel |
| The index of the MIDI channel that owns the currently playing note. If 255 or any other value >= 16, this was not played via MIDI. | |
| voiceType_t | type |
| The method for obtaining the next audio sample. | |
| union { | |
| struct { | |
| const uint8_t * | data |
| The raw sample data. | |
| uint32_t | length |
| The number of samples in the data. | |
| uint32_t | rate |
| The number of samples per second of raw sample data. | |
| uint32_t | loopStart |
| The sample number to return to after reaching the loop end. | |
| uint32_t | loopEnd |
| The sample number after which to return to the loop start. | |
| uq16_16 | baseNote |
| The sample's base frequency. | |
| int8_t | tune |
| The sample's fine tuning. | |
| uq24_8 | error |
| The number of fractional samples remaining. | |
| uint32_t | loopsRemaining |
| The number of loops remaining before the voice will transition to the released state. | |
| uq24_8 | sampleRateRatio |
| The pre-calculated samples-per-second. | |
| } | sample |
| struct { | |
| waveFunc_t | func |
| synthOscillator_t | oscillator |
| } | wave |
| struct { | |
| percussionFunc_t | func |
| uint32_t | scratch [4] |
| } | playFunc |
| }; | |
| envelope_t | envelope |
| The envelope defined for this voice. | |
| uq8_24 curVol |
The current volume as a fixed-point value.
| q8_24 volRate |
Rate-of-change of the volume per tick, can be positive or negative.
| q8_24 volAccel |
Acceleration of the volume per tick, which will be added to the rate.
| uint32_t voiceTick |
The monotonic tick counter for this voice since starting.
| uint32_t sampleTick |
The non-monotonic tick counter for playback of sampled timbres.
| uint32_t stateChangeTick |
The next tick at which state will change.
| uq16_16 pitch |
The ultimate pitch of this voice after pitch bending, etc.
| uint8_t note |
The MIDI note number for the sound being played.
| uint8_t velocity |
The MIDI note velocity of the playing note.
| uint8_t channel |
The index of the MIDI channel that owns the currently playing note. If 255 or any other value >= 16, this was not played via MIDI.
| voiceType_t type |
The method for obtaining the next audio sample.
| union { ... } |
| envelope_t envelope |
The envelope defined for this voice.