I have a piece of hardware that stores an ID, this ID can be from 000 to 128. To find out what the ID has been set to, the hardware sounds out 3 tones through its internal speaker. What I am trying to do is write some software that would listen to these tones via a pc microphone and display the ID on the screen.
The hardware uses it's internal oscillator to produce these tones and the only information I know at the moment is -
(8861.5 / 4 = 2215) Tone for ID 0
(8861.5 / 5 = 1772) Tone for ID 1
(8861.5 / 6 = 1476) Tone for ID 2
(8861.5 / 7 = 1265) Tone for ID 3
(8861.5 / 8 = 1107) Tone for ID 4
(8861.5 / 9 = 984) Tone for ID 5
(8861.5 / 10 = 886) Tone for ID 6
(8861.5 / 11 = 805) Tone for ID 7
(8861.5 / 12 = 738) Tone for ID 8
(8861.5 / 13 = 681) Tone for ID 9
Each cycle of tone needs to be at least 16 cycles long
I have looked at CVMichael's code for DTMF Tone Recognition which is very advanced and would like to know if it could be modified to do something like this.
When I have this part working I would then like to sound the above tones out of the PC speaker. This way I could set the Hardware's ID.
I have been using VB for a few years now and still learning!, but never touched Directsound mainly serial communications stuff, so any help with this would be great.
Right now I'm at work (and I can't download anything, the proxy here blocks downloads), I don't know if I will have time after work, and I know for sure I won't have time tomorow. But I will most likely have enough time for this in the weekend, so expect a reply from me either later today or in the weekend...
Anyways... there are 4 ways that I can think of to detect a frequency, but I have to see the wave files to make a decision on what is the best way.
Here are in order of difficulty:
1) Calculate the time diference between the start of the impulse and end, (and maybe make an average on all the sound), then calculate what frequency it is by the time it took.
2) Use the code here: http://www.vbforums.com/showpost.php...6&postcount=18 posted by rm_03 to detect each of the 10 frequencies.
3) Use my Tone Recognition program to detect by pattern.
4) and last one: FFT (Fast Fourier Transform), but this is too difficult and too much work for something simple (like what you need)
Anyways... I'll check it out, and i'll get back to you.
You said that your hardware generates those tones, I just find it unusual that in each wave file, there is only one frequency ?
Or is that because you edited the files and separated the frequencies ?
I was expecting to see, for example if ID was 035, then I would expect the wave file to be something like this:
2215 Hz
1265 Hz
984 Hz
And probably there is a space in between the "beeps" and each been has a certain duration ?
Anyways, can you explaing how exactly is playin the sounds ? (what order, and durations maybe ?)
Or if you could record the actuall thing ?
Again.. I'm saying this because the wave files you posted, they all have only one frequency, from beginning to end of the file... (actually I did not look at all the files)
Sorry for the late reply, The attached tones were just samples of each frequency used to make up the ID, I didn't record them from the hardware, I generated them myself. They are however the exact frequencies that the unit produces for each part of it's ID.
You are exactly right with the tones & sequence, I will try and explain a little more. When I request the ID from the unit, I firstly sound two tones out of the PC speaker(a request I suppose), these tones are 16 cycles of (8861.5 / 3 = 2953hz) and then 16 cycles of (8861.5 / 30 = 295hz) no delay in between. That bit is the easy part...I think!. When the unit detects those two tones it replies by sounding out it's ID through its internal speaker like you stated for ID 035 but it could be any ID from 000 to 128 hence the attached tones 0 to 9 -
2215 Hz = 0
1265 Hz = 3
984 Hz = 5
There is about 0.5sec of silence/space between each tone, But if it helps, this silence/space could be changed to be another tone different from the one's used for the ID's.(I know the guy who wrote the units firmware!) This way the software would know that the next part of the ID is going to be sounded, if you know what I mean -
2215 Hz = 0
seperator tone
1265 Hz = 3
seperator tone
984 Hz = 5
The length of each individual ID tone is about 16 cycles long.
The way I see it is that if the software detected a 2215 hz tone it would display a 0 on the screen, 1265hz a 3 and a 5 for 984hz etc very very similar to your DTMF program.
I hope this helps a little more, I’m not the best at explaining things.
Thanks
Last edited by Adrian26; Mar 23rd, 2007 at 05:43 PM.
I'm still working on it... I was more buys than I expected. What I have until know it only recognizes one frequency at one time, I have to make it detect when the frequency changes, then detect the changed frequency.