Page 1 of 1

Fading out an audio clip

Posted: Thu Feb 19, 2015 5:31 am
by timbrian
Developing a program with LiveCode 7 that has soundboard component where I can queue commercial spots. I can get the audio clips to play and stop, but
I want to also use a fade out control. I have looked high and low but can not find a sample script or any how to's.
I am developing the app for OS X . Just need to be pointed in the right direction. I am using the play audio clip ID xxxx command and play stop command.

Re: Fading out an audio clip

Posted: Thu Feb 19, 2015 5:45 am
by Simon
Hi timbrian,
How about this

Code: Select all

   repeat with x = 100 down to 0
        set the playLoudness to x
   end repeat
Simon

Re: Fading out an audio clip

Posted: Sun Feb 22, 2015 12:29 am
by Klaus
Hi Tim,

1. welcome to the forum! :D

2. To actually hear the fade-out you should add a little wait statement.
Without, well, it will sound like the sound got switched off immediately :D

Code: Select all

   repeat with x = 100 down to 0
        set the playLoudness to x
        wait 2 millisecs with messages
       ## play with the millisecs value
   end repeat
Or use something like this:

Code: Select all

## fade out in 1 second:
   repeat with x = 100 down to 0 STEP 10
        set the playLoudness to x
        wait 100 millisecs with messages
   end repeat
Best

Klaus

Re: Fading out an audio clip

Posted: Sun Feb 22, 2015 9:38 pm
by timbrian
Thanks Simon and Klaus for the help. That did the job!