Shop OBEX P1 Docs P2 Docs Learn Events
Tone Decoding — Parallax Forums

Tone Decoding

GroundWireGroundWire Posts: 2
edited 2004-10-17 12:29 in BASIC Stamp
greetings guys!

I'm trying to figure out the best way to do some simple audio tone decoding.

I want to decode the audio of a fire dispatch.. Maybe you've heard them, maybe you haven't.

I'm really trying to avoid having a 567 (or another Phase Locked Loop of some sort) with component values setup to decode every single possible frequency.

The first problem I have to overcome is that I don't even know the exact frequency values of the tones, but I could probably get them by the time I'm ready to build this thing.

I'm wondering if there is a digital (more like analog) IC that will do some basic "frequency counting", and give me digital input that I can process from there? Failing that - what's the most efficient way to have 15-20 independant tone decoders wired to the stamp?? :/

Thanks!

- Joel

Comments

  • BeanBean Posts: 8,129
    edited 2004-10-16 11:58
    Do you know if the tones are a single frequency or are they like DTMF (which has two tones at the same time). If they are a single tone, you might get away with COUNT to measure the frequency.

    I remember that each tone is fairly long in duration.

    Terry
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-10-16 14:51
    If you can condition the audio input to a square-wave at TTL levels, you could use PULSIN to detect the tones. For a given frequency, the period is known -- if your input is a squre wave you can measure half the period. In general, I would take this approach:

    1. Wait for first tone
    2. Delay -- allow second tone to start
    3. Second tone detected? If no, go to 1
    4. Delay -- allow third tone to start
    5. Third tone detected? If no, go to 1
    6. Process alarm

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • GroundWireGroundWire Posts: 2
    edited 2004-10-16 17:13
    The tones are definately not DTMF - I've already seen example code for dealing with those, and I wouldn't want to waste your time with that question..

    Mr Williams: ok - Your idea seems sound (no pun intended), but I'm wondering if there are some examples of source code that already exist in a Nuts-n-Volts article or something. I'm not sure how I'm going to turn an audio signal (that just came through a headphone jack, so it's hot.. hot.. hot) - into a TTL level square wave. Know of any example schematics that I can modify to suite this application?

    Bean: The COUNT instructions definately looks like it'd work - in this area most fire tones are over a second in duration.. From there the number of "transitions" would roughly be my tone frequency.. and with a bit of calibration, it'd be able detect them just fine.. Am I correct? So the same question still applies though, how do I get something that just came through a speaker output, and off the secondary of a small audio transformer - into the Stamp without frying it??

    Thanks guys! I'm not trying to get you to design this for me.. I just have no idea what I'm doing in this particular instance.. and lots of others. [noparse]:)[/noparse]

    - Joel
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-10-17 01:54
    I'm not an audio guy ... so take this with a grain of salt. I'd probaby run the audio signal through a divider, then take the output of that through a Schmitt trigger to square it up. You might do a web search for additional ideas.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
  • Fe2o3FishFe2o3Fish Posts: 170
    edited 2004-10-17 07:39
    Jon,
    I believe that you wanna go the other way around -- audio into Schmitt trigger to bring the waveform into the digital domain and then run that Schmitt's output into a divider to get a nice....

    Nah, if it's a fairly pure tone then you'll be getting a decent digital wave that could be measured by the COUNT function. No real need to run it thru a divider to get 50% duty square wave, now is there?

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    -Rusty-
    --
    Rusty Haddock = KD4WLZ = rusty@fe2o3.lonestar.org
    **Out yonder in the Van Alstyne (TX) Metropolitan Area**
    Microsoft is to software what McDonalds is to gourmet cooking
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2004-10-17 12:29
    And if it is squre you can use PULSIN to determine the frequency. If it's not, two PULSIN lines, one for the high side, one for the low side. Once the period is know the frequency can be calculated.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
    Dallas Office
Sign In or Register to comment.