How would I go about panning audio in Construct 3.

0 favourites
  • 5 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • Hello everyone, I'd like to have positioned audio that is also played at different heights above the layout, similar how the height of the listener object can be changed. Only issue is, this doesn't appear to be possible, so I was thinking of implementing my own volume/panning system.

    I know that in Construct 2 audio panning wasn't possible, is this still the case in Construct 3?

    Many thanks.

    Tagged:

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I don’t think the audio plug-in has been updated with 3d in mind. You could make a feature request to give a z height to the positioned audio since webaudio already has that available, construct just doesn’t use it.

    A second option would be to calculate the volume from the 3d distance to the listener and the falloff equation. It’s mostly just busywork to workout the formula.

    A third option would be to use JavaScript instead to do the audio plugin. There are various libraries that could work or if you could use webaudio directly.

  • Ah, that's unfortunate. At the moment I'm doing your second suggestion of calculating the 3d distance. I'm playing at an object which is offset from the location the sound is at to have the correct vertical panning (audio doesnt just pan left and right in Construct, up and down as well no?), and also to keep the horizontal panning, and calculating the volume from there.

    My knowledge of JS is limited, and to be honest I'm not sure how to even convert stuff I write in JS into Construct. Custom plugins maybe? I haven't done it enough to know where to start.

    I'll look around for tutorials later, seems like it'd be quite helpful for overcoming many limitations of the engine.

    Thank you!

  • I mean there are only two speakers so the volume is balanced between those two for any direction. Option two seemed simpler when I wrote it. I tend to try that a lot. When construct doesn't have a feature I try to calculate it manually and then somehow work that in to the available features.

    You can probably get some basic overview on how to use JavaScript in construct with a few of the tutorials available. There are lots of ways and none of them seem very clean to me. Anyways, the meat of using the webaudio api to do the audio is to setup a node graph. Rough overview of how it would look is this:

    source1->gain->position--+
    source2->gain->position--+->listener->gain->output
    source3->gain->position--+

    Basically any sound you want to play would need to be added to the graph with a gain node. Then they could be removed as they finish. Of course the nuance of implementing it will look more verbose.

    Anyways, ideally the solution would be simple or added so it can be simple. These solutions are paths to work toward a solution without having to wait on the devs.

  • When I said up and down I meant like 8d audio, which I checked and Construct 2 does support.

    My system for detection seems to be working without the need for JavaScript, thankfully. Audio is played at an invisible Sprite's position, and tags, loops, duration etc. is stored in an array. When audio ends the corresponding invisible sprite is deleted and the audio is removed from the array. This is mostly tag independent, which weirdly enough might allow for multiple "tags" per audio. I'm surprised that isn't a feature yet either.

    The system also has easing features for volume so its really easy to fade stuff in and out seamlessly, even if a new ease is called while a tag is currently easing.

    In any case, the issue is solved. Thanks for your advice, I might look into making a custom audio plugin in the future.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)