How to Make the Disklavier play the Piano Part of Any Song - Alex's Piano Service

How to Make the Disklavier play the Piano Part of Any Song

The Yamaha Disklavier is a sophisticated piece of technology, but typically, you’re limited to Yamaha’s song library. Many Yamaha songs include both a piano part for the Disklavier and an accompanying music track, though the Disklavier piano part might differ dramatically from the original piano part in the song. In many cases, the piano tracks are recorded as accompaniments by artists, and are either added to songs that didn’t have piano originally, or that are designed to augment rather than to replace the piano in the original recording.

I recently had a customer ask if I could figure out a way for the Disklavier to play the piano portion of a particular song that was important to him.

To achieve this, I used four programs: first, Spleeter by Deezer to isolate the piano and separate it from the other components of the song, and then Audacity, a powerful open-source tool, to edit and combine the non-piano tracks. I chose to use the service Ivory to convert the piano audio to MIDI. Finally, I used Ardour to adjust the timing in the MIDI to perfectly sync it with the audio.

As an alternative to Ivory, Onset and Frames can be locally installed. This software is dated (2018), and there are many frustrations with attempting to run such an old Python program, so I opted not to use this solution. However, if you have a high-end system with a powerful GPU and the free time to get it running, it’s a free option. You’ll also need to train your own model, with was estimated to take several days on my GeForce RTX 4080.

Separating the Tracks

I used the 5stems model in Spleeter, which allows you to individually separate the piano. See the instruction below.

spleeter separate -o ./tmp -p spleeter:5stems "sample.wav"

The output of Spleeter.
Here’s a six-second excerpt from Norah Jones’s “The Nearness of You” with the piano.
Here’s the same six-second clip without the piano.

Recombining the Tracks

After reviewing each track, I found only the bottom vocals track had usable audio; the others were filled with artifacts, so I simply removed them. However, in songs with more instrumentation, this would be an important step. Review the tracks, listen to them individually, and remove any artifacts you can, applying filters as necessary.

This is what the isolated tracks look like without the piano.

Next, I used the Ivory App to transcribe the piano audio track. Ivory is an AI-driven piano transcription tool that converts piano audio into sheet music or into MIDI files. Utilizing advanced deep neural networks, it offers high transcription accuracy. I converted my piano.wav file (produced by Spleeter) into an mp3, and then uploaded it to Ivory.

Transcribing songs on Ivory.
The resulting MIDI file, as displayed in Ardour.

Syncing the Audio

After downloading the MIDI file, I found that the MIDI file did not properly sync with the audio. In order to solve this, I synthesized the audio (using FluidSynth with Yamaha C7 samples). I then imported this into Audacity, and played the isolated piano alongside the original audio. After a few attempts, I then moved the audio back and forth until I determined exactly how much time had to be added to properly sync the two pieces.

fluidsynth -a alsa -g 1.3 -m alsa_seq -i /usr/share/sounds/sf2/Yamaha_C7__SMB_.sf2 ~/DownloadedMIDI.mid -F ~/IsolatedPiano.mp3

The isolated piano comes in much too early!
The isolated piano is perfectly in sync with the original.

After carefully adjusting the audio which I’d synthesized from the MIDI file in Audacity, I determined that the MIDI file needed a total of 1.150 seconds added to it. This is a decimal fraction, rather than seconds in 60ths of a second, which is how Ardour determines time.

Seconds in 60ths = Integer Part + (Decimal Fraction × 60)

Just take the decimal component of the number (.150, in this case), and multiply it by 60. In this case, we end up with 1:09 seconds. Now we have a number we can use in Ardour.

I’ve now carefully moved the track to 1:09 seconds (or 1.150 seconds, according to my measurement in Audacity).
I’ve now extended the MIDI track, and can export it!

Once the MIDI file is downloaded, name the MIDI file from Ivory and the piano-free audio from Audacity identically, and transfer them onto a USB stick. The properly named files will look something like this:

01MySong.mid
01MySong.mp3

Provided the filenames are identical (excepting the extension), the two files will be recognized as the same song by the Disklavier.

Your Disklavier is now ready to play both files in sync! The keys will move to the isolated piano track, and the audio will play alongside it without any competing piano sounds.

Synthesized audio from the MIDI file (using FluidSynth with C7 sampling) along with the vocals.

Leave a Comment