class: mPopInstrument
FM instrument capable of soft and harsh tones
Description
Clone of fors Pop Max for Live device. FM sine oscillator with two modulators. Can be configured to a variety of modulation ratio schemes and amounts of modulation/feedback. Inherits all functions from mInstrument parent class and adds the following functionality.
Template Parameters
template <uint16_t mPOLYPHONY = 4>mPOLYPHONY: number of voices the instrument can play simultaneously
Class Methods
Constructor
mPopInstrument(uint8_t *midi_table_name = NULL)midi_table_name: (OPTIONAL) table of MIDI data for the instrument to play.
int32_t next()Calculates a sample of output. Nominally a 16-bit signal level. MUST BE CALLED IN updateAudio()
void setADSR(uint32_t attack_time, uint32_t decay_time, int16_t sustain_level, int32_t release_time)Configures amplitude envelope. Times in milliseconds. Sustain level from silence to unity gain (0 to 255)
void setReleaseTime(uint32_t release_time)Sets release time of amplitude envelope in ms.
void setModAttack(uint32_t attack_time)Sets attack time of modulation oscillators’ amplitude envelope in ms.
void setModDecay(uint32_t decay_time)Sets decay time of modulation oscillators’ amplitude envelope in ms.
void setModSustain(uint16_t sustain_level)Sets sustain level of modulation oscillators’ amplitude envelope (0 to 255).
void setModAmount(float modulation_amount)Sets amount that modulation oscillators will modulate carrier oscillator (0 to 1.0)
void setFeedback(float feedback)Sets how much the modulation oscillators will modulate themselvesself (0 to 1.0)
void setTimbre(float timbre)Sets both mod amount and feedback amount according to the curve used in original Pop M4L device. As timbre is increased, the sound will become brighter and ultimately harsh and noisy. (0 to 1.0)
void setSpectraList(MEAP_pop_spectra_labels)Choose collection of ratios that modulation oscillors will choose from among the following:
- mPOP_WHOLE: integer multiples of fundamental (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
- mPOP_DETUNE: detuned integer multiples of fundamental (1, 1.01, 2, 2.02, 3, 3.03, 4, 4.04, 5, 5.05, 6, 6.06, 7, 7.07, 8, 8.08)
- mPOP_HALVES: integer (and half integer) multiples of fundamental (1, 1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5, 5.5, 6, 6.5, 7, 7.5, 8, 8.5)
- mPOP_ODD: odd harmonics detuned (1, 1.01, 3, 3.03, 5, 5.05, 7, 7.07, 9, 9.09, 11, 11.11, 13, 13.13, 15, 15.15)
- mPOP_EVEN: even harmonics detuned (1, 1.01, 2, 2.02, 4, 4.04, 6, 6.06, 8, 8.08, 10, 10.1, 12, 12.12, 14, 14.14)
- mPOP_MIXED: increasing odd harmonics then decreasing even harmonics (1, 3, 5, 7, 9, 11, 13, 15, 17, 14, 12, 10, 8, 6, 4, 2)
View mPopVoice.h for full documentation
void setSpectra(int32_t index)Chooses ratios of the two modulation oscillators from the list chosen in setSpectraList. (0 to 15)
Low numbers will choose ratios from beginning of list (generally low frequencies resulting in warmer tones) while high numbers will choose ratios from end of list (generally high frequencies resultint in bright, harsh, noisy tones)
The two modulation oscillators will choose adjacent entries in list. For example, if index is 0, the first modulation oscillator will choose index 0 and the second will choose index 1.
Example