Audio input
I'm interested in trying to make a game similar to guitar hero, but using an electric violin connected to line-in. The stave would scroll along the screen and you play the notes as you normally would. The game would rate your pitch and timing. I'm currently learning to play (2 weeks in) and think this would be a great learning tool, as it would indicate whether you had your fingers in the right place for pitch and train tempo awareness.
I don't know anything about audio programming at the moment, so I'm looking for pointers to tutorials and general information. I'll start off small, making a tuner for a specific string, then expand so that it identifies any note you are playing.
I've done a quick search for capturing audio, and there are a few apis that handle audio input. I'm going to want a GUI, so was going to go with DirectX. Is DirectX's audio library up to the job, or would you recommend using another api?
http://www.codeproject.com/KB/audio-video/Asio_Net.aspx has information on ASIO, but my sound card doesn't support it. There is a link to a driver which is supposedly compatible with most sound cards to provide ASIO support. Is it worth doing this for the lower latency, or is DirectInput (or another of your suggestion) good enough to do this task?
I've also read up a little on Fast Fourier Transforms, which I understand I would need to use to obtain the frequencies being played. Can anyone recommend an FFT algorithm that is fast enough and accurate enough to do what I want?
What difficulties am I likely to face in the first parts of development? Are FFT algorithms fast enough to do this real time? Will I have difficulty analysing the frequency curve? Anything else.
Thanks for any help.
If you know the actual frequencies you want to detect, there are simplier algorithms.
The simpliest algorithm that I could explain over a post, is to simply fill an array with the period you want to detect. Then you compute the running average of the multiple samples associated to the same phase. If an input of the frequency you want to detect exists, then your array would have the pattern of two consecutive sections of positive numbers and negative numbers.
If your tones are clear, only need about 4 cycles of the wave to detect the wave. So for a 440Hz A tone, you could detect it within 10 ms (algorithm wise).
You could search for the Goertzel algorithm as in [wiki]
The simpliest algorithm that I could explain over a post, is to simply fill an array with the period you want to detect. Then you compute the running average of the multiple samples associated to the same phase. If an input of the frequency you want to detect exists, then your array would have the pattern of two consecutive sections of positive numbers and negative numbers.
If your tones are clear, only need about 4 cycles of the wave to detect the wave. So for a 440Hz A tone, you could detect it within 10 ms (algorithm wise).
You could search for the Goertzel algorithm as in [wiki]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement