Working on a positional audio system. minor snag.

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • I'm trying to create a sort of audio 'map' based on where an object is related to another; It's alternating between the player_character active, and an invisible central node; Still trying to decide if it's better to do it from the character perspective of the player or the character.

    Distance from an object has an effect on pan and volume. This part I've got done and it works perfectly. My challenge is changing the pitch of a sound based on it's vertical (Y axis) position in the frame.

    Objects that emit sound positioned higher than the player would have a higher pitch and those positioned lower would have a lower pitch. As the player comes near to those objects the pitch would normalize and change appropriately as their relation to the player via positioning.

    I've got some idea of how-how to do it, I've got what I think is the math for raising the pitch. but not for lowering it.

    Here's an example of my event(s)

    Code
    [Always] Set frequency of [sample 'test.mp3'] to (y("emitter") -Y("Player"))/6

    This will raise the pitch as the emitter gets higher above the player, and it will normalize as they get closer. but the sample will immediately cut out once they get above it. I'm not sure what the math for that would be;

    Code
    +Y("Player"))*6

    Not sure on this one; doesn't seem to work.

    I plan to make the adjustment more subtle; I'm using /6 and *6 to make the changes more obvious during testing.

    Maybe there's another equation I could be using entirely?

    Edited 2 times, last by Alpha17x: Formatting (March 15, 2018 at 1:10 AM).

  • This is similar to an attempt I've made. It works, though it moves the pitch in the wrong direction; It will raise frequency when the player object is above the emitter.

    Another challenge I'm running into is that all of the math I've tried seem to cause a one step; hard change. I want the pitch to raise and lower gradually. I"m sure it'll be figured out eventually either by myself or someone else who's interested.

    Currently what happens is that the player above the emitter causes the frequency to raise, not gradually but like a hard switch was flipped. When the player is overlapping the emitter; the original default frequency comes into play. And when the player is below the emitter even slightly the sound entirely cuts out.


    So I'm wondering if perhaps the frequency changes should be done by a fastloop? or if there's some other approach. I couldn't find any examples of someone doing this and I'm an artist so while I can eventually get it. the math doesn't come to me as fast as it would for someone more programming oriented.

    Either way this is pretty fun trying to figure it out; Thanks for your reply

  • You're thinking too complex, lol. Please see the attached MFA and sample.

    I found that the default frequency of samples is 31954 by playing a sample and setting a counter to said samples frequency. This gave me my base number. We now know that when an object is lined up with the player that your sound frequency should "normalize" to 31954. This is what we base the formula around. Also - when setting a frequency in the expression editor it tells you that the default frequency is "0" - Minimum is 100 and max is 100,000. 0 and 31954 are the same thing.

    You should be able to figure out the rest from here. Here is the formula I used.

    Frequency = ( Y( "Player" ) - Y( "Sound Object" ) ) * 25 + 31954

    If this is too harsh OR the frequency doesn't change enough for you change 25 to a different number. A higher number will make it stronger and a lower number weaker.

    Please login to see this attachment.

  • I figured I was going to complex. I"ll check out your example.

    I got pretty close but my event sequence is needlessly complicated.

    Code
    Always set Alterable Value A
    ( YActionPoint( "emitter" ) * 24 ) + ( YActionPoint( "player" ) * 24 ) / 0.125

    Then I had the frequency always = to Alterable Value A.
    And the math was just me tossing things at the wall hoping they'd stick. Which they did with amusing results.

    Thanks!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!