How to write a C Program Convert MIDI note to pitch in C Programming Language ?
This C Program Convert MIDI note to pitch.
Solution:
- #include <math.h>
 - #include <stdio.h>
 - typedef unsigned char byte;
 - // Convert MIDI note to pitch
 - void OnNoteOn(float *freqPtr, byte channel, byte note, byte velocity)
 - {
 - if (velocity > 1)
 - {
 - printf(">>Frequency Before In Function: %f\n", freq);
 - *freqPtr = 440 * pow(2,(note/12));
 - printf(">>Frequency After In Function: %f\n", *freq);
 - }
 - }
 - int main()
 - {
 - float freq = 0;
 - printf("Frequency Before: %f\n", freq);
 - OnNoteOn(&freq, 1, 50, 20);
 - printf("Frequency After: %f\n", freq);
 - }