Top
Best
New

Posted by simedw 8 hours ago

Show HN: I trained a 125M model to autocomplete piano on-device(simedw.com)
I trained a 125M-parameter transformer to autocomplete piano performances in real time (~108 notes/sec on an iPhone 15).

The idea is basically GitHub Copilot or Tabnine, except instead of prompting it with code, you prompt it by playing a few notes on a MIDI piano. The model then continues what you played, entirely on-device.

The app is free if anyone wants to try it. Happy to answer questions about the model, training, Core ML, or the many things that didn't work.

421 points | 98 comments
tom_vidal 5 hours ago|
This sort of “autocomplete” is actually fundamental to how classical composers were trained.

For anyone interested, I’d highly recommend reading Robert Gjerdingen’s article Gebrauchs-Formulas. https://www.researchgate.net/publication/259731561_Gebrauchs...

You can also listen to the transcript of four Russian composers, including Rachmaninoff, playing this pattern recognition and generation game at a dinner party in the late 1800’s: https://youtu.be/PlFPOWuwBHI?is=EKBK7QQkJs4MsTCU

Composers at the time could do this just by looking at sheet music and audiating, without using a piano.

vunderba 4 hours ago||
To add to this: classical extemporization, post-Romantic period, also sort of fell out of favor as the composer began to pre-empt the performer and the "written note is sacrosanct" effectively became the de jure standard.

There's a great story around how Beethoven, perhaps one of the strongest improvisers of his day, completely upstaged Steibelt, a contemporary musician and by all accounts a bit of a charlatan. I'll include the entire quote verbatim from "The Lives of the Great Pianists" by Harold Schonberg.

  This time Steibelt had prepared a brilliant fantasy for piano and strings, the theme coming from the Beethoven trio he had heard the previous week. Steibelt's admirers were in raptures. Now the issue was joined, and Beethoven had to show his strength. He walked to the piano, grasped the cello part of the Steibelt work en route, put it upside down on the piano and insultingly drummed out a theme with one finger. Then he improvised, and—angry, excited, on his mettle—how he must have improvised! Before Beethoven had finished, Steibelt stole from the room. He never again would meet Beethoven and made it a condition before going anywhere in Vienna that Beethoven not be invited.
dyzone 3 hours ago||
I'm a little lost. What am I listening for in that video?
hiccuphippo 1 hour ago||
Classical jamming.
joshuamerrill 2 hours ago||
Classical pianist and software product designer here.

I see so much in common with this project and the numerous AI-based UX design tools out there. Whether it's music or UI, now that the "generation" portion of the work costs zero, all that remains is taste.

And so much of taste comes from exploring and killing off possibilities that turn out to be dead-ends. I love the idea that models like these will help us find the dead ends faster, or even produce a gem here and there.

P.S. if you want another uncanny version of Fur Elise, listen to Beethoven's own 1822 revision: https://www.youtube.com/watch?v=s24TtiGgb6k. His 1810 version that we all know was simpler and more balanced. But for what it's worth, Beethoven didn't publish either of them.

nuancebydefault 2 hours ago||
Thanks. I found the 1822 version actually quite agreable
bubblegumcrisis 1 hour ago||
[flagged]
jasonjmcghee 5 hours ago||
I think this is a great project and very HN. Not sure why the comments are so focused on the deliverable- you learned way more and had a much more interesting experience.

One think I didn't see mentioned in the post- maybe I missed it- how large was the data? How many samples did you use to pretrain and post-train

munksbeer 7 minutes ago|
There is this in the post:

> The final dataset contained a few hundred thousand MIDI files, representing roughly 300 million note events.

karmelapple 5 hours ago||
Hearing the start of Für Elise, and then it being taken in an incredibly different direction, is surprisingly disconcerting.
gregsadetsky 3 hours ago||
There's an incredibly funny bit (if you're into absurdist comedy) by Hans Teeuwen about the disconcerting direction a well known song can take:

https://www.youtube.com/watch?v=FCDPxNyLAww

marssaxman 1 hour ago||
The disconcerting effect is enhanced by hearing the Dutch voice and reading the Dutch subtitles which don't quite match up with what he is saying in English! - until it all goes off into musical absurdity. Thanks for sharing.
ABNW 3 hours ago|||
I found it refreshing and interesting, not really disconcerting. Show's how AI can extrapolate in novel ways. An interesting feature.
h2aichat 4 hours ago||
Can we hear it?
senbrow 4 hours ago||
It's on the linked page if you scroll down just a bit.
goda90 7 hours ago||
Reminds me of this project to generate every melody possible algorithmically in order to fight music copyright lawsuits. https://allthemusic.info/
ronyeh 2 hours ago|
Thanks. I enjoyed watching the TEDx talk on that page.
ghm2199 5 hours ago||
Interesting. I do feel letting a machine generating notes is taking the joy out of improvisation, is it not?

