MIDI note numbers map to Hz via a tuning formula centered on A4=440 Hz
MIDI note 69 corresponds to A4 = 440 Hz. The conversion formula is hz = 440 * 2^((midi - 69) / 12). This is implemented in DDSP as midi_to_hz() with an optional midi_zero_silence flag that returns 0 Hz for MIDI note 0 (used when MIDI 0 represents silence rather than the pitch ~8 Hz). The inverse hz_to_midi() returns the fractional MIDI note for an arbitrary frequency. DDSP also provides helpers for mapping unit intervals [0,1] to frequency ranges logarithmically (unit_to_hz, unit_to_midi), which are used to constrain neural network frequency outputs to musically relevant ranges.
Examples
import ddsp
hz = ddsp.core.midi_to_hz(69) # 440.0
hz = ddsp.core.midi_to_hz(60) # 261.63 (middle C)
note = ddsp.core.hz_to_midi(880) # 81.0 (A5)
Assessment
What frequency does MIDI note 69 correspond to? Write the formula. What does midi_zero_silence=True change, and when would you use it?