MEAP The Library

MOZZI
MEAP The Class
C++ tips
Mozzi Reworks
mOscil
mSample
Generators
mDust
mNoise
mOperator
mSineLFO
mEnvSection
Effects
mBitcrusher
mChorus
mDigitalDelay
mFlanger
mPlateReverb
mSchroederReverb
DSP
mDelayLine
mFeedbackComb
mFeedforwardComb
mFIR
mIIR
mNaturalComb
mOnePoleLPF
mResonz
mRingz
mSchroederAllpass
mInstruments
mDrumRack
mFM4Instrument
mMarimbaInstrument
mPopInstrument
mRompler
mStringInstrument
mStringSynthInstrument
Composition
mMML
mTransitionTable
Utilities
mEventDelayMicros
mRandomDistribution

class: mSample


an improved version of MOZZI’s Sample class

Description

A copy of MOZZI’s Sample class with a few improvements as follows:

Aside from these changes, mSample class functions exactly as MOZZI’s Sample class so full documentation can be found on their website

Template Parameters

template <uint64_t NUM_TABLE_CELLS, uint32_t UPDATE_RATE, class T = int8_t, uint8_t INTERP = mINTERP_NONE>

NUM_TABLE_CELLS: length of sample

UPDATE_RATE: how often .next() will be called (likely AUDIO_RATE or CONTROL_RATE)

T: data type used in sample (likely int8_t or int16_t)

INTERP: interpolation type used in playback (mINTERP_NONE or mINTERP_LINEAR)

Class Methods

void setReverseOn()

Enables reverse mode: sample will play backwards


void setReverseOff()

Disables reverse mode: sample will play forwards


void setSpeed(float speed)

Sets the playback speed of the sample (it is recommended to use this over setFreq because it is more intuitive). For example a speed of 1 plays back the sample at the same rate it was recorded, 2 will play it back at double speed (which also has the effect of pitching it up an octave), 0.5 will play it back at half speed (which also has the effect of pitching it down an octave)