The Daily Click ::. Forums ::. Klik Coding Help ::. Randomizing Samples
 

Post Reply  Post Oekaki 
 

Posted By Message

Jason Orme

Using Klik Products Since 1998

Registered
  24/05/2002
Points
  960

VIP Member360 OwnerWii OwnerAttention GetterThe Cake is a LieCardboard BoxHero of TimeI'm a Storm TrooperI'm on a BoatIt's-a me, Mario!
Sonic SpeedMushroomStrawberryI like Aliens!PS3 OwnerTurtle Power!I am an April Fool
24th November, 2009 at 18:26:36 -

How can I randomize a sample.

I.e a character slaps another and it plays slap.wav

But if I continue to do it, it plays the same sample everytime which can get alittle irritating after awhile.

So to avoid repetition, what is the best way to go about randomizing the sample played?

I'm aware of the set sample frequency option but it just doesn't seem practical and doesn't seem to work very well.

I've tried "every 0.0.50ms change the sample "slap.wave" frequency to x but it just doesn't seem to work.



 
www.jsofts.com

3kliksphilip

Addict

Registered
  20/11/2007
Points
  14900

VIP MemberGOTM - MAY 2009 - 2ND PLACE!The SpinsterGOTM -NOVEMBER 2009 - 2nd place!2021 Time Trial by Fire competition winnerChristmas Game Creator!
24th November, 2009 at 18:39:01 -

Make more than one sample, then you can make it choose one at random.

Instead of making the sample play, set Value A of [spare object] to 1+random(3).

[spare object]'s value A = 1, play sound 1, set A to 0
[spare object]'s value A = 2, play sound 2, set A to 0
[spare object]'s value A = 3, play sound 3, set A to 0

 
Don't aim for perfection- you'll miss the deadline

'~Tom~ says (16:41):
well why does the custom controls for the keyboard palyer even affect the menu controls at all whats thep oint jsutm ake it so for the keyboard palyer on the menu screens everything is always up down left right enter regardless of the controls they set'

-Mr Tom, 2010

Jason Orme

Using Klik Products Since 1998

Registered
  24/05/2002
Points
  960

VIP Member360 OwnerWii OwnerAttention GetterThe Cake is a LieCardboard BoxHero of TimeI'm a Storm TrooperI'm on a BoatIt's-a me, Mario!
Sonic SpeedMushroomStrawberryI like Aliens!PS3 OwnerTurtle Power!I am an April Fool
24th November, 2009 at 18:48:01 -

Fantastic, worked perfectly. Thanks.

 
www.jsofts.com

Dr. James MD

Addict

Registered
  08/12/2003
Points
  11941

First GOTW AwardSecond GOTW AwardThird GOTW AwardPicture Me This -Round 26- Winner!
24th November, 2009 at 20:15:20 -

If it's an impact it might benefit from changing the frequency too. If they're on their own channel just tell it to randomise the frequency of that channel, then play the sample.

 
Image
http://uk.youtube.com/watch?v=j--8iXVv2_U
On the sixth day God created Manchester
"You gotta get that sand out your vaj!" x13
www.bossbaddie.com
   

Post Reply



 



Advertisement

Worth A Click