playMaker

Author Topic: Play Sound Workaround Questions...[SOLVED]  (Read 6240 times)

HeathClose

  • Full Member
  • ***
  • Posts: 226
Play Sound Workaround Questions...[SOLVED]
« on: January 23, 2017, 01:24:16 PM »
Play Sound action is broken and the research throughout the site confirms that is has been for a while... sounds play at a very low volume... the threads that pose a workaround say to use an audio source and to set the clip and enable it... this works... however..

I need to be able to play a random sound...

I was using set clip on an audio source component and then during a win scenario, enable the component and it would fire off the sound at an acceptable volume... but there is no way to set an audio clip from a string... I have the array set up with the names of all the clips I want to randomize and then realized audio clip variables can't be set from a string variable...

is there a way to achieve this?

If not, can someone cook this up for me?
« Last Edit: February 13, 2017, 02:35:40 AM by jeanfabre »

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: Play Sound Workaround Questions...
« Reply #1 on: January 23, 2017, 02:02:49 PM »
you can have a hashtable filled with audio clips. the key names are strings

HeathClose

  • Full Member
  • ***
  • Posts: 226
Re: Play Sound Workaround Questions...
« Reply #2 on: January 23, 2017, 02:53:29 PM »
you can have a hashtable filled with audio clips. the key names are strings

aahhhhhh.... thank you.... so I've been playing with it... I can pull from a list of audio clips... or I can pull from a list of strings... but I can't seem to set a variable in set audio clip that uses either... how could I go from a hash table of audio clips or a hash table of strings and stick it in an audio source?  Or is there a better way?

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Play Sound Workaround Questions...
« Reply #3 on: January 23, 2017, 09:55:24 PM »
I attached two actions that I made that might be useful- one plays a random sound from an array and also randomizes the pitch- and another that randomizes the pitch on a single sound-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: Play Sound Workaround Questions...
« Reply #4 on: January 24, 2017, 04:50:06 AM »
mdotstrange's actions will be easier now, but you can have an object variable that fits anything, in this case set it to audio clip

HeathClose

  • Full Member
  • ***
  • Posts: 226
Re: Play Sound Workaround Questions...
« Reply #5 on: January 24, 2017, 10:19:19 AM »
mdotstrange's actions will be easier now, but you can have an object variable that fits anything, in this case set it to audio clip

Thank you for your help!

I attached two actions that I made that might be useful- one plays a random sound from an array and also randomizes the pitch- and another that randomizes the pitch on a single sound-

Mdot!!  Thank you man... that is EXACTLY what I needed... looks like you've been diving into coding?  Thanks again...

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Play Sound Workaround Questions...
« Reply #6 on: January 24, 2017, 11:31:51 AM »
No problem Heath  :)

I've really come to love coding even though I'm just a beginner- I've made a ton of Playmaker actions recently- I'll put them online/organize/share them soon as I'm sure some of them would be useful to others.

Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

HeathClose

  • Full Member
  • ***
  • Posts: 226
Re: Play Sound Workaround Questions...
« Reply #7 on: February 11, 2017, 10:02:21 PM »
No problem Heath  :)

I've really come to love coding even though I'm just a beginner- I've made a ton of Playmaker actions recently- I'll put them online/organize/share them soon as I'm sure some of them would be useful to others.
so I've been using the hell out of this... and just came up to a situation where I wish I could store the last audio clip it pulled from the array, so that there was a compare that could happen and choose a different one if it was about to repeat the last one..

for instance... i have a little guy who says things from about 6 audio clips.. and sometimes out sheer randomness he might repeat one of them like 3 times in a row...

Fat Pug Studio

  • Beta Group
  • Hero Member
  • *
  • Posts: 1294
    • Fat Pug Studio
Re: Play Sound Workaround Questions...
« Reply #8 on: February 12, 2017, 07:13:12 AM »
If you are using sounds extensively, i would recommend this asset: https://www.assetstore.unity3d.com/en/#!/content/5607

It's really a saver.
Available for Playmaker work

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Re: Play Sound Workaround Questions...
« Reply #9 on: February 12, 2017, 08:05:05 AM »
If you are using sounds extensively, i would recommend this asset: https://www.assetstore.unity3d.com/en/#!/content/5607

It's really a saver.

agreed

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Play Sound Workaround Questions...
« Reply #10 on: February 12, 2017, 09:19:06 AM »
Thats a good idea Heath- I can add that function to the action- will post again when I've updated it-
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Play Sound Workaround Questions...
« Reply #11 on: February 12, 2017, 06:40:14 PM »
If you store a variable in the "index" the sounds won't ever repeat- the action is attached
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!

HeathClose

  • Full Member
  • ***
  • Posts: 226
Re: Play Sound Workaround Questions...
« Reply #12 on: February 12, 2017, 07:41:21 PM »
If you store a variable in the "index" the sounds won't ever repeat- the action is attached

this is fantastic, thank you so much, I'll give it a go

HeathClose

  • Full Member
  • ***
  • Posts: 226
Re: Play Sound Workaround Questions...
« Reply #13 on: February 12, 2017, 08:09:17 PM »
This seems to be working perfectly, thank you so much mdot!

mdotstrange

  • Hero Member
  • *****
  • Posts: 555
    • Can't code? Who cares! Make games anyway!
Re: Play Sound Workaround Questions...
« Reply #14 on: February 12, 2017, 08:29:53 PM »
No prob  :) If you have ideas for stuff to add on my other actions just let me know.
Indie game dev and instructor at the Strange School. Learn Playmaker at the Strange School!