Show HN: An algorithmic audio landscape (ambient.garden)
This is an web audio experiment I've been wanting to do for a long time. Basically an ambient music composition, but all the sound elements are laid out in space, and that musical space can be explored freely.
It's definitely inspired by in-world music that sometimes appears in games. I basically took that concept, keeping the music aspect, and dropping the entire "game" aspect.
I also turned it into a more "traditional" non-interactive album, but since I started with code, why not program the whole thing? Had a blast making the entire album from code, the complete source for the album is here: https://github.com/pac-dev/AmbientGardenAlbum
41 comments
[ 3.0 ms ] story [ 92.9 ms ] threadIMO interactive in-world music peaked with Portal 2, the effort put into that was impressive.
Can you share more info about how you built the 3D world made of dots?
Of course, things are never that simple, and it turns out you can't just draw a million points with GL_POINTS, performance is terrible, they don't efficiently occlude each other, etc. So I rendered the terrain as regular triangles, and wrote a terrain shader that makes it look like the triangles are made of points. I re-wrote that shader several times, and actually, it's still not working correctly, but at some point you have to stop. That shader is here: https://github.com/pac-dev/AmbientGarden/blob/master/Web/ver...
Do you know of any Python library that lends itself well to experiment with procedural audio generation?
For cases when the sound playback is central to the successful use of the application, the “playback” Category should be used. This allows audi to be generated even when the hardware mute is enabled and the screen is locked, and has options for mixing. This is set by apps like Spotify, Apple Music, and Safari when playing video content.
I do not know of a way in HTML to configure this, I think it’s up to Safari to interpret the context based on user intention. It is possible that if the app defaulted to mute and had a user feature that started the audio session, Safari might assign it the “playback” Category.
https://developer.apple.com/documentation/avfaudio/avaudiose...
Edit: Oddly, if i open and close uBlockOrigin (nothing listed as blocked) then the animation will proceed frame by frame. One frame for open, one frame for close. Dropped an issue for you on your github.
Digging around your website a bit I see you've also made an interactive version of Paul Batchelor's sporth language cookbook[0], this is very cool, thank you! I'd like to get into sporth but I had a hard time with the stack-based language approach. Your version of the cookbook seems like a very nice way to get more comfortable with it.
[0] https://audiomasher.org/learn
That aside, changing instrument loops at timestamps is an interesting method of making music compared to "the usual" method of having an instrument play a pitch for this long, play another pitch for that long, pause for this long.
The current main version plays the same sounds, but pre-rendered, using cross-faded loops like you're describing. I considered the audio files to be purely an optimization, so I didn't consider licensing on those. So if the code is MIT-licensed and generates the audio, what's the license on the audio? The repository doesn't contain audio files, but code that generates them. Can I add a license for those non-existing files in the repository? Unfortunately, all I have is more questions.
For example, I found the https://ambient.garden/patches/ wandering through the source code (little worried by the wall of shaders), and was wondering if the audio patch portions were useable. Probably take me quite a while to figure out what it all does. Yet looks like a good starting point for music projects.
Also, like the references to other people's work in the code base. From my own perspective, nice way to acknowledge where you found something. Plus, if someone else is curious, there's at least somewhere to look.
Also, also, kind of neat you bothered to put in quasi-secrets (although, did not sit through the entire walkthrough, so maybe you eventually take the walkthrough path through all the nodes).
> The current main version plays the same sounds, but pre-rendered, using cross-faded loops like you're describing. I considered the audio files to be purely an optimization, so I didn't consider licensing on those.
IANAL and my comment depends on US copyright law. I would argue that the source code files and the audio that the user's computer generates from the source code have the same encoding-decoding relation that an MP3 file does to the audio that the user's computer generates from the MP3. The copyright holder of the MP3 file has copyright control of the decoded audio even if the user's computer does the decoding, so you should have copyright control of the audio directly generated by your code on the user's computer. If you put a certain license on the source code but don't explicitly specify a license for the audio files you generated for Spotify and Apple Music, then I think the permissions granted by the license will apply to the audio generated by the user's computer but not necessarily to the audio generated by your computer. You could explicitly grant permit certain actions to the source code and explicitly prohibit those actions to the audio files generated by the user's computer, with the caveat that fair use might make some of the prohibitions on the latter unenforceable due to the permissions on the former. Since you are the author of the source code files, you can make the generated audio files you put on Spotify have an identical or different license from the repository files. You can specify both the license for the repository files and the license for the generated audio files you put on Spotify anywhere, including in the repository readme.
> So if the code is MIT-licensed and generates the audio, what's the license on the audio? The repository doesn't contain audio files, but code that generates them. Can I add a license for those non-existing files in the repository? Unfortunately, all I have is more questions.
If you put the code under the MIT license then the license on the audio generated from the code by the user's computer is the user's choice, because the MIT license is a permissive open-source and free license. If you put the source code files under the MIT license then the user can do just about anything with the source code files and anything derived from them as long as the user follows the few requirements in the license (in the case of the MIT license, providing correct attribution, preserving the license notice, and minding the lack of a warranty). (Well, the user also has to obey trademarks and patents on the original files. The MIT license doesn't have a patent grant, while the Apache 2.0 license frees the user from the author's patents on the files.) "just about anything" includes releasing copies or derivatives for any purpose under any license (including proprietary ones) of the user's choosing. I think of it as: the user can wrap the user's copy of MIT-license code into any license that doesn't prohibit inclusion of MIT-license code, but cannot remove or change the license of the original code.
UPD: I see that it cannot load an mp3 file, net cache operation not supported. I reloaded / cleaned my cache, maybe you regenerated the sounds and I just had stale cache.
UPD2: Nope, still failing, ex: GET https://ambient.garden/vA/generated/audio/rdrone_2o3_2o3_7o6... net::ERR_CACHE_OPERATION_NOT_SUPPORTED
Seems to be specific to Chromium based browsers
Nice work!