|
-
Mar 16th, 2002, 05:20 PM
#1
Thread Starter
Lively Member
Frequency Generator
Hey guys
I want to create a simple program to generate a sound frequency to play through my speakers. I would ideally like to be able to be able to generate a different frequency in each speaker ie 3Khz in right speaker and 3Khz in left speaker. So my question is what is teh easiest and fastest way of doign this.
Peter
"Let's all join forces, rule with an iron hand...and prove to all the world, metal rules the land..."
-- Judas Priest
My email is [email protected]
-
Mar 16th, 2002, 05:24 PM
#2
Monday Morning Lunatic
3khz and 3khz are the same, just thought I'd mention that 
First, you need to decide what waveform you're going to use - you can have sine (i.e. use sin() to calculate the amplitude), square (jump between the maximum and minimum values after waiting a certain period, for example 10ms, at each value.
Then there's sawtooth where you cycle from minimum to maximum then drop, and triangle which is linear up/down (like sine, but sharp at each end and always straight lines).
Right, that's the waveforms out of the way...
If you look up the wave* functions in MSDN you'll find how to create and play a sound buffer. From there it's a simple matter of generating the contents (note, once you've created the waveform buffer it's easy because you just keep cycling the same buffer ).
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Mar 16th, 2002, 05:27 PM
#3
Thread Starter
Lively Member
Cheers
I ment 3Khz and 5khz, something dirrerent to each speaker basically is this possible in teh same way.
Peter
"Let's all join forces, rule with an iron hand...and prove to all the world, metal rules the land..."
-- Judas Priest
My email is [email protected]
-
Mar 16th, 2002, 05:28 PM
#4
Monday Morning Lunatic
Yes. You just need to calculate different values for each channel, but it's still the same functions to play it.
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|