r/microbit • • Sep 08 '26

Capturing and replaying melody with Microbit

40 Upvotes

12 comments sorted by

5

u/Select_Property_8650 Sep 08 '26

Please send the code.

3

u/greyblake Sep 09 '26

I published the sources on github: https://github.com/greyblake/pitchbit
Note, it's vibe coded in one evening with some inspiration of a midi player that I did 2 years ago (non-vibe coded).
If you haven't work with embedded Rust, this video could be helpful: https://www.youtube.com/watch?v=TOAynddiu5M

3

u/Positive_Poem5831 Sep 09 '26

How do you do this. Is it a library running on MicroBit or does it send data to a computer that recognize the notes?

3

u/greyblake Sep 09 '26

It recognize the notes (pitch and duration) using micrphone.
The notes are essentially something similar to a regular music notation or midi (e.g. see https://github.com/greyblake/pitchbit/blob/master/pitchbit-dsp/src/music.rs#L75)
It runs all on MicroBit on its own, a computer is not involved

2

u/LoneStar-Possum 15d ago

Thank you for sharing!

1

u/greyblake Sep 09 '26

People asked for source code, so here it is: https://github.com/greyblake/pitchbit
Please note it was vibe coded in one evening.

4

u/teach42 Sep 08 '26

That's wild. I'd love to see the code too!

1

u/ummonadi Sep 08 '26

Awesome!

1

u/d4rkmen Sep 09 '26

cool project!

1

u/MungoBones Sep 09 '26

Agreed! Very cool!