Hi! When you make an audio playList with aud module, you may want to use fade functions from Blender API:
http://www.blender.org/api/blender_python_api_2_74_5/aud.html?highlight=fadein
fadein function is easy to use because we know that we want to apply a fade effect at the beginning of the song. So the start time of fadein is 0.
But when you want to apply a fade effect to the end of the song, you have to tell the fadeout function the moment the fade effect must begin. So you have to know the song duration. As far I know, it’s impossible with aud module. But I found a nice library in one .py file (so you can easily pack it into your .blend): tinytag
With this module, you can easily find the duration of a song:
from tinytag import TinyTag
song = TinyTag.get(songPath)
songDuration = song.duration
So now, you can use fadeout function:
import aud
device = aud.device()
fac = aud.Factory(songPath)
fac = fac.fadein(0, 5) # Fade effect at the beginning of the song, 5 seconds length
fac = fac.fadeout(songDuration-5, 5) # Fade effect at the end of the song, 5 seconds length
device.play(fac) # play the song!
(In my example, 2/3 songs are already “faded out” :o, but it’s just for example)
Maybe someone knows an easier way to do that, but I share the tip nevertheless…