|
-
Feb 17th, 2010, 03:28 PM
#1
Thread Starter
Fanatic Member
[RESOLVED] Generate a Frequency
Hi,
I'm hoping to create a form with a TrackBar control so that when you Scroll the TrackBar it generates a frequency based on the value of the TrackBar. Beep() isn't really what I'm after. I was wanting it to smoothly transition through the frequencies. Basically, I want to create something that sounds something like a Theremin.
I've been looking online, and I can't seem to find anything. I don't even know how this would be accomplished. Is there a simple command to say "play this frequency until I tell you otherwise", or do I need to generate a .wav on the fly and have the system play that?
Any help/ideas would be appreciated.
Thanks
VB.Net 2008
.Net Framework 2.0
"Must you breathe? 'Cause I need heaven..."
-
Feb 17th, 2010, 03:32 PM
#2
Re: Generate a Frequency
You're probably going to want to make audio files with the desired frequency. Though that wouldn't work well with a track bar.
There might be a way to play an audio file and have the track bar change the frequency while the clip is playing... but I'm going to guess that wouldn't be a very easy thing to do.
CodeBank contributions: Process Manager, Temp File Cleaner
 Originally Posted by SJWhiteley
"game trainer" is the same as calling the act of robbing a bank "wealth redistribution"....
-
Feb 17th, 2010, 05:48 PM
#3
Re: Generate a Frequency
I'd be looking for some freeware controls on the web. This very thing was possible on some early (1980's) computers, and I see no reason why it would not be accessible on modern systems. In fact, someone might make you one if you asked in the right tone, had a perfect pitch, were not too frequent, and didn't strike the wrong note.
On a more serious note: One place that I would look would be in DirectX. I believe there's an entire section devoted to sound (DirectSound??), which may give access to something useful for you. I've never played with it myself, but it might be worth a look.
My usual boring signature: Nothing
 
-
Feb 17th, 2010, 08:35 PM
#4
Re: Generate a Frequency
A google search found a tutorial that's a little old, but should help you get started on using DirectSound.
Edit: Why not just load a base WAV into memory and see if you can't adjust it's pitch?
-
Feb 22nd, 2010, 12:27 PM
#5
Thread Starter
Fanatic Member
Re: Generate a Frequency
You're probably going to want to make audio files with the desired frequency.
The desired frequency would be anything from about 0 to 2000. Creating 2000 different wavs, apart from being a pain, wouldn't be a very elegant solution.
In fact, someone might make you one if you asked in the right tone, had a perfect pitch, were not too frequent, and didn't strike the wrong note.
OK, that made me chuckle.
Why not just load a base WAV into memory and see if you can't adjust it's pitch?
Well, I mean, you could play this for an hour straight, if you wanted. So, I guess I'd have to loop a shorter clip. If I could loop a clip with no pop or anything, that would be fine. In fact, if I could adjust the pitch on a wav(and that's gotta be possible) that would greatly reduce my problems in creating the sound, as I could just sample a real theremin (or anything for that matter). That's not a bad idea...
VB.Net 2008
.Net Framework 2.0
"Must you breathe? 'Cause I need heaven..."
-
Feb 22nd, 2010, 12:46 PM
#6
Thread Starter
Fanatic Member
Re: Generate a Frequency
Thanks for all the suggestions. From that tutorial, it seems as though I could load a short clip and adjust its frequency. Unfortunately, I'm at work, so I can't mess with it right now. I'll mark this thread resolved as I now have a direction, but no specific problems/questions.
VB.Net 2008
.Net Framework 2.0
"Must you breathe? 'Cause I need heaven..."
-
Feb 22nd, 2010, 01:47 PM
#7
Addicted Member
Re: [RESOLVED] Generate a Frequency
You will want to use a single cycle waveform, not just your average short sound clip. I'm guessing you want a sine wave, but there are all sorts of waveshapes out there.
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
|