15 #include "mozzi_midi.h"
16 #include "mozzi_fixmath.h"
21 template <
unsigned int CONTROL_UPDATE_RATE>
30 MICROS_PER_CONTROL_STEP(1000000/CONTROL_UPDATE_RATE)
40 control_steps_per_portamento = convertMsecToControlSteps(milliseconds);
49 aPortamentoLine.set(target_freq, control_steps_per_portamento);
50 countdown = control_steps_per_portamento;
60 aPortamentoLine.set(target_freq, control_steps_per_portamento);
61 countdown = control_steps_per_portamento;
73 if (portamento_on==
true){
76 aPortamentoLine.set(target_freq, target_freq, control_steps_per_portamento);
80 return aPortamentoLine.next();
86 int control_steps_per_portamento;
89 const unsigned int MICROS_PER_CONTROL_STEP;
95 static const unsigned int convertMsecToControlSteps(
unsigned int msec){
96 return (uint16_t) (((uint32_t)msec*CONTROL_UPDATE_RATE)>>10);
A simple portamento (pitch slide from one note to the next) effect, useful for note-based application...
void start(uint8_t note)
Call this at note-on, it initialises the portamento.
Q16n16 next()
Use this in updateControl() to provide a frequency to the oscillator it's controlling.
void setTime(unsigned int milliseconds)
Set how long it will take to slide from note to note, in milliseconds.
void start(Q16n16 note)
Call this at note-on, it initialises the portamento.
Q16n16 Q8n0_to_Q16n16(Q8n0 a)
Convert Q8n0 uint8_t to Q16n16 fix.
uint32_t Q16n16
unsigned fractional number using 16 integer bits and 16 fractional bits, represents 0 to 65535....
Q16n16 Q16n16_mtof(Q16n16 midival_fractional)
Converts midi note number to frequency with speed and accuracy.