Audio sample container for loading and playing back sample data.
Sample holds audio data loaded from files and provides methods for reading the sample data. It's designed to work with SampleOscillator for pitch-shifted playback and supports storing sample metadata like root note and sample rate.
Key Features:
- Load samples from audio files
- Store multi-channel audio data
- Sample rate and root note metadata
- In/out marker support
- Efficient sample reading
The root note is used by SampleOscillator to determine pitch shift amounts when playing the sample at different MIDI notes.
Usage:
if (sample)
{
DBG("Length: " + String(sample->getLength()));
DBG("Root note: " + String(sample->getRootNote()));
DBG("Sample rate: " + String(sample->getSampleRate()));
AudioBuffer<float> buffer(2, 512);
sample->read(buffer, 0);
}
Sample-based oscillator with pitch tracking and looping capabilities.
Definition gin_sampleoscillator.h:54
static std::unique_ptr< Sample > fromFile(const juce::File &f)
- See also
- SampleOscillator