Media_FadeSound ( container ; startTime ; endTime ; level ; inOrOut )
Media_FadeSound will apply a fade in or out to a specific portion of a sound file.
Parameter | Description |
---|---|
container | Location of the sound file. |
startTime | Time in original sound to begin fade (HH:MM:SS.S). | endTime | Time in original sound to end fade (HH:MM:SS.S). | level | Final fade level (1 = full sound at start; 0 = no sound at start). | inOrOut | 1 = fade out; 0 = fade in. |
The result must be returned to a container field.
You can use negative values in both the startTime and endTime parameters to refer to a position from the end of the file. For instance, when startTime is 00:00:00 and endTime is -00:00:00, the entire sound is referenced. To reference the last five seconds for example, use startTime = -00:00:05 and endTime = -00:00:00.
If startTime is invalid, it is set to 00:00:00. If endTime is invalid, it is set to the end of the sound. Level is reset to 0 for fade out and 1.0 for fade in.
Use Media_GetLastError to get possible error of this function.
Examples
To have a sound fade out beginning at 5 seconds and finishing within 10 seconds:
Set Field [ MyTable::Sound Result ;
Media_FadeSound (
MyTable::Original Sound ;
"00:00:05" ;# start at
"00:00:10" ;# end at
1 ;# 1 = start w/full volume
1 # 1 = fade out
) ]
To begin fade out 5 seconds from the end of the sound clip:
Set Field [ MyTable::Sound Result ;
Media_FadeSound (
MyTable::Original Sound ;
"-00:00:05" ;# from end
"-00:00:00" ;# = end
1 ;# 1 = start w/full volume
1 # 1 = fade out
) ]
To fade in for the first 3 seconds of a sound clip:
Set Field [ MyTable::Sound Result ;
Media_FadeSound (
MyTable::Original Sound ;
"00:00:00" ;# from start
"00:00:03" ;# end fade at
0 ;# 0 = start w/no volume
0 # 0 = fade in
) ]