6

Is there any way to configure the Pi3's audio jack to automatically produce balanced mono output? i.e. act as a "balanced mono jack" as described here, where the regular sound wave is on one channel, and an equal-but-opposite signal is on the other channel?

I'm currently using this mono amplifier to power a small speaker from the Pi. Since it's mono, I have its "In+" pin wired to the Pi's right audio channel, and I leave the left channel wire disconnected. However, I'm experiencing a lot of ground noise. Even with no sound actively being played, the speaker emit what seems like white noise, which seems to increase with pops and periodic pulses when the Pi is under load.

The amplifier supports a "In-" pin for cancelling out this noise by using an inverted signal, so I'm trying to see if I can convert the jack's output to produce this signal. However, I'm not sure how to do that, short of creating some sort of middleware audio system that accepts normal dual-channel wav data, merges into one channel, then produces the inverted signal and places that on the opposite channel, and then sends that to the actual sound server to play.

Has this been done before? Are there easier ways to reduce ground noise on the speaker?

Edit: A user asked a similar question, but involving input, with converting an unbalanced stereo input to a balanced mono input, and was presented with a potential solution through an ALSA configuration. I'm not well-versed in ALSA configs, but would something similar be possible with output?

  • A good USB sound card should solve this problem. – Moshe Katz Aug 29 '16 at 4:16
2

Sadly, I don't think this is going to work the way you think it's going to work.

Balanced cabling is effective at minimising noise induced along the length of the cable. If there's an almighty tsunami of white noise produced by the source (here, a Pi's 3.5mm audio output), a balanced cable will endeavour to transmit that noise faithfully from source to destination without introducing further noise itself. Balanced cabling isn't a noise removal strategy, it's a noise prevention strategy.

The Pi's 3.5mm audio output is an abomination, and appears to reproduce every glitch, crackle and hum possible. It should be avoided if there's any other feasible option. Whenever I've had to get audio out of a Pi in the past I've ended up using a cheap adapter into its HDMI output. This still isn't perfect, but it's a lot cleaner than the 3.5mm jack.

  • If the same noise is added to the left/right channels, the symmetric receiver will subtract it out. – CL. Aug 25 '16 at 18:24
  • The problem is that the noise isn't being introduced in the cable, which would be solvable with a balanced line. All signals coming from the Pi's 3.5mm output are infested with CPU-related interference long before it gets to the jack socket. Balanced cabling won't address that problem. – goobering Aug 25 '16 at 18:52
2

Exactly the same device definition works for playback:

pcm.fake_balanced {
    type route
    slave.pcm "hw:0"    # or whatever
    ttable [ [ 1 -1 ] ]
}

Put it into your ~/.asoundrc or into the global /etc/asound.conf, and use the device name fake_balanced to play mono sounds:

aplay -D fake_balanced some_mono_file.wav

(Use plug:fake_balanced to automatically convert sample formats not supported by the hardware.)

  • The solution this is based on purportedly didn't work for them. Did you see the followup? – Cerin Aug 25 '16 at 19:33
  • That was for two-channel data. – CL. Aug 25 '16 at 20:12
  • My data is also two-channel. I have stereo sound that I need to convert to mono and sent on the left channel, while a differential signal is sent on the right channel. – Cerin Aug 26 '16 at 1:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.