I generate a sawtooth waveform and output it via the SGTL5000 Audio Board (see code below). The LineOut output seems to have a quite large impedance. When I connect the output pin with ground via a 10k resistor the signal nearly vanishes. But the SGTL datasheet says the output impedance of the lineout pin is 320 Ohm. Something is wrong here. Has someone experienced this behaviour or do I make an error in my program? Has someone a similar code that works?
Code:
#include <Audio.h>
#include <Wire.h>
// GUItool: begin automatically generated code
AudioInputI2S i2s2; //xy=137,257
AudioRecordQueue recordQueue1; //xy=332,296
AudioRecordQueue recordQueue2; //xy=335,229
AudioPlayQueue playQueue1; //xy=503,230
AudioPlayQueue playQueue2; //xy=504,298
AudioOutputI2S i2s1; //xy=680,263
AudioConnection patchCord1(i2s2, 0, recordQueue2, 0);
AudioConnection patchCord2(i2s2, 1, recordQueue1, 0);
AudioConnection patchCord3(playQueue1, 0, i2s1, 0);
AudioConnection patchCord4(playQueue2, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=322,165
// GUItool: end automatically generated code
void setup() {
Serial.begin(9600);
delay(1000) ;
Serial.println("Hello World");
sgtl5000_1.enable();
sgtl5000_1.volume(1.0);
sgtl5000_1.lineOutLevel(2);
AudioMemory(64);
recordQueue1.begin();
recordQueue2.begin();
}
int16_t *input_L ;
int16_t *output_L ;
int16_t *input_R ;
int16_t *output_R ;
int sawtooth=0 ;
void loop() {
while(1){
if( (recordQueue1.available() > 12 ) & (recordQueue2.available() > 12 ) ) {
for (int i = 0; i < 8; i++) {
input_L = recordQueue1.readBuffer();
output_L = playQueue1.getBuffer();
input_R = recordQueue2.readBuffer();
output_R = playQueue2.getBuffer();
recordQueue1.freeBuffer();
recordQueue2.freeBuffer();
for(int k=0 ; k<128 ; k++){
// output_L[k]=input_L[k] ;
output_R[k]=input_R[k] ;
output_L[k]=sawtooth ;
// output_R[k]=sawtooth ;
sawtooth++ ; if (sawtooth>32000){ sawtooth=0 ; }
}
playQueue1.playBuffer();
playQueue2.playBuffer();
}
}
}
}