Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Fading out a wav?

Status
Not open for further replies.

paulsv

Programmer
Jun 29, 2007
16
GB
My application is a game where I want to play some background music while a sequence is displayed. Ideally I want to fade out the music at the end of the sequence but I don't know how long the sequence will be. All the wav player components just start and stop the sound. Is there a component (or technique) which would allow me to do this?

Any help much appreciated

Paul
 
If the wave component doesn't support volume control, you could always try temporarily adjusting the system volume to fade out. Alternatively, find a wave component that does allow volume control.

Have a look here (first search result in google for delphi and volume). Your wave playing component should tell you how long the sequence is, and then just use a TTimer component to rapidly adjust the volume down steadily over 5 seconds or so.

Be sure to set the volume back to it's original level afterwards.
 
Thx for the reply. I haven't found a wav player yet with a volume control, and I was trying to avoid changing the system volume, although this might be the best thing as a last resort. Does anyone know of a component with volume control just for that Wav?
 
Be sure to set the volume back to it's original level afterwards.

This is the problem here, you would be adjusting the system volume. If something goes wrong the users system could be left with altered settings.

It might be better to add the fade to the wav file.
If you didn't record it yourself you can use an application such as Audacity to Add a fade (or any other effects you want).


Steve [The sane]: Delphi a feersum engin indeed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top