Mozzi  version v2.0
sound synthesis library for Arduino
MidiToFreqPrivate Class Reference

Internal. More...

#include <mozzi_midi.h>

Detailed Description

Internal.

Do not use in your sketches.

Internal helper class. Not intended for use in your sketches, and details may change without notic.

Definition at line 23 of file mozzi_midi.h.

Friends

int mtof (uint8_t)
 A good choice if you're using whole note values, want speed and simplicity, and accuracy isn't important. More...
 
int mtof (int)
 A good choice if you're using whole note values, want speed and simplicity, and accuracy isn't important. More...
 
Q16n16 Q16n16_mtof (Q16n16)
 Converts midi note number to frequency with speed and accuracy. More...
 
template<int8_t NI, uint64_t RANGE>
UFix< 16, 16 > mtof (UFix< NI, 0, RANGE >)
 Converts whole midi note number with speed and accuracy (more accurate that mtof(uint8_t))
 
template<int8_t NI, uint64_t RANGE>
UFix< 16, 16 > mtof (SFix< NI, 0, RANGE >)
 Converts whole midi note number with speed and accuracy (more accurate that mtof(uint8_t))
 

Friends And Related Function Documentation

◆ mtof [1/2]

int mtof ( int  midi_note)
friend

A good choice if you're using whole note values, want speed and simplicity, and accuracy isn't important.

Parameters
midi_notea midi note number.
Returns
an integer approximation of the midi note's frequency.

Definition at line 102 of file mozzi_midi.h.

◆ mtof [2/2]

int mtof ( uint8_t  midi_note)
friend

A good choice if you're using whole note values, want speed and simplicity, and accuracy isn't important.

Parameters
midi_notea midi note number.
Returns
an integer approximation of the midi note's frequency.

Definition at line 93 of file mozzi_midi.h.

◆ Q16n16_mtof

Q16n16 Q16n16_mtof ( Q16n16  midival_fractional)
friend

Converts midi note number to frequency with speed and accuracy.

Q16n16_mtofLookup() is a fast alternative to (float) mtof(), and more accurate than (uint8_t) mtof(), using Q16n16 fixed-point format instead of floats or uint8_t values. Q16n16_mtof() uses cheap linear interpolation between whole midi-note frequency equivalents stored in a lookup table, so is less accurate than the float version, mtof(), for non-whole midi values.

Note
Timing: ~8 us.
Parameters
midival_fractionala midi note number in Q16n16 format, for fractional values.
Returns
the frequency represented by the input midi note number, in Q16n16 fixed point fractional integer format, where the lower word is a fractional value.

Definition at line 119 of file mozzi_midi.h.