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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I do this using the DX9 SDK? 1

Status
Not open for further replies.

nzmike99

Programmer
Apr 1, 2003
8
Hi,

I'm trying to write (or find) an application library which I can call from .Net web pages to take an uploaded MP3, extract the first 40 seconds from it and (most importantly) fade the volume out over the final 10 seconds.

It's for a music site I'm working on where artists upload there own music - we want to make samples for buying customers to listen to and we really want to have a nice fade as I mentioned above so the sample doesn't abruptly end.

Will the DirectX9 SDK do this? If not, does anyone know how I can do this or know of a DLL or OCX that will do this?

Also, what frame/method/object is the volume for each frame in? Is a fade-out possible? (I assume it is.)

If I have to write sometihng I'd prefer to use C# or VB.Net but even some C++ example code might get me started as well.

Any help would be appreciated - I just can't seem to find an entry point into the little project!

TIA for any help,

Mike
 
as for the fade out :

you could use IDirectMusicAudioPath8::SetVolume
which is declared in dmusici.h
or IDirectSoundBuffer8::SetVolume
which is declared in dsound.h.

see
and

i suggest you you GetVolume first and then do something like : [pseudocode]

Code:
play sound;
while(time < 30 sec)
    {don't change volume}

// now we've reached the final ten seconds
// decrease volume every 1/10 of a second by
// 1/100 of original volume


while(sound is playing)
{
start TimeCounter(milliseconds);
if ((TimeCounter % 10) == 0)
    SetVolume(CurrentVolume - (OriginalVolume/100));
}

this is obviously a linear fade out, but you can change the algorithm if you wish to receive exp.-curves.
 
Thanks for that - we ended up writing a Flash MP£ player that does the fade for us but I might just check out your links and code etc and see what I can come up with.

Cheers,

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top