Shop OBEX P1 Docs P2 Docs Learn Events
Question About Synthesizing Frequencies — Parallax Forums

Question About Synthesizing Frequencies

lardomlardom Posts: 1,659
edited 2020-09-02 16:06 in Propeller 1
I was trying to think of ways that a multiple, or a fraction, of a sine wave could be generated digitally. Let's say I wanted to generate a 100Hz sine wave from a 1KHz sine wave. If the 1KHz sine wave was sampled every millisecond, the output would be a DC equivalent related to the duty cycle. If, on the other hand, every sample period was incrementally advanced 36° couldn't you plot the equivalent of a 100Hz sine wave?
Is there a way to increment the sample-period with counters?
EDIT: The DC voltage would be related to the phase.

Comments

  • kwinnkwinn Posts: 8,697
    Not quite sure what you're asking/trying to accomplish, but if you sampled and stored the data for a sine wave of frequency A you could use that data to generate a sine wave of any frequency provided the data could be output at the required rate. For example if you could sample the 1KHz sine wave every 10uS and store 100 samples in an array you could then output that data to a dac every 100uS and produce a 100Hz sine wave.
  • @Kwinn, that's exactly what I wanted to know. Thank you. I don't have a specific project in mind. Occasionally I think of things that might require the ability to vary a frequency. There are other projects I want to get to first but now I want to tinker with a dac.
  • JonnyMacJonnyMac Posts: 9,102
    edited 2020-09-02 23:35
    Maybe I'm missing something, but there is a sine table built into the P1 with which you could create sines of any frequency without having to do an external sample. In a client project I used a fast SPI DAC to convert WAV data to audio. Only mono was needed and the DAC had two sides, so the output of one fed the reference input of the other -- this became the volume control. I didn't create this trick, but I sure took advantage of it.
  • JonnyMac wrote: »
    Maybe I'm missing something, but there is a sine table built into the P1 with which you could create sines of any frequency without having to do an external sample. In a client project I used a fast SPI DAC to convert WAV data to audio. Only mono was needed and the DAC had two sides, so the output of one fed the reference input of the other -- this became the volume control. I didn't create this trick, but I sure took advantage of it.

    :smiley: Thank you!
Sign In or Register to comment.