Show HN: Mofi – Content-aware fill for audio to change a song to any duration (opens in a new tab)mofi.loud.red
708 pointsI worked on a web service that allows you to import a song and define a target length that the song will be shortened or lengthened to. It does this by analyzing the song and finding repeating audio patterns. This is helpful for making any song match a video or performance with a set duration. You can also specify areas of the song to prefer or avoid. An example is available here: https://mofi.loud.red/edit/8bd3fdf780f8c3927e41029f3b957f8a7...
The cool thing is that after the song is analyzed on the server, the client can recompute and preview the results completely client-side through an implementation that uses Web Workers and WebAssembly. The audio previewing uses Tone.js. I am thinking of writing up some more details about the implementation in the future.
I'm still working on a way to explain this easily, but I like the idea of carrying over the concept of content-aware fill from images to audio.
Please let me know if you have any comments or questions!

Comments (161) 65 threads
Earlier comments> On repeat: Make an extended version of your song's favorite part by choosing the catchy part and seamlessly repeating part of it!
John Mulaney's "Best Meal I Ever Had" story[1] had me wanting to do this for Tom Jones' What's New Pussycat so I could play that as an inside joke with some friends. This would definitely have made that easier. (Ultimately, I had a version of the song which started in the middle and "ended" right before it "started" so the effect could be mimicked if the file was played on loop. This had a short silence manifest as the media player "loaded a new song" from its perspective; didn't have that issue in Audacity.)
[0] https://www.pokemon.com/us/pokedex/loudred
[1] https://www.youtube.com/watch?v=Tv1l1eUhN-E (Usually called "The Salt and Pepper Diner")
And yes, I had this issue while testing also! A lot of players added a small gap when looping which was a bit annoying to test with...
This is perfect for TikTok videos!
Will definitely be using your tool. Very cool!
> I am thinking of writing up some more details about the implementation in the future.
Please do :D
Is the project open-source?
If you are interested in audio analysis in general, I would also recommend checking out librosa: https://librosa.org/doc/latest/index.html
All comments shown.
Couldn't load more comments. Check your connection and try again.