4 ms·
Web Audio API: Musically-aware scheduling and Dynamic looping (2016)
- jakelazaroff 7y agoHeads up, 2016 article. Did a double take when it said fetch wasn't implemented in Safari yet.
- feross 7y agoThe demo near the end with the Sonic “Chemical Plant” theme is definitely worth checking out. I wasn’t aware that this was how games dynamically change the background music in response to an event in the game.
- kevingadd 7y agoIt can be interesting to compare "game rip" versions of game soundtracks with the official CD releases. An official release of a track from Remember Me might be 2-3 minutes long, but the game rip is 10-20 minutes long, filled with stems and loop segments that transition back and forth based on a few things like the length of the player's current combo chain and their HP. AFAIK, Splinter Cell: Chaos Theory is another example of this - there's an official release of the soundtrack but the game rip versions of the tracks are typically all 5-10x as long because they are extremely dynamic. Aside from loop point adjustment, a common technique is to split a track into layers and fade layers in/out dynamically depending on world state.
- jaffathecake 7y agoNintendo are particularly good at this, where each phase though a menu towards starting a game will add layers to the music. Makes me wonder if they're still using some form of sample-based music tracker.
- ShamelessC 7y agoPortal 2 makes heavy use of the "fading layers in dynamically" as the music will change when you fly through the air, hold various objects, or change parts of a puzzle. Lots of good examples here https://youtu.be/ursIj59J6RU https://youtu.be/ursIj59J6RU
- kaycebasques 7y agoFYI we've got a Web Audio API guide in the works for web.dev. We're still working on it but here's the staged version: https://deploy-preview-2757--web-dev-staging.netlify.app/profiling-web-audio-apps-in-chrome/ https://deploy-preview-2757--web-dev-staging.netlify.app/pro... (Figured I might as well put in a plug while Web Audio is on page 1)
- nchase 7y agoLooks great! Thanks!
- aasasd 7y agoDecoding whole tracks in memory seems pretty wasteful (and then getting entire waveforms on top, though this part can probably be limited). I guess it's okay if you're looping a thirty-second track but not so much if it's twenty minutes, like mentioned in another comment. Makes me wonder if compressed audio can be used directly in such cases.