×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Can I do this using the DX9 SDK?

Can I do this using the DX9 SDK?

Can I do this using the DX9 SDK?

(OP)
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

RE: Can I do this using the DX9 SDK?

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
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/htm/idirectmusicaudiopath8setvolume.asp
and
http://msdn.microsoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/htm/idirectsoundbuffer8setvolume.asp

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.

RE: Can I do this using the DX9 SDK?

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close