home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!noc.near.net!hri.com!spool.mu.edu!caen!zaphod.mps.ohio-state.edu!darwin.sura.net!dtix!oasys!curt
- From: curt@oasys.dt.navy.mil (Curt Welch)
- Newsgroups: sci.electronics
- Subject: Re: Software for touchtone generation; will it work?
- Message-ID: <27387@oasys.dt.navy.mil>
- Date: 10 Nov 92 18:51:45 GMT
- References: <921110124732.2381ce70@CCSUA.CTSTATEU.EDU>
- Reply-To: curt@oasys.dt.navy.mil (Curt Welch)
- Organization: Carderock Division, NSWC, Bethesda, MD
- Lines: 43
-
- In sci.electronics, FELSON_ADJ@CCSUA.CTSTATEU.EDU writes:
- >Can a squarewave output be used to reliable generate
- >touch tones? I'm planning on writing some machine code
- >software for an HP48 calculator that would do the following:
- > scan two sine wave tables ( or use two pointers into a single table )
- > add the two together, and turn the speaker on whenever the sine
- > is positive.
- >
- >This would be basically a cliped version of the dual done MTMF signal.
- >Anyone know if this will be too distorted for the phone company to accept?
-
- I don't know, but I would guess that it would be too un-reliable to be
- useable. How fast can you turn the speaker output on and off? If you
- can do it fast enough, then you can try to use pulse density modulation
- to get better results. For each sine wave value, turn the speaker on
- and off multiple times. The total amount of on to off time should be
- proportional to the value you are trying to produce.
-
- Or here's an algorithm you might try. I just though it up, so I have
- no idea if it will work. As you generate each on/off output, keep a
- running sum of the output value. Add 1 to the sum if the speaker is
- "on" and subtract 1 if the speaker is off. Also keep a running sum of
- the desired sine wave value. Decide which value to output next by
- comparing the output sum to the desired sine wave sum. If the output
- is greater than the desired sum, then turn the speaker off, if the sum
- is less than the desired value, then turn the speaker on.
-
- The value you add to the speaker sum (1 in the above example) should be
- larger than (or equal to) the maximum sine wave value. So if the sine
- wave sum is sin(f1) + sin(f2), then divide it by two or add and
- subtract 2 from the output sum instead of 1.
-
- This I think will give you better results than the on-if-positive off-
- if-negative algorithm. It makes the area under the square wave curve
- approximate the area under the desired sine wave curve.
-
- The faster you can turn the speaker on and off the better it will work.
- If you can do it > 20K I would guess that you would get pretty good
- results.
-
- This is the basic technique used in 1 bit D to A converters.
-
- Curt Welch
-