home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / sci / electron / 18681 < prev    next >
Encoding:
Internet Message Format  |  1992-11-10  |  2.6 KB

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