Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: Audio adapter output polarity

  1. #1

    Audio adapter output polarity

    I'm using the teensy 3.6 board with the audio adapter and the teensy audio library. Here's the code to generate a sine wave:

    AudioMemory(10);
    sgtl5000_1.enable();
    sgtl5000_1.volume(0.9);
    sgtl5000_1.unmuteLineout();
    sgtl5000_1.lineOutLevel(13);
    waveform1.begin(WAVEFORM_SINE);
    waveform1.frequency(100);
    waveform1.amplitude(1);

    I have a scope on the line out. See picture. The scope is showing the amplitude go negative. Why is that?
    Click image for larger version. 

Name:	Capture.PNG 
Views:	12 
Size:	34.7 KB 
ID:	26645

    Also, I fed the output into a stm32-nucleo board (with arduino framework). printed out the analogRead values, and plot looks like this
    Click image for larger version. 

Name:	c2.PNG 
Views:	9 
Size:	14.7 KB 
ID:	26646
    Which if the signal went negative, may correlate to the truncated floor values of 0. What am I doing wrong?

  2. #2
    Senior Member fdaniels's Avatar
    Join Date
    Oct 2020
    Location
    Ostwestfalen, Germany
    Posts
    117
    Audio is meant to be AC because a microphones ( and a speakers) membrane swing around their resting position - see here https://en.wikipedia.org/wiki/Alternating_current

  3. #3
    Senior Member
    Join Date
    Jul 2020
    Posts
    1,368
    The Audio adapter board has DC-blocking capacitors on the line inputs and line outputs. Any audio device will handle proper AC
    correctly (and some do not like a DC bias at all, for instance a DC-coupled amplifier fed a DC signal will blow speakers up).

    Alas the audio adapter doesn't have bleeder resistors on the outputs so the output can have a DC offset that gradually fades with
    time.

    [ Incidentally for some reason the SGTL5000 has line outputs phase-inverted - the headphone outputs are correct though. This
    would need something like a sawtooth wave to see on a 'scope though. ]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •