Playing audio (pitch manipulation)

Started by
1 comment, last by rocklobster 12 years, 6 months ago
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
Advertisement
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

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

Thanks for the info!

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

This topic is closed to new replies.

Advertisement