Inspiration
Some of us grew up playing instruments. Some of us quit after a few piano lessons. All of us have, at some point, obnoxiously drummed on a table while listening to music.
Making music is fun. Learning how to make music is a slightly different experience. Instruments are expensive, music theory is confusing, and opening FL Studio for the first time is arguably a humbling experience.
So we thought, why not make an instrument out of something you already have?
What it does
riffl turns practically anything into an instrument using just your laptop's webcam and microphone.
Want a kick drum? Grab a water bottle. A snare? Grab a mug. Don't have a piano? You have ten fingers.
Users can assign drum sounds to physical objects and play melodic instruments through hand gestures. Each recording becomes a looping layer, allowing users to gradually build a song. We also automatically correct the timing of their recordings, because not everyone has perfect rhythm (ourselves included).
No instruments, expensive equipment, or prior music production experience required.
How we built it
We built riffl using React, TypeScript, Vite, MediaPipe, and Tone.js.
For percussion, we combined microphone-based hit detection with computer vision. The microphone tells us when something was hit, and the camera tells us whether you actually interacted with the object.
For melody, we used MediaPipe's hand landmarks to map finger pinches to musical notes, essentially turning your hands into a three-octave virtual instrument.
We developed a shared recording and looping system that handles both inputs, alongside custom latency compensation and quantization to keep everything on beat.
The entire application runs locally in the browser.
Challenges we ran into
As it turns out, teaching a computer the difference between someone hitting a water bottle and someone aggressively typing on a keyboard is surprisingly difficult.
We also had to account for the different latencies of the camera and microphone. A seemingly insignificant delay can make an entire song sound off, especially when stacking multiple recordings.
Another challenge was designing gesture controls that were intuitive, responsive, and didn't require users to perform finger gymnastics just to play a chord.
Accomplishments that we're proud of
We turned a collection of random household objects and ten fingers into a functioning band.
We're particularly proud of combining computer vision and audio processing into something that feels like an actual instrument rather than a technical demonstration.
Our favourite part was being able to recreate I Gotta Feeling by the Black Eyed Peas without touching a single conventional instrument.
What we learned
We learned quite a bit about computer vision, audio processing, and the unforgiving nature of musical timing.
More importantly, we learned how much thought goes into designing an instrument. Something as simple as deciding which finger plays which note can completely change how intuitive it feels to use.
We also gained a newfound appreciation for people who can consistently clap on beat.
What's next for riffl
We want to explore multiplayer jam sessions, custom object sampling, more instruments, and exporting recordings as complete songs.
We're also interested in bringing riffl into music education, particularly for students and classrooms that don't necessarily have access to instruments.
Ultimately, we want the barrier to making music to be as low as having something to tap on.
Built With
- api
- audio
- computer
- css
- html5
- mediapipe
- react
- tone.js
- typescript
- vision
- vite
- web
