Tuesday, November 25, 2008

Super Mighty Morphin' Power Halebopp

After a heated discussion on a functional programming approach to updating audio yesterday on the KVR audio forum, and the outcome that traditional methods to do DSP remain still unmatched in speed, I decided to bite the sour apple and follow the only single principle which has proven to work for me most of the time: "come on, M*therf*er, let's do this shit!". In this case, the maternal copulator I am referring to would be my computer.

So, as it looks, I invented a novel approach to generating audio on the fly. It doesn't work well for live input, which is, however, not the primary focus of the application. My approach is more suited for handling audio which may require intensive processing power, such as timestretching or other FFT effects. It also works very well for doing non-linear audio effects such as reversing a segment in time.

This is how it works: whenever the song changes, e.g. by dragging around tracks, the space that the track occupies will be marked as invalid - it needs to be updated. The final mixdown is split up into blocks of 64kb. A thread in the background generates a job for each block which needs updating (I know what you are thinking - we need a background thread for the economy!).

Each iteration of the thread, a few blocks are being worked, where blocks in front of the currently playing part of the song will be preferred, so the change in the song is immediately audible to the artist. In the screenshot above, the darker parts mark invalidated blocks which are in the process of updating.

The computer uses full CPU power when mixing audio, and thus finishes as fast as possible. When all data has been updated, no CPU power is being used. So just listening to your audio will never require much power.

What is currently not implemented is block dependencies, because I have no feature demanding it yet. Whenever a block, which depends on previous or future blocks, needs updating, these blocks have to be rendered first. But that shouldn't be hard to do, once the requirement pops up.

On a sidenote, I added wallpaper support. The wallpaper scrolls and zooms with the viewport, and makes editing a bit more creative and interesting.

0 comments:

Post a Comment