LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help to embed dial tones into keypad

Hi,
I am trying to embed 12 pre-recorded dial tones in my subVI so that when I press a number on the keypad, the corresponding dial tone will be sent to the next subVI.

What I am doing is detect dial tones. With two keypads side by side, when one key is pressed on the first keypad, the corresponding LED on the other keypad lights up.
I figured out how to detect the tones but am having a hard time figuring out how to embed the data files and associate them.

Thanks in advance.
0 Kudos
Message 1 of 12
(3,913 Views)
Well, that's kind of hard to say from your attachment, as your files have no extensions, and your VI has no code.
In general, you can read from files using the VIs in the file I/O palette and then do the rest in LV. If you're using wave files, there is a VI for reading wave files (Graphics & Sound palette). Your "embedding" could be done, for example, by putting the data into an array and then taking it out at the appropiate moment.
The question should be, maybe, why pass and recognize a tone? Why not just pass which key was pressed? You could make a cluster from your buttons and detect which key was pressed. How much experience do you have with LV?

If this didn't help, add more details about this: what's the format of the sound, why you need to detect the tone and so on (and some working code).

___________________
Try to take over the world!
Message 2 of 12
(3,894 Views)
It is not entirely clear what you want to do, but have you looked at the example "Sim Phone.vi" (search for "phone" in the example browser of LabVIEW).
0 Kudos
Message 3 of 12
(3,892 Views)
OK, the data files seem to be SGL(big endian) binary files. The attached simple example (LV7.0) shows one way to send them to a sound card as a function of the key pressed. I'm sure you can take it from here and adapt it for your purpose. Let us know if you get stuck. 🙂

(Make sure the VI and the data files are in the same folder before running. If you wand the raw SGL sound data, get it right after the typecast function)
Message 4 of 12
(3,887 Views)
Wow, you guys are so helpful: what took me a week to TRY to figure out, your guys did it in a matter of hours. Yeah, it looks this is what I need and I am sure I can take over from here.
If not, I am sure I can count on you guys again when I get stuck.
Thanks.

Yifan
0 Kudos
Message 5 of 12
(3,881 Views)
Wait a second, I think tst was right.
Excuse me for not explaining my goal too well.
I need to be able to pass on the raw data when a key is pressed and then identify which key sounded (this is the detection part). An LED flashes for that key.
Reason why I think it should work is each dial tone has a different duration. All I need to do is figure out durations of the dial tones and add them to a case structure.

No, I really don't have much experience in LV so I took on a job bigger than I can handle.

I am attaching my non-working code with altenbach's VI.
Hopefully you guys can help me figure it out.
0 Kudos
Message 6 of 12
(3,879 Views)
(Sorry, you probably noticed the small scaling mistake in my VI. the diagram constant that is currently 255 should be 127.)

I believe that the "frequencies" of each sound is most characteristic, not the duration!
Message 7 of 12
(3,871 Views)
altenbach, I know what you mean and you are right. But the goal is to simply detect the correct dial tone. Since the durations are unique, that is the easiest way for ME to approach it.
No, with my little exposure to LV, I didn't notice any abnormality in your VI.
Looking at my incomplete diagram, do you think it is an easy upgrade from what you made earlier to do what I need to do?
Thanks.
0 Kudos
Message 8 of 12
(3,869 Views)
OK, here's a simple version that detects the two main frequencies in each tone. Since we don't know the time units, all frequencies are of course relative. This should work will all similar dial tones as long as they are sampled at the same rate. I would definitely not use the duration. For simplicity, I use a 2D boolean array as output.

Basically, it takes the power spectrum and then finds the peak in each subrange. Notice that the each row and each column has a unique frequency and the combination of the two gives the correct button. (If you want to get fancy, you need to know the true sampling rate. In this case you can get the real frequencies in Hz by wiring dt to the "auto power spectrum.vi", and wire the df to the "power & frequency estimate vi" to get the true frequency.)
0 Kudos
Message 9 of 12
(3,855 Views)
Thanks so much, altenbach.
It works flawlessly.
As my skills get better, hopefully I can add more features to this.

This is actually part of a project I am helping my classmate on.
The project is to remotely control an object (i.e. a toy car) using two cellphones.
Since inputs are confined to just the keypad, using different combinations of keys can issue different commands to the remotely controlled object.

Do you have any suggestion what kind of microchip he should use to interface with his stepper motor on the toy car?
He's college student so doesn't have a big budget so buy fancy stuff.
What can he do to afford ($100 ~ 300) some micro-controller and interface cards that work with LV?

Anyway, thanks in advance for your input and suggestion.

Yifan
0 Kudos
Message 10 of 12
(3,852 Views)