fabrizio carraro
New member
I need to transmit medium/good quality audio (taken from the analog audio input of an audio board with a sgtl5000 chip) far away using a laser beam. In order to do that I send a PWM signal to the laser. The light beam is received by a photosensor far away. The photosensor exactly follows the signal if the PWM carrier frequency is below 100-150 Khz (there are no differences between the signal sent to the laser and the signal received, and the audio quality is the same). To test the project at this time I'm reading audio from a SD memory.
Using this simple code:
#include <Audio.h>
// other #include here
AudioPlaySdWav playSdWav1;
AudioOutputPWM pwm1;
AudioConnection patchCord1(playSdWav1, 0, pwm1, 0);
AudioControlSGTL5000 sgtl5000_1;
sgtl5000_1.enable();
playSDWav1.play(filename);
/+ some other obvious code here */
the PWM frequency is automatically set at 44100 Hz (maybe because of sgtl5000_1.enable() call?)
which is a good PWM carrier frequancy for my purpose. Unfortunately the PWM resolution is 8 bits only, so that high level audio passages are ok but low level passages are noisy because of the quantization error.
If I increase the PWM resolution using analogWriteResolution(10) I just have a lower output level (2 bits lower, that is 12 dB lower) but still with the same 8 bit quality. Setting the resolution at more bits (11, 12 or more) I have just a reduction in level.
What I'm missing here? I can I properly set the PWN resolution at at least 10 or 11 bits ? At 44100 Hz the Teensy 4.1 should cope well with that!
Fabrizio
Using this simple code:
#include <Audio.h>
// other #include here
AudioPlaySdWav playSdWav1;
AudioOutputPWM pwm1;
AudioConnection patchCord1(playSdWav1, 0, pwm1, 0);
AudioControlSGTL5000 sgtl5000_1;
sgtl5000_1.enable();
playSDWav1.play(filename);
/+ some other obvious code here */
the PWM frequency is automatically set at 44100 Hz (maybe because of sgtl5000_1.enable() call?)
which is a good PWM carrier frequancy for my purpose. Unfortunately the PWM resolution is 8 bits only, so that high level audio passages are ok but low level passages are noisy because of the quantization error.
If I increase the PWM resolution using analogWriteResolution(10) I just have a lower output level (2 bits lower, that is 12 dB lower) but still with the same 8 bit quality. Setting the resolution at more bits (11, 12 or more) I have just a reduction in level.
What I'm missing here? I can I properly set the PWN resolution at at least 10 or 11 bits ? At 44100 Hz the Teensy 4.1 should cope well with that!
Fabrizio