views:

124

answers:

2

I've built a simple music player in Delphi which plays one track after another.

Now there should be some kind of "pseudo crossfading" in the player. This means that a track should be faded out at its end and the new track (which starts then) should be faded in.

This way I want to avoid those unaesthetic track changes with abrupt crossings.

How could I implement such a fading technique in Delphi?

Should I change the wave volume in the last seconds of the first track and in the first seconds of the next track?

+1  A: 

No, what you've got there looks like it changes the system's Wave Out volume, and messing with the user's settings is a very bad idea. You've got the right general concept, though. You want to change the wave volume of your program's output, fading it down to zero and then starting the new one from zero and gradually fading in.

Mason Wheeler
+4  A: 

I've done a lot of multi-media work using the excellent BASS libraries. There are Delphi wrappers for them.

BASS uses the concepts of channels, and you can mix multiple channels into a target channel.
On each channel, you can set options like volume.
There are even effects channels where you can for instance influence the playback speed.

Highly recommended when you want to do more advanced things than 'just playback'.

BASS supports both DirectX Audio, as well as low-latencey ASIO audio (which is used by DJ software like Traktor)

--jeroen

Jeroen Pluimers