I think one of the great, early, joys of learning a piano is gaining the following intuitions: The seemingly harder path of learning sheet is actually faster. Your mind _should_ learn to think in two dimensions Spatial — where fingers go — and Time — pitch and tempo – ** when learning. The _internalization_ of Space and Time queues guide the fingers in a dance that is vastly satisfying. This skill leads you to the final part of the journey that is improvisation and the one more exciting than what i am on now.

---

**

Space: Your finger placement on keys right, e.g. knowing how to go from landmark/anchor notes(mid-c, G, F etc) and then go to the others above and below it. Crudely this is some what like typing from your landmark f and j qwerty keyboard

Time: The out singing/verbalizing of the notes/beats on a time measure as you play them(per the time measure). e.g. you can say out loud 1-2-3-4 for 4/4 measure, if the measure has quarter notes say out loud. And `1-e-and-a-2-e-and-a-3-e-and-a-4-e-and-a` for a 4/4 with 1/16th note granularity. Do this as you play the notes and you get a sense of tempo.

elwell 5 hours ago||
OP found a different source of joy: "I wanted the fun of working through the problem myself, rather than just implementing someone else’s research."
ghm2199 5 hours ago||
Fair enough.
jeffreygoesto 3 hours ago|||
Reminds me of a story a coworker told me about his band rehearsal when the new drummer counted one-two-three-four-five-six-se-ven-eight.
yieldcrv 3 hours ago||
as with every discipline that AI and therefore computers can reason through suddenly:

you could always do the discipline you liked before for self fulfillment purposes, and you can still do it for self fulfillment purposes now

debugnik 19 minutes ago||
But most people who want to get good at their main discipline, even for self-fulfillment purposes, have been gaining the necessary experience through their job, because an unrelated job takes away too much time to do so.
yieldcrv 1 minute ago||
its a good motivator and looks like we'll be returning to the more feudal version where just that class was focusing on the arts, only because everyone else is preoccupied with doing the things that pays the bills

unless they're actually serfs again and won't have bills to pay, but no access to anything outside of the fiefdom that they maintain all day

timmb 7 hours ago||
Reminds me of Francois Pachet’s Continuator (all the way back in 2003, using hierarchical markov models)

https://www.francoispachet.fr/continuator/

heikkilevanto 7 hours ago||
I would love something like that, except that I play the melody, and it produces proper 3-4 part accompaniment, preferably in good baroque style. Extra bonus if it could also write it into a file in a format suitable for music editing programs.
vunderba 6 hours ago||
An early attempt at this was Microsoft Songsmith [1] all the way back in 2009, which would take a melody (usually recorded by mic) and try to scaffold an accompaniment around it though obviously not realtime in any sense of the word.

The closest we've had to realtime orchestration around a melody in the "real world" is probably arranger keyboards though your left hand is still responsible for the chord progression itself.

[1] - https://en.wikipedia.org/wiki/Microsoft_Research_Songsmith

Naitik88 5 hours ago|||
This feels like a natural next step. Starting with a simple melody and having the system fill in the rest while still following your playing style could make it much more useful for experimentation than generating a complete piece from scratch.
morkalork 7 hours ago|||
That's a fun idea. You could start playing the piano and it kicks in with a base and drums for a jazz band.
altmanaltman 4 hours ago||
That is an incredibly hard challenge though. Creating the whole backing track (in any meaningful way other than just basic chords) from just melody will require an amazingly high number of highly subjective choices and random gen will not lead to good outcomes since our ears like intentional and artistical creativity in general.
hliyan 6 hours ago||
Ah, MIDI files. The only type of music you could realistically download from the internet back in the day, and you had to wake up at ungodly hours so that your dialup modem would not rack up a massive phone bill.
killerstorm 6 hours ago||
MIDI is still widely used for professional music production. It sounded goofy back in the day because synthesizer it was played on was not very good.
andai 5 hours ago|||
I remember at one point RuneScape switched from the built in Microsoft midi whatever to their own sound engine, and from that day, everything sounded wrong, even the frogs, because to me, the crappy midi sounds were the whole personality and feel of the game.
HPsquared 6 hours ago||||
I'm thinking canyon.mid on Microsoft GS Wavetable Synth.
otabdeveloper4 3 hours ago|||
MIDI is a protocol, and it's not ever going away or being replaced.

Some protocols (like I2C or MIDI) are gonna be with humanity forever, probably.

xtracto 6 hours ago||
I remember downloading MOD files. It was just a bit larger than midi, but sounded better. I had a PC but I think it was an Amiga thing
andai 5 hours ago||
Need For Madness is one of my favorite games, and probably two thirds of that fondness is the music, which was a bunch of MOD files.
mare5x 3 hours ago|
Really cool! It reminds me of a demo I saw live at NeurIPS: https://www.youtube.com/watch?v=8s3V922h3CU (paper at https://openreview.net/pdf?id=3yeBer3J5z).

If you like such creative AI work, I would recommend looking at the other "NeurIPS Creative AI Track 2025" submissions as well.

More comments...