Rust Project - Pitch Detection

Hello!

I really need your help with building a project required at the University I am at.

The project needs to be built in embedded Rust, so no_std, using Raspberry Pi Pico.

I chose to build a pitch detector, using Raspberry Pi Pico, a microphone sound sensor module Ky-038 to capture the analog signal of piano notes in the octave ranges 3-5 and then display the corresponding musical note (for example: A3, B4, D5 etc) and/or frequency on an LCD 1602 I2C.

I have no clue how to do that and I would be really grateful if you could help me.

The crate i am using for the lcd is ag-lcd.

This group is glad to help. But you need to help us help you.

What have you tried? How far have you gone?

DId you get the ag-lcd example code to compile, install, run, and give you the "Test Message!"

Do you plan on rolling your own pitch detection, is that part of the requirement, or are you planing on using a crate to analyze the sound?

1 Like

I am using embassy-rs. I have managed to get the LCD running and to get the analog signal from the microphone, but I didn’t find no_std crates for analyzing the sound. The ones that claim that are no_std I have listed down below, but I still get erros from the float folder. What crates should I be using?

https://crates.io/crates/pitch-detection

You can do a simple pitch detection yourself.

Shift the signal and multiply it with it self.
Do it for different periods - the period with the highest autocorrelation is the pitch.

https://sci-hub.ru/10.1109/TAU.1972.1162410

Here's a uni project I did a while ago which uses cross correlation. It's implemented in Rust, so it may be of use.

Cool project - maybe op could couple it with a bean gun or mecanised fly swatter.

1 Like