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 commentsI like to have multiple hour continuations of songs which I use to help me fall asleep. In the past I've made my own, but I'm terrible at audio editing. It is a ton of work and, for me, really hard to get right.
After a little bit of experimenting with Mofi, it seems to do a very good job and selecting when to repeat a sections.
[edit]
Here's my first attempt for a 30 minute song:
https://mofi.loud.red/edit/ebbf4b410181aa767152945cbb6a2d679...
You can use this example though if you just want to try: https://mofi.loud.red/edit/8bd3fdf780f8c3927e41029f3b957f8a7...
"Not Imported You haven't imported this file yet. Import it first to use it."
1] A lot of the heavy lifting is done client side, which is excellent; I have a super fast processor! But, watching the CPU utilization, it seems to spike the CPU for a few milliseconds, then waits for a second or two and, spikes the CPU again, then repeats. I suspect there may be some significant performance improvements to be had on client recomputes.
2] While it is doing recomputes, it would be great to get a progress bar or, at least, a message saying, "This will take a long time, be patient." It took me multiple attempts to determine that the service was indeed working, just that my client was taking its sweet time recomputing.
All comments shown.
Couldn't load more comments. Check your connection and try again.