[HN Gopher] Show HN: An algorithmic audio landscape
___________________________________________________________________
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
Author : pierrec
Score : 109 points
Date : 2024-03-02 16:16 UTC (1 days ago)
(HTM) web link (ambient.garden)
(TXT) w3m dump (ambient.garden)
| ani-ani wrote:
| OK, 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 wrote:
| I 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.
| memalign wrote:
| This 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 wrote:
| Thanks! 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
|
| 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...
| deathbob wrote:
| I 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 wrote:
| This looks really awesome. Great work!
| iamcreasy wrote:
| The 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 wrote:
| Pyo is a good one: http://ajaxsoundstudio.com/pyodoc/
| theharshpat wrote:
| It'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 wrote:
| Interesting, 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
| Gys wrote:
| I do not hear any music on an iphone 15. Tried Firefox and
| Safari.
| basil-rash wrote:
| Is your hardware mute switch enabled?
| Gys wrote:
| That 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 wrote:
| Yes, 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/avaudios
| e...
| pierrec wrote:
| I don't have the real device but I tested it on Safari on
| iPhone 15 using BrowserStack and it seemed to work.
| natebc wrote:
| i 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 wrote:
| I 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
| pierrec wrote:
| Sporth 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 wrote:
| Extremely 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 wrote:
| Sure, my email is on my website which is in my profile. I will
| gladly check out other project/works-in-progress in this genre.
| hermitcrab wrote:
| Nice work. I particularly like the vocal sounds.
| cubefox wrote:
| I 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 wrote:
| Yeah, 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 wrote:
| It 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.
| pierrec wrote:
| Thanks. I just pushed a new version that throttles the FPS
| to 60. If you could test again on your device that would be
| great :D
| cubefox wrote:
| Cool, that fixed it. It works well now on higher Hz
| settings.
| hn_acker wrote:
| What'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 wrote:
| It'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 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 wrote:
| From that, I take it the code was meant to be MIT-licensed?
|
| 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).
| sletz1 wrote:
| Impressive ! Just added on the
| https://faust.grame.fr/community/powered-by-faust/ page.
| MutableLambda wrote:
| Great 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...
| net::ERR_CACHE_OPERATION_NOT_SUPPORTED
___________________________________________________________________
(page generated 2024-03-03 23:00 UTC)