Skip to content

InstrumentPreset ​

Struct

Source: AudioMusicTypes.h

Description ​

Defines instrument characteristics for playback.

For melodic instruments (duty > 0):

  • defaultOctave: the base octave for notes
  • duty: duty cycle for PULSE wave (e.g., 0.5, 0.125)

For percussion instruments (duty == 0):

  • defaultOctave: drum type selector (1=Kick, 2=Snare, 3+=Hi-HAT)
  • defaultDuration: fixed duration for each hit (0.0 = use note.duration)
  • noisePeriod: LFSR period for noise channel (0 = calc from frequency, >0 = direct period)

Properties ​

NameTypeDescription
nesAccurateboolHito 2 M17. When true, initVoiceFromEvent resets the voice's NES sub-unit fields to the canonical silent state from the nesdev APU_basics @regs array before the note starts, so NES mode always begins from a known point instead of inheriting whatever the previous note left on that slot.
noiseShortModebool@deprecated Use noiseLfsrShort. Will be removed in a future major.
envelopeCurveEnvelopeCurveShape of this note's ADSR decay and release (E1, S2).
noisePeriodModeNoisePeriodModeWhether this note keeps the NOISE period it authored (E3/A1).
pulseDutyModePulseDutyModeWhether this PULSE note keeps the continuous duty generator (E3/A2).

Released under the MIT License.