WeirdMatter
Member
// Teensy 3.6 on Windows 10
I'd like to read in a ~40 kHz sine wave and multiply each data point against a ~38 kHz square wave so that the lower resulting wave is in the audible range (~2 kHz).
I'm fairly new to the Teensy world, and I have been able to find the functionality to output a square wave, but I really need to generate one internally to mix with my input signal. Is there is a library/function that allows me to faithfully generate a square wave that I can multiply against my input?
I also thought that I might be able to use the loop() function to determine if ~13.2 microseconds has elapsed (half of the period of a ~38 kHz square wave) and use this determination to set the multiple value to either -1 or +1 to multiply against the input signal value. But I assume that I cannot rely on the precision of the loop execution to do this at set intervals. Is this assumption correct? If so, are there any simple libraries/functions that might help me do this?
This seems like such a simple process that I feel like I must be missing something staring me in the face, but I can't find anything on the forums or through my google-fu that helps me with this?
Is this process possible with the Teensy 3.6?
I'd like to read in a ~40 kHz sine wave and multiply each data point against a ~38 kHz square wave so that the lower resulting wave is in the audible range (~2 kHz).
I'm fairly new to the Teensy world, and I have been able to find the functionality to output a square wave, but I really need to generate one internally to mix with my input signal. Is there is a library/function that allows me to faithfully generate a square wave that I can multiply against my input?
I also thought that I might be able to use the loop() function to determine if ~13.2 microseconds has elapsed (half of the period of a ~38 kHz square wave) and use this determination to set the multiple value to either -1 or +1 to multiply against the input signal value. But I assume that I cannot rely on the precision of the loop execution to do this at set intervals. Is this assumption correct? If so, are there any simple libraries/functions that might help me do this?
This seems like such a simple process that I feel like I must be missing something staring me in the face, but I can't find anything on the forums or through my google-fu that helps me with this?
Is this process possible with the Teensy 3.6?