Inspiration
My friend and I play duets, violin and piano. For a lot of songs we want to play there is no free sheet music for both parts, or it's paid, or it's too hard for our level. Writing it down by ear takes hours and you need good music theory. So I wanted a tool where you just record each part and get one score you can play together.
1. Who is it for, and why would they use it?
Users: amateur musicians and music students who play duets (for example violin + piano), and music teachers making simple parts for students.
Situation: you know how a tune sounds and can play your part by ear, but you don't have sheet music for both parts.
| Writing it by ear | Duetify | |
|---|---|---|
| Time for a 15 second tune | 30–60 min for a student | a few seconds (first run up to 1 min) |
| Skill needed | music theory + good ear | none to start, you only check the red notes |
| Two parts lined up | by hand | automatic, same tempo and bars |
| Cost | free but slow, or paid transcription | free, runs on your own laptop |
You can download the result as MusicXML and open it in MuseScore to edit or print.
2. What I built during the hackathon
New project. All code was written Nov 21–28, 2026. Before the event I only had the idea written down, no code.
- Audio → notes → sheet music pipeline (
backend/pipeline.py) - Overtone "ghost note" filter: removes fake high notes the AI hears from a real note's overtones
- Instrument range check: removes notes a violin or piano can't play
- Low-confidence notes shown in red so you know which notes to check
- Tempo fine-tuning so notes stay on the beat
- Duet merge: two recordings become one aligned score, piano on a grand staff
- Simple level for beginners: easier rhythms, one line for violin
- Web page: drag and drop, history with rename / delete / undo, MusicXML download
- Evaluation script with accuracy tables (
eval/evaluate.py) and a test clip generator (eval/make_test_audio.py)
Third-party tools: Basic Pitch (Spotify, open source) detects the notes. music21 builds the score. OpenSheetMusicDisplay draws it in the browser. librosa reads the audio and estimates tempo. Everything else is my own code.
3. How I used AI
AI in the finished project
Model: Basic Pitch, an open-source audio-to-MIDI model by Spotify. It listens to audio and gives each note's start, end, pitch and a confidence value.
Why this model:
- works for any instrument, not only piano
- small enough to run on a normal laptop CPU: no GPU, no paid API
- gives a confidence for each note, which I use for the red notes
My own AI decision: the overtone ghost filter. When I tested Basic Pitch, it often added quiet extra notes exactly an octave, an octave + 5th, or two octaves above a real note. Those are overtones, not real notes. My filter drops a note if it is weak (confidence below 0.45) and a much stronger note is at an overtone interval below it at the same time.
Note F1 score (a note counts if its start is within 50 ms of the correct note), measured with mir_eval:
| Test case | Correct notes | Raw AI | After Duetify cleaning |
|---|---|---|---|
| Easy violin | 21 | 0.75 | 1.00 |
| Easy piano (melody + bass) | 32 | 0.80 | 0.93 |
| Repeat of easy violin, timing wobble | 21 | 0.72 | 1.00 |
| Hard: fast 16th notes + noise + echo | 32 | 0.86 | 0.86 |
On the easy cases the filter removes the fake notes without losing real ones. On the hard clip it doesn't help, because the problem there is missed notes (recall 0.75), not extra notes.
Threshold test: I tried Basic Pitch onset thresholds from 0.3 to 0.7. 0.5 and 0.6 scored best (mean F1 0.95), so I kept 0.5.
| Onset threshold | 0.3 | 0.4 | 0.5 | 0.6 | 0.7 |
|---|---|---|---|---|---|
| Mean F1 | 0.93 | 0.93 | 0.95 | 0.95 | 0.94 |
What this does and doesn't prove: the test clips are synthesized from a public-domain melody (Twinkle Twinkle, 1761), so I have the exact correct notes to compare with. Real instruments in real rooms will score lower. I also tested [N] real recording(s) of myself: [what happened].
AI during development
I used Claude (Anthropic) as a coding assistant to write the first version of the pipeline, API, web page and evaluation script. I ran everything and checked the output:
- First sheet was wrong → fixed. On the piano clip the bass staff was empty, there were extra high notes, natural signs everywhere and broken rhythms. We found the causes (no rests filling gaps, overtone ghost notes, tempo read as 89 instead of 90) and fixed them.
- Ghost filter too strong → changed. The first version also deleted a real G4 (confidence 0.51). I changed the rule to only remove weak notes below 0.45.
- Simple mode made violin chords → changed. Fast notes snapped to the same beat and became chords a violin can't play. Now it keeps one note per beat for violin.
- YouTube download → rejected. It was in my first plan, but I dropped it because of copyright. Only upload your own playing or public-domain music.
- I ran the evaluation on my own laptop and got the same numbers.
4. How to use it, and results
Setup (Windows / Mac / Linux, free):
cd backend
python -m venv .venv
.venv\Scripts\activate # mac/linux: source .venv/bin/activate
pip install -r requirements.txt
uvicorn app:app --reload
Then open http://127.0.0.1:8000. Needs Python 3.10 or 3.11 and about 1 GB of disk. No accounts, no API keys, no cost. Internet is only used to load the sheet viewer script.
Main task: upload 1 or 2 recordings (up to 90 s each), choose the instrument for each, choose Normal or Simple, click Make sheet. Success means: right notes in the right order, on the beat, both parts lined up, and every note playable on that instrument.
| Case | Should happen | What happened |
|---|---|---|
| Easy violin | correct melody | all 21 notes right, 90 BPM |
| Duet violin + piano | 2 parts aligned, piano on grand staff | melody + bass right, bars line up |
| Same violin clip again | same result | F1 1.00 again |
| Fast, noisy violin (hard) | readable melody | about 3 in 4 notes found, no fake notes |
| Same hard clip, Simple level | fewer, easier notes | 8th notes only, one line |
Design choices that save effort:
- drag and drop, one button
- red notes show exactly what to check, so you don't recheck the whole sheet
- tempo detected automatically (you can type it if it's wrong)
- Simple level for beginners
- history, so you don't need to redo a transcription
5. Limitations and what happens when something goes wrong
Limitations
- One instrument per recording. It can't split violin and piano out of one mixed recording.
- Two parts are lined up by their first note, so start both recordings on beat 1.
- 4/4 time only, no key signature yet.
- Long piano bass notes sometimes come out as repeated short notes.
- Fast passages: about 1 in 4 notes missed in my hard test.
- Most tests use synthesized clips.
Failure handling
| Problem | How it's detected | What you see |
|---|---|---|
| Silent recording | volume too low | "Recording seems silent. Check your mic or file." |
| Too long | over 90 s | "Clip is 100s. Please upload 90s or less." |
| Wrong file type | file extension | "Unsupported file type '.txt'…" |
| Notes the instrument can't play | range check | removed, with a warning |
| AI not sure about a note | confidence below 0.35 | note shown in red, with a warning |
| Fake overtone notes | ghost filter | removed, with a warning |
| Nothing playable found | no notes left after cleaning | "No playable notes found. Try a clearer recording…" |
What I learned
- AI output needs checking against the right answer. Without the F1 test I wouldn't have known the ghost filter was also deleting a real note.
- Most of the work wasn't the AI model. It was turning its notes into sheet music a person can read: rests, bars, tempo, rhythms.
Challenges
- Overtones showing up as fake notes
- Notes drifting off the beat because the tempo was off by 1 BPM
- Making Simple mode easier without creating notes a violin can't play
What's next
Key signature detection, 3/4 time, more instruments, and fixing notes directly in the browser.
Sponsor tools: none used.