Friday, July 26, 2024

Saxophone changes colour on every note

Some of our favourite Raspberry Pi builds are small and simple. This saxophone accessory sits inside the instrument’s bell and lights up in different colours based on the note being played.

It’s a simplification of an existing bit of kit designed by Redditor k31tht for his sax-playing friend, who was tired of wearing bulky electronics that need the battery changing during the interval.

Merry (and eclectic) band of hardware

Yep, you read that right: the maker repurposed a plastic gutter guard in this build. Its shape mirrors the bell of a saxophone, so it sits snugly in there with the NeoPixel ring fixed to its top outer edge, leaving the LEDs visible to the audience watching the band. The maker hacked a blanking plate from an old PC for the Raspberry Pi to sit on, and screwed it to the gutter guard, leaving room to squeeze the tiny microphone in. A little foam stuck around the outside ensures the saxophone bell doesn’t get damaged. There is space for the power bank along with everything else inside the gutter guard, but the maker chose to mount it on the side of the saxophone incase it distorted the sound.

How does it work?

PyAudio interfaces with the microphone and captures audio emitted by the saxophone, then aubio derives separate tones from the recording. After that, NumPy converts this output into MIDI tones and a particular colour is assigned to each tone across the range of MIDI tones recorded. The colours are assigned sequentially based on an RGB colour wheel.

Sound captured from the saxophone on the right and the corresponding data correctly being parsed on the left

Everything is coded in Python and the LEDs even respond to the saxophone’s volume, shining brighter as the instrument gets louder, fading as a note trails off, and appearing again when the next note is played. The maker also managed to restrict the NeoPixels’ reactions to only those tones emitted by a saxophone, so noise from other instruments can’t trigger the lights.

That “small and simple” comment at the top of this post didn’t age well, did it? It’s a simple idea, I suppose, but the execution seems incredibly involved. Excellent job, maestro.

The post Saxophone changes colour on every note appeared first on Raspberry Pi.



from News - Raspberry Pi https://ift.tt/g2Rikew

Labels: ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home