Author Topic: Capture Joystick Analog Axis % and translate to sound?  (Read 1074 times)

Starblue7

  • Full Member
  • ***
  • Posts: 131
Capture Joystick Analog Axis % and translate to sound?
« on: March 06, 2023, 10:24:30 PM »
Looking to find a way to capture what % the joystick is at on the Y-Axis and then generate a sound within that percentage.

Better yet, as the joystick gets closer to the CENTER point of it's axis, have the sound player louder and or different pitch.
i.e. starting at 30% away from center, start playing sound and as moving closer to the center, the sound changes gradually.

The idea is for a no-look audio solution to know when you're at the center-point of the x-y axis of an analog joystick.

As you get closer to that point, the sound changes in volume or quality until you're at the point and you get some different confirmation sound.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4760
  • RTFM
Re: Capture Joystick Analog Axis % and translate to sound?
« Reply #1 on: March 06, 2023, 10:48:13 PM »
There are tokens to retrieve the current positional value of joystick axes.

Those could theoretically be combined with a loop, conditions, and the "Variable volume" option of the "Play a Sound" action to achieve what you're describing.

Starblue7

  • Full Member
  • ***
  • Posts: 131
Re: Capture Joystick Analog Axis % and translate to sound?
« Reply #2 on: March 06, 2023, 11:00:06 PM »
I think though, that it needs to be an event that is triggered and constantly polling the joystick in the background when the profile is loaded and while the profile it's running.

Would you be willing to advise and even share a snippet of an example command?

Thanks Muchos!

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4760
  • RTFM
Re: Capture Joystick Analog Axis % and translate to sound?
« Reply #3 on: March 06, 2023, 11:17:46 PM »
Polling the current value is what you'd use a loop for. There are no events for axis values changing.

You will need a fairly good understanding of VoiceAttack's more advanced features to put together this command.

Starblue7

  • Full Member
  • ***
  • Posts: 131
Re: Capture Joystick Analog Axis % and translate to sound?
« Reply #4 on: March 06, 2023, 11:25:07 PM »
Well, I've got it simply looping over a sound when the joystick y axis is within a certain range.
But looking to capture a bit more of a dynamic situation.
I suppose I can just set the command to run indefinitely and make multiple conditions for ranges within the y axis and change the volume for each range encountered.
It just seems kinda ugly to do it that way.

Was hoping for a few starter hints on the tokens you'd use to do it and to even change the volume levels based on that.

Anything you'd be willing to throw in to a response to get me started would be great.  thanks.