Turning Sounds From A Flute Into Sheet Music

Composing music can be quite difficult – after all, you have to keep in mind all of the elements of musical theory, from time signature and key signature to the correct length for all of the notes. A team of students from Cornell University’s Designing with Microcontrollers class developed a solution for this problem by transcribing sounds from a flute into sheet music.

The project doesn’t simply detect the notes played – it is able to convert the raw audio into a standardized music score complete with accurate note timings and beats per minute. Before transcribing the music, some audio processing was necessary. The team chose to use a Sallen-Key filter to amplify the raw audio input due to its complex conjugate poles. They then used a fast Fourier Transform (FFT) to determine the frequency for the input note, converting the signal from the time domain to the frequency domain.

The algorithm samples the data to generate an input signal, using the ADC on the microcontroller to receive input from the microphone. It takes the real and imaginary components of the sampled signals and outputs a pair of real and imaginary amplitude components corresponding to the sampled frequency, evenly spaced from 0 to the Nyquist rate (half the sampling rate). The spacing of these bins and the bin with the largest amplitude are used to convert the signal back to a real frequency and a MIDI note.

The system uses a PIC32 for the logic. The circuitry for the microphone amplification uses a non-inverting op-amp with a gain of 50 to increase the microphone output signal amplitude from 15 mV to 750 mV to use by the microcontroller’s ADC. The signal is then sent to the anti-aliasing Sallen-Key filter, with a pole at 2.5 kHz and a Q of 1. The frequency was chosen since the FFT samples at 8 kHz and the frequency corresponds to a note out of the range of a flute. As for the filters, only the low pass filter was implemented in hardware.  While a bandpass filter could have been implemented in hardware, the team decided on a cleaner software approach.

The project is well-documented on the team’s project page, and it’s certainly worth checking out for more detailed discussions on the keypad controls and the software side of the audio processing. If you want to learn more about the FFT, check out this 2016 Hackaday Prize entry for an FFT spectrum analyezer.

12 thoughts on “Turning Sounds From A Flute Into Sheet Music

    1. Quick analysis shows that the circuit shown in the picture has a gain of about 6 instead of 50 and it has a cut-off frequency around 15 Hz before the Sallen-Key filter.

      Doesn’t match the report.

      1. Now, if they changed the 10k resistor to 1k, then the high-pass frequency would be about 165 Hz and the gain of the whole circuit would be about 54 because the Sallen-Key filter they designed oscillates and overshoots a little bit.

        Alternatively, change the 50k resistor to 500k and the lower frequency remains at 15 Hz with a gain of 55. It’s not that difficult to make the circuit behave. I’m just trying to understand why they’d say they don’t have a high-pass filter when they do, and the gain – did they post the wrong circuit diagram? Or accidentally use a 1x probe with the scope set on 10x, because their results show the correct amplitude.

  1. I hope they got an “A”!!
    My daughter is going to want one.
    I wonder how much of this could be implemented from a RAW audio recording captured from a system using the Wolfram chipset in existing equipment and software?

  2. The writer spells out what the Nyquist rate is: “…evenly spaced from 0 to the Nyquist rate (half the sampling rate).”

    I can’t tell you how happy it makes me when a HaD writer doesn’t assume that everyone knows the meaning of every technical term or acronym. Well done! Most of the other HaD writers would do well to follow suit.

  3. That is awesome teamwork ladies. Congratulations, a very well deserved grade. Do you intend to open source your project? As a flute player I am surprised the harmonics in a flutes tone, and variability of embouchure allowed you to track it so successfully.

  4. “We believe that our project is fully compliant with IEEE and other standards.”

    I’m going to go out on a limb and guess it is not compliant with MIL-STD-461. Making a blanket statement like that is just ridiculous. And then later on…

    “Our project did not cause or experience interference from other people’s designs.”

    Ah, therefore it must be “fully compliant”.

    1. You have to remember that undergrads these days are instructed to over-state and hype themselves for the jobs market. They have to present themselves as if they know what they’re talking about even when they don’t, because their future bosses won’t know any better. It’s enough that you comprehend half of it, because they’re aiming for middle management level positions and the actual design work and compliance testing etc. will be outsourced.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.