23#ifndef SBL_COMPONENTS_CV_VOCT_HPP_
24#define SBL_COMPONENTS_CV_VOCT_HPP_
51 return { 39.6f / 65535.0f, 24.0f };
67 uint16_t adc_low,
float note_low,
68 uint16_t adc_high,
float note_high)
70 float s = (note_high - note_low) /
71 static_cast<float>(adc_high - adc_low);
72 float o = note_low - s *
static_cast<float>(adc_low);
92 : cv_(smoothing), cal_(cal) {}
128 uint16_t
raw()
const {
return cv_.
raw(); }
Smoothing
Smoothing presets for CvInput EWMA filter.
@ Light
alpha=1/2, settles in ~4 samples (pitch, fast CV)
float note_to_frequency(float midi_note)
MIDI note to frequency in Hz. A4 = 440 Hz.
float note_to_ratio(float midi_note)
uint32_t note_to_phase_increment(float midi_note, float sample_rate)
Root namespace for all Sound Byte Libs functionality.
Linear calibration parameters for V/Oct conversion.
static constexpr VoctCalibration from_two_point(uint16_t adc_low, float note_low, uint16_t adc_high, float note_high)
Compute calibration from two known points.
float scale
Semitones per ADC unit.
static constexpr VoctCalibration default_3v3()
Default calibration for 0–3.3V input, 1V/Oct, 16-bit ADC.
float offset
MIDI note number at ADC=0.