กลับไปหน้ารวมไฟล์
music-mallet-turning-motion-into-music-bfdc9f-en.md

This project uses motion to generate a variety of MIDI commands to allow you to play music. It detects rotation about the vertical axis to select notes from a scale. Rotation about the length of the Music Mallet to modify the note to be sharp or flat. Angle of the Music Mallet to the vertical axis to control the playing of the note, including how hard the note is played. It then offers the ability to bend the pitch of the note or perform polyphonic after-touch by waving the Music Mallet side to side. The sustain pedal can be toggled on and off to control how notes are played by lifting the Music Mallet to the vertical.

Lights on the Mallet change colour to indicate the note selected and the saturation of the colour is changed when a note is played to give a visual cue.

Technical Implementation: Motion to Music

The project leverages the MPU6050 to detect the orientation and acceleration of the mallet. This 6-axis sensor measures the mallet's 3-axis acceleration and 3-axis angular velocity for precise motion tracking. The Arduino processes this data and maps it to specific musical actions.

Hardware Infrastructure

The hardware has only 4 components. The D1 Mini board, the MPU6050 motion sensor, a string of 5 RGB LEDs and a 2*AAA battery holder (with switch). These are relatively easily soldered together to give you a fully portable, workable device you can take off of the bench and into the world. Lithium AAA batteries should be used to get the correct voltage.

Software Logic & Motion Mapping

The software builds on the SweetMaker Core Library and is an example project within the SweetMaker BlueberryPie Library. This includes a number of other example projects using the identical hardware configuration.

The Sketch itself does the following:

  1. Takes MotionSensor orientation output and converts that to Angle-to-Vertical, Angle-about-vertical, rotation-about-mallet-axis, Angle-to-Vertical-velocity. This is the core motion processing layer.
  2. Takes this motion info and identifies note selection, note adjustment (sharp, flat), note playing, note after effects and finally sustain pedal toggle. This is the mapping logic:
    • Strike Detection & Velocity: The angle to the vertical and its velocity determine if a note is played and how hard (MIDI velocity).
    • Pitch Selection & Modulation: Rotation about the vertical axis selects the base note from a scale. Rotation about the mallet's length adjusts it sharp or flat. Side-to-side waving can bend the pitch or apply after-touch.
  3. Takes these actions and generates corresponding MIDI events using the BlueberryPie MIDI over Bluetooth library. This handles the audio/HID layer output.
  4. Also adjusts LED colours and saturation depending on events to provide visual feedback.

The MusicMallet should be used in conjunction with a device which can receive MIDI over Bluetooth events such as the King Of FM Synth from the Apple App store. This app is particularly appropriate because of it's good support for MIDI Velocity control when playing notes. This simulates how hard keys on a keyboard are hit which, corresponds to how hard the baton is swung to play notes.

Future Expansion

  • Gesture Control: Implement specific gestures (like circles or shakes) to trigger different effects like vibrato or sustain.
  • Wireless Connection: The project already uses Bluetooth MIDI, but a future version could explore other wireless protocols for different use cases.
  • Multi-Mallet Ensemble: Create a set of synchronized mallets for a collaborative musical performance.

This project is a perfect combination of Motion Tracking, Musical Theory, and Creative Human Interface Design.

ข้อมูล Frontmatter ดั้งเดิม

apps:
  - "1x Arduino IDE"
  - "1x MIDI Library (Optional for Pro MIDI features)"
author: "shassandanish1"
category: "Audio & Sound"
components:
  - "1x Arduino Leonardo, Micro, or Pro Micro"
  - "1x MPU6050 6-Axis Gyro/Accelerometer"
  - "1x Piezo Buzzer or External Speaker"
  - "1x Battery or Power Supply"
  - "10x Jumper wires (generic)"
  - "1x Mallet (Handle and Head)"
description: "This project makes good use of an IMU motion sensor (including motion fusion) to sense a variety of movements which are then used to generate MIDI commands for playing music."
difficulty: "Intermediate"
documentationLinks: []
downloadableFiles:
  - "https://github.com/SweetMaker/Core"
  - "https://github.com/SweetMaker/StrawberryString"
  - "https://github.com/SweetMaker/BlueberryPie"
encryptedPayload: "U2FsdGVkX1/l25ewMPOpIkNoD+UIEyGyUfI3iSxXPFbicAyBZpxlhXJUC5YUb+1VsvB3Fud44YjHd9V7Cc22onk7mxEm2e+fkerLsnPD/so="
heroImage: "https://cdn.jsdelivr.net/gh/bigboxthailand/arduino-assets@main/images/projects/music-mallet-turning-motion-into-music-bfdc9f_cover.jpg"
lang: "en"
likes: 0
passwordHash: "1ee89206b280f6a1b9d6ebd08b1de393d19151f85ab66b73cb45ef9d6455e5e3"
price: 1120
seoDescription: "Create music from motion using an IMU motion sensor and motion fusion to generate MIDI commands in this Arduino project."
tags:
  - "music"
  - "mallet"
  - "motion"
  - "arduino"
  - "sensors"
  - "melody"
title: "Music Mallet - turning motion into music"
tools: []
videoLinks:
  - "https://youtu.be/0uyJjEZcux4?feature=shared"
views: 1061