Audio shield inverts the input?

Status
Not open for further replies.

djtransistor

New member
When running Teensy 3.2 with the audio shield using the PassThroughStereo sketch, I am seeing the following behavior: The audio output is inverted compared to the output. For example, if there is a sawtooth wave coming in, there is a reverse sawtooth wave going out.

I did run some tests to confirm that the output is working as intended. Specifically the waveform object generates waves with the correct orientation. So it looks like the input is being translated. Has anyone else seen this?

Of course, fixing this problem in a sketch is easy: Add a mixer with level -1 to the input. The reason I bring it up is to address the more generic problem of creating a shield that will work the same across all platforms.

I look forward to your thoughts. Thank you in advance.
 
That is very odd. If you look at the schematic for the Audio board here, you'll see there are no buffers on the board (i.e., no inverting op-amps), the signal goes directly into the SGTL5000 codec. If the audio board itself is inverting the audio somehow, it would have to be done inside the CODEC.

I checked the codec datasheet here, and I see no mention of whether it's internal PGA amplifier is inverting or non-inverting. Since it says nothing about it, I'm very surprised if it is indeed inverting. It also doesn't seem to have any control registers to flip the polarity of the data on the I2S bus.

I suggest going through the control registers and see if there is the ability to send the output of the CODEC's ADC directly to the output DAC, bypassing the I2S path to/from the Teensy. This would prove for certain whether the inversion is occurring on the CODEC, or digitally on the Teensy.
 
Blackaddr,

That was a good idea. I modified control_sgtl5000.cpp with this change:

In AudioControlSGTL5000::enable(void)

Original:
write(CHIP_ANA_CTRL, 0x0036); // enable zero cross detectors

Modified:
write(CHIP_ANA_CTRL, 0x0076); // enable zero cross detectors & route line input to headphone output.

The result: The codec is inverting the audio all by itself using analog pass through.
 
That sounds pretty conclusive that the SGTL5000 analog preamp is an inverting amp. Kind of annoying they didn't specify that in their datasheet!

One last check before we sling poo at Freescale for poor documentation.

You are 100% sure you don't have the polarity inverted on the scope channel itself. That is usually a per-channel configuration option.
 
Whatever is responsible for inverting the audio signal, who cares? The human who can hear the difference is still to be born...
 
Whatever is responsible for inverting the audio signal, who cares? The human who can hear the difference is still to be born...

You ear doesn't care about the polarity, but it matters as soon as you try to mix the audio wtih something else with common components, either electronically, or acoustically. The phase inversion will cause any common components to cancel.

For example, I use my Teensy TGA Pro board to add audio effects and send it with the original signal to other mixing equipment where the Teensy processed audio is the sideband processing channel. If a phase inversion happens somewhere everything sounds like pure crap after recombinatinon

Likewise, if you are driving a loudspeaker system and the teensy is doing some processing in one of the crossover paths, when the audio hits the loudspeakers, the different speaker configurations will be out of phase and again sound really bad.
 
I confirmed the source and pass through using the scope. I also tried the audio shield and I board I designed myself. I am confident the scope is not the issue.

Thanks for all of the help.
 
Allegedly XTC's Skylarking LP was released inverted and was undetected by anyone for years until someone noticed the kick-drums suck before they blow (impulse is negative).

Then some purists came up for some reason why it matters.

But it definitely matters if you're mixing signals somewhere --although if they're all inverted it won't 'matter' (except to purists) and if they're mixed with analog they'll likely be out of phase anyway from digital latency.
 
Status
Not open for further replies.
Back
Top