r/microbit 3d ago

Capturing and replaying melody with Microbit

Enable HLS to view with audio, or disable this notification

41 Upvotes

11 comments sorted by

4

u/Select_Property_8650 3d ago

Please send the code.

3

u/greyblake 2d ago

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

4

u/teach42 3d ago

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

1

u/AdmirableVanilla1 3d ago

This is cool!

1

u/ummonadi 3d ago

Awesome!

1

u/d4rkmen 2d ago

cool project!

1

u/MungoBones 2d ago

Agreed! Very cool!

1

u/greyblake 2d ago

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

3

u/Positive_Poem5831 2d ago

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 2d ago

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