Show HN: Cloning a musical instrument from 16 seconds of audio (erlj.notion.site)
In 2020, Magenta released DDSP [1], a machine learning algorithm / python library which made it possible to generate good sounding instrument synthesizers from about 6-10 minutes of data. While working with DDSP for a project, we realised how
it was actually quite hard to find 6-10 minute of clean recordings of monophonic instruments.
In this project, we have combined the DDSP architecture with a domain adaptation technique from speech synthesis [2]. This domain adaptation technique works by pre-training our model on many different recordings from the Solos dataset [3] first and then fine-tuning parts of the model to the new recording. This allows us to produce decent sounding instrument synthesisers from as little as 16 seconds of target audio instead of 6-10 minutes.
[1] https://arxiv.org/abs/2001.04643
[2] https://arxiv.org/abs/1802.06006
[3] https://arxiv.org/abs/2006.07931
We hope to publish a paper on the topic soon.
74 comments
[ 3.0 ms ] story [ 125 ms ] threadShort answer is yes! Previous work has shown that we can obtain very good results from controlling DDSP models from midi input. The solutions I am familiar with employ a two stage approach where the first stage takes midi and turns it into control signals (pitch & loudness contours etc..) and the second stage turns the controls signals into audio (like the particular model I discuss in the blog post)[1][2][3]. I actually think that the first stage could also benefit from the transfer learning techniques we discuss in the blogpost. In terms of actually releasing a MIDI playable VST plugin I believe that Magenta have something like it in the works[4]. I hope that it will come with some ability for users to quickly create their own instruments, presumably using a transfer learning technique similar to the one we have presented.
Real-time rendering poses multiple challenges. For one, some instrument sounds occur before a note properly onsets (for example the sound of the fingers pressing the keys of a saxophone occurs before the first note of the piece). Secondly, the research models are quite heavy and considerably more compute intensive than a standard VST instrument which poses a problem if you want to use it inside a DAW. I think this latter problem can be solved with some clever engineering and the general trend of hardware being more and more accommodating to machine learning applications.
[1] https://erl-j.github.io/controlsynthesis/#/ (Our previous work) [2] https://rodrigo-castellon.github.io/midi2params/ (Focuses on realtime rendering) [3] https://arxiv.org/abs/2112.09312 (Magenta's recent paper on the subject)
I'm wondering what the hardware requirements would be for real-time synthesis. I work on a musical instrument project as a hobby and would like a good accordion sound.
Thought this was interesting enough to share
Real instruments have mechanical behavior this isn't going to see absent some kind of modeling. Different notes on a sax (to take this example) are actuated by different fingers and different valves and have different (often multiple) embouchures, and both interact with the transitions between pairs of notes (and with the dynamics with which they're played). All that complexity is absolutely hearable in the transitions between notes, and the ML layers aren't going to have the ability to pick it up absent a much larger training set.
Basically: 16 seconds of audio is enough to get you the frequency spectrum of the notes, which you can do with 3-4 lines of synthesis code in an imperative regime. It's very much the "easy part" of instrument synthesis.
Couple of interesting things: - You can hear the keys and pads hitting and clicking - Vibrato on the last note is very realistic - Can hear the air and "spit" - The timing seems human, especially as it slows down a little on the lower notes which take more air and usually involve more awkward fingering with the pinky fingers. Definitely sounds like a non-professional, probably how an average high school player would play the passage.
It sounds like what a player would hear versus a studio recording. Reminds me of being in a really reflective & tiny practice room.
check out “Steerable discovery of neural audio effects” paper
https://csteinmetz1.github.io/steerable-nafx/
i’m compiling a list of research papers for our GuitarML project, feel free to open a pull request/issue when your papers are published!
https://github.com/GuitarML/mldsp-papers
Immediate use case would be sampling. Say you like a certain sound in a song and would like to use it as a starting point for your own sound patch.
I also believe that transfer learning has benefits even for making great sounding instruments in cases where you have access to lots of data. That’s my intuition at least.
At the very least, it saves you a lot of memory/bandwith. Instead of having one large model per instrument you only need one large models with a few extra instrument specific weights.
https://imgur.com/kmtoMkd
It's pretty easy to filter out the drums since most of the energy is in other bands. Looking at the spectrum again I don't think a simple spectral replication will nail the sound right. It looks like there is some sort of beat phenomenon that isn't present at all center frequencies.
https://news.ycombinator.com/item?id=21431071
https://github.com/deezer/spleeter/wiki/2.-Getting-started#u...
This model assumes the timbre is independent of the tone, but I can see now that this assumption is quite wrong and something more complicated (like this ML modeling) would be needed.
This might help you?
So not only is timbre not independent of frequency, summing multiple notes is also non-linear. The "beating" this causes is most obvious on the second chord to play. This beating is not consistent as the notes change, it's based on the difference in frequencies between the two notes being played.
Just reusing the original recording of a sample is equivalent to drawing a photorealistic tracing of an image: it represents a ground truth, but it's not illustrated in any particular artistic direction. And this makes the multisample libraries available today akin to "dry references" - they can be convincing as reproductions, some of the time, but you're stitching them together like a collage of photos.
If you throw the sample into a synthesis engine you can push around the parameters, crossfade it into a loop, add some envelopes, modulation and layers, and make it a uniquely stylized instrument, and this is one way to take the source material to a new place by forgoing some realism.
Doing the synthesis through style transfer helps move it in a different direction: it gets outside the bounds of directly sequencing performance parameters and makes the performance a little more like an effect, helping to glue the sound. And I think that could be really cool if applied to arbitrary source material.
Yeah, it would be ridiculous and unreasonable - but so was "I copyrighted these three notes in a row so pay me naow" :(
It seems it's usually not: https://blogs.law.gwu.edu/mcir/2018/12/20/timbre/
Then give it a melody and have it play the melody based on its library of notes for a given interment?
but actually trying to reproduce a real instrument involves legato between notes, handling pitch and timbre changes as you play, etc. So a much harder problem.
Thanks
Isn't that resynthesis? I mean, this could certainly be an addition to the vocabulary of resynthesis techniques, but is there something more categorical about it?
I can not use Cmd + left on a mac, is this a Notion thing?
So TLDR: bug with some selection/focus thing on the Notion page. Poor execution, I rate their implementation of "static notebook HTML pages" 7/10.
Also sorry for parasiting the comments here, very interesting research! It would have been interesting to record original samples in the same settings; we can hear the flute having much less reverb than the 1st saxophone and it could be helpfup to have a common room size / reverb time to help comparison.
https://news.ycombinator.com/newsguidelines.html
The current architecture imposes some strong assumptions on the source (such as harmonicity) which does not necessarily apply to all instruments (bells for instance). The harmonic + noise model is not that good with transients either (which is a key ingredient in piano sounds) but of course you could solve that through different means.
[1] https://arxiv.org/abs/1806.09617
Speaking of wavetables, have you seen this relatively recent work?
https://lamtharnhantrakul.github.io/diffwts.github.io/?
For the time being there is a colab where you can play with a pretrained model.
In terms of actually releasing a MIDI playable VST plugin I believe that Magenta have something like it in the works[4]. I hope that it will come with some ability for users to quickly create their own instruments, presumably using a transfer learning technique similar to the one we have presented.
Real-time rendering poses multiple challenges. For one, some instrument sounds occur before a note properly onsets (for example the sound of the fingers pressing the keys of a saxophone occurs before the first note of the piece). Secondly, the research models are quite heavy and considerably more compute intensive than a standard VST instrument which poses a problem if you want to use it inside a DAW. I think this latter problem can be solved with some clever engineering and the general trend of hardware being more and more accommodating to machine learning applications.
[1] https://erl-j.github.io/controlsynthesis/#/ (Our previous work) [2] https://rodrigo-castellon.github.io/midi2params/ (Focuses on realtime rendering) [3] https://arxiv.org/abs/2112.09312 (Magenta's recent paper on the subject)
I am not usually on the techno-optimist side of things but I have a hard time believing, after observing the progress of SOTA in the past decade on the big problems explored by ML research, that we are more than 5-10 years out from exceptional generative samplers based on tiny snippets of audio.
You basically need a breathe controller to make a realistic playable sax sound otherwise you can't control the variables in real time that are needed.
Personally, I want to hear synth sounds that are not even trying to be reproductions of acoustic instruments. If I want to hear a sax sound I want to hear someone who is really good on a real sax and who knows how to actually play a sax.
https://nsynthsuper.withgoogle.com/
Pianos are actually really easy, input-wise. You have attack speed, when you lift the keys and pedals, and that's it. But simulating the audio computations done by a physical instrument is just really difficult.
There are some physically-based (spherical cow physical) synths that sound more alive than the usual sample-based stuff, but their timbre is not right.
If I had more time, this is what I'd be working on right now. There's a market for a great piano synthesizer.
I think you would be interested in the work of Jatin Chowdhury[1] as well as the work of Christian J. Steinmetz[2].
[1].https://arxiv.org/pdf/2009.02833.pdf [2] https://arxiv.org/abs/2102.06200
https://storage.googleapis.com/ddsp/index.html
Here is the link I think you are looking for:
https://erlj.notion.site/Neural-Instrument-Cloning-from-very...
Thank you!
Flute+tuba => fluba. Fluba+violin => fluvioluba. And so on. (Harry Partch also wonders.)
I especially love trombone+thunder
https://magenta.tensorflow.org/ddsp
But what I wanted to ask: is the final model actually understandable or visualizable, e.g. as an envelope per harmonic that depends on F0, loudness and F0 confidence?
Anyway, I'm impressed.
Yes, that kind of visualisation could be performed. The authors of the prior work we are building on (DDSP) have made some great visualisations which I think you will find useful! Here: https://storage.googleapis.com/ddsp/index.html