Turning LEGO Blocks into Music with OpenCV

We’re not sure what it is, but something about LEGO and music go together like milk and cookies when it comes to DIY musical projects. [Paul Wallace]’s Lego Music project is a sequencer that uses the colorful plastic pieces to build and control sound, but there’s a twist. The blocks aren’t snapped onto anything; the system is entirely visual. A computer running OpenCV uses a webcam to watch the arrangement of blocks, and overlays them onto a virtual grid where the positions of the pieces are used as inputs for the sequencer. The Y axis represents pitch, and the X axis represents time.

Embedded below are two videos. The first demonstrates how the music changes based on which blocks are placed, and where. The second is a view from the software’s perspective, and shows how the vision system processes the video by picking out the colored blocks, then using their positions to change different values which has an effect on the composition as a whole.

A different approach to this idea was seen in LegoTechno, which used a translucent baseplate with a camera mounted underneath. The Lego Looper, on the other hand, went in a completely different direction with a setup resembling a merry-go-round. It’s pretty clear that adding a physical dimension and immediate feedback to music is great fun, and LEGO seems to be a ready component for achieving that.

2 thoughts on “Turning LEGO Blocks into Music with OpenCV

  1. Take the Jackson Pollock approach to this form of LEGO music. Throw a handful of blocks on the table, have this setup read it, and you’re done. Whatever it cranks out is your composition.

  2. great work : having fun drawing music with my kids! thanks for that! I feel a bit limited with gs windows synth idlike to midi control external gear and don’t really know how i can achieve that with your beautiful tool!

Leave a Reply

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