5 ms·
Show HN: An algorithmic audio landscape
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 https://github.com/pac-dev/AmbientGardenAlbum
- deleted 3y ago[deleted]
- ani-ani 3y agoOK, the "everything is made of a million dots" rendering style is pretty neat. I don't think I've seen its kind before. I also like that it somehow ran perfectly on my phone. IMO interactive in-world music peaked with Portal 2, the effort put into that was impressive.
- pierrec 3y agoI think I agree on Portal 2! Honestly, the rendering style may have been an unnecessary challenge. It was way harder to implement than I thought and caused me to almost abandon the whole thing.
- dylan604 3y agoisn't the "everything is made of dots" the definition of pointillism?
- MattRix 3y agowell it’s definitely inspired by pointillism, but they’re doing things like scaling the dots based on depth etc
- memalign 3y agoThis is really cool. The music and world (especially the mysterious structure in the distance) remind me of the eeriness of Myst. Can you share more info about how you built the 3D world made of dots?
- pierrec 3y agoThanks! It was honestly kind of a dark path. The graphics are based on Three.js (which is awesome), and I initially rendered everything with a rarely-used WebGL/OpenGL feature called GL_POINTS, which seemed like a smart way of doing an impressionist style. Three.js exposes it like this: https://threejs.org/docs/#api/en/objects/Points https://threejs.org/docs/#api/en/objects/Points 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/versioned/js/gfx/nearMaterial.js https://github.com/pac-dev/AmbientGarden/blob/master/Web/ver...
- deathbob 3y agoI don’t bother to log in and vote often, but this is such a cool idea AND so well executed. Fantastically well done. Thanks for sharing
- LinearArray 3y agoThis looks really awesome. Great work!
- iamcreasy 3y agoThe procedurally generated audio is really cool, and it feels similar to Cocoon's background music. Do you know of any Python library that lends itself well to experiment with procedural audio generation?
- hecanjog 3y agoPyo is a good one: http://ajaxsoundstudio.com/pyodoc/ http://ajaxsoundstudio.com/pyodoc/
- hermitcrab 3y agoNice work. I particularly like the vocal sounds.
- theharshpat 3y agoIt's so cool. It doesn't work on chrome&brave browsers' latest versions on apple silicon M3 Pro. It works smoothly on Safari though.
- pierrec 3y agoInteresting, if anyone can reproduce the problem on Chrome+Apple Silicon, I would appreciate if you open an issue and include the browser console output on https://github.com/pac-dev/AmbientGarden https://github.com/pac-dev/AmbientGarden
- Gys 3y agoI do not hear any music on an iphone 15. Tried Firefox and Safari.
- basil-rash 3y agoIs your hardware mute switch enabled?
- Gys 3y agoThat was the problem, thanks :) So I learned something today: apps like Spotify will play regardless of the hardware mute. But a browser clearly mutes.
- basil-rash 3y agoYes, the AVAudioSession.Category parameter defaults to “soloAmbient”, signifying the sound playback is non primary and nonmixable. This pauses all other audio, respects the mute switch, and pauses on lock. 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/avaudiosession/category/1616509-playback https://developer.apple.com/documentation/avfaudio/avaudiose...
- pierrec 3y agoI don't have the real device but I tested it on Safari on iPhone 15 using BrowserStack and it seemed to work.
- natebc 3y agoi didn't get music with Firefox on Windows either. Will keep trying though. 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.
- hecanjog 3y agoI love it. I tried the new Zelda game during lockdown and wandering around as the music changes is really fun to do. 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 https://audiomasher.org/learn
- pierrec 3y agoSporth is the most fun I've had programming audio. The Forth-like syntax is perfect for building audio graphs in a way that's simple and terse. It was also like a "gateway drug" to go from programming synths/effects to programming actual music. I ended up not using it for this project, just JS+Faust, partly because I wanted to get more familiar with Faust.
- famahar 3y agoExtremely impressive and really inspiring. I'm actually working on something similar but in Unity3D. Would love to get your feedback. It's way more hand crafted and curated compared to yours but I'd like to explore generative aspects like you have. The garden sounds really organic, very similar feeling to Deep Listening by sound artist Pauline Oliveros.
- pierrec 3y agoSure, my email is on my website which is in my profile. I will gladly check out other project/works-in-progress in this genre.
- cubefox 3y agoI also like the impressionist art style, never saw something like that before. But it runs with very low frame rates even on a Snapdragon 8+ Gen 1, which has a fairly beefy GPU for a phone. It performs a bit better in Firefox than in Chrome on Android 14.
- pierrec 3y agoYeah, I'm not sure beefiness is the actual problem, I tested it on a phone with a Snapdragon 855, which is supposed to be slower than yours in every respect, and it ran smoothly enough. I guess that's why real gamedevs spend a lot on device testing.
- cubefox 3y agoIt actually performs fine if I limit the screen to 60 Hz in the Android settings. Apparently the frame rate gets lower the higher the Hz setting for the screen. On 144 Hz it basically stops. There is also some crackling noise after a while, but that might be unrelated.
- hn_acker 3y agoWhat's the copyright license on the files? 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.
- pierrec 3y agoIt's an interesting question. The original website actually ran the music generation code straight in the browser with no samples used at all, but it was a bit CPU-intensive. You can still access that version at https://ambient.garden/edit https://ambient.garden/edit So my first question would be, if someone records the output of that version, how does licensing work on that recording? Their browser is generating the audio. 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.
- araes 3y agoFrom that, I take it the code was meant to be MIT-licensed? For example, I found the https://ambient.garden/patches/ 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).
- sletz1 3y agoImpressive ! Just added on the https://faust.grame.fr/community/powered-by-faust/ https://faust.grame.fr/community/powered-by-faust/ page.
- MutableLambda 3y agoGreat work! Why does autopilot stop around 12 min mark? 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_loop.mp3 https://ambient.garden/vA/generated/audio/rdrone_2o3_2o3_7o6... net::ERR_CACHE_OPERATION_NOT_SUPPORTED Seems to be specific to Chromium based browsers
- btbuildem 3y agoVery cool! I like how the various sources blend well together, regardless of where you go. Nice work!
- orlarey 3y agoThanks for sharing this impressive work and all the codes. I'm listening to Ambient Garden right now, it is perfect for coding! And as I'm working on the Faust compiler itself, the recursiveness of the situation is quite ... interesting ;-)
- garyiskidding 3y agoAmazing idea and execution. Thank you for sharing.
- throwaway290 3y agoI spent a while trying to hear objects positioned in space, so that if the drone is to my left then I hear it from the left... but I guess it doesn't work like that, the position just affects the amplitude. Still very neat, of course.
- pierrec 3y agoYou are completely right, I never got around to implementing panning (or more advanced spatialization), which should be kind of a no-brainer for a project like this. The more I worked on it, the less I noticed this feature was missing! I'd like to add some subtle panning at some point.
- po__studio 3y agoVery cool. Great work!