Sign in to follow this  
rocklobster

Playing audio (pitch manipulation)

Recommended Posts

Hi guys,

Currently, im in need of some code (similar to the Beep(freq, dur) function provided by windows. I need to basically play a note (possibly a piano key sound) provided a frequency and duration. I understand that there is directsound that i can use but i have not been able to find if i can get this functionality from it. I just need some way to be able to play a given frequency without that horrendous BEEP!!! sound, which also seems to pause your system while it is beeping.

If any of you could point me in the right direction i'td be much appreciated.

Regards,

Rocklobster

Share this post


Link to post
Share on other sites
Yes, DirectSound is capable of changing the frequency during playback.

You'd use a simple sine wave sound and adjust the frequency. Just make sure to create your IDirectSoundBuffer with the DSBCAPS_CTRLFREQUENCY caps flag set.


You can then change the frequency with a call to IDirectSoundBuffer:.SetFrequency

Share this post


Link to post
Share on other sites
Thanks for the info!

I've included Microsoft.DirectX.DirectSound into my project but i am not sure how to access [color="#1C2837"][size="2"]IDirectSoundBuffer.[/size][/color]
[color="#1C2837"] [/color]
[color="#1C2837"][size="2"]I should have also mentioned earlier that i am using c#.[/size][/color]
[color="#1C2837"] [/color]
[color="#1C2837"][size="2"]EDIT: I think i found it under private implementation details[/size][/color]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this