Equip your Genius

Welcome to the Parallax Discussion Forums, sign-up to participate.

Question About Synthesizing Frequencies

Posts: 1,601
edited 2020-09-02 - 16:06:03
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

• Posts: 8,595
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.
• Posts: 1,601
@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.
• Posts: 6,939
edited 2020-09-02 - 23:35:07
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.
• Posts: 1,601
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.

Thank you!
Sign In or Register to comment.