2

I am developing a project on a Raspberry Pi 3 B+. I am using the PWM0 channel to send a custom-made IR signal using PiGPIO waves. I gather it might then be possible to use PWM1 for mono audio; is that a correct assessment? How might that work with the onboard audio jack when it's presumably wired up to both channels?

If my project required 2 channel (or better) audio, would the best choice be a USB audio board? Or is there a way to use audio from HDMI without binding up there HDMI port? Or another option I haven't thought of or found yet?

I've been largely unsuccessful finding pi 3 B+ examples and I'm guessing that is because hardware PWM is relatively new in the pi world.

If you have used or know about pi-specific audio boards that might satisfy my need, would you mind adding a link to it?

  • 1
    The pi's existing audio uses both by default apparently btw raspberrypi.stackexchange.com/a/49601/10590 - from where did you gather it might be possible to use just one please (I don't know if it would mind one channel being overridden!)? Hardware PWM I think has been in use since the first Pi's, just for audio. Audio over HDMI would be easiest got through an adapter, which shouldn't be too bad size wise if you are intending on using it anyway. Examples used on previous Pi's may be somewhat forward compatible. Otherwise there are a whole lot of HATs and USB dongles available... – Wilf Aug 16 '18 at 5:04
  • Even in the link you provided, somebody mentions stereo and mono. I have seen this mentioned elsewhere, but no links for that, sorry. I honestly don't know what it looks like to use one channel versus two. I also wonder if a DAC pi hat could function or be altered to use a single gpio for mono audio. – Beez Aug 16 '18 at 5:12
  • Also, if using HDMI audio and running from a Python script, how would it look to write that audio data to the appropriate channel? I have not come across any documentation on sending audio through HDMI using Python. – Beez Aug 16 '18 at 5:15
  • in a desktop environment atleast (and usually also on command line) you can use the sound servers (ALSA or Pulseaudio) which will automatically have interfaces for HDMI and added sound devices - the output is set via configuration (can be overrided in boot config with regards to HDMI). – Wilf Aug 16 '18 at 23:09
  • Any ideas using a Python script? – Beez Aug 17 '18 at 2:19
1

As far as pigpio is concerned what you are trying to do is not possible.

http://abyz.me.uk/rpi/pigpio/faq.html#Sound_isnt_working

pigpio always uses either the hardware PWM peripheral or the hardware PCM peripheral to time GPIO sampling. The default is to use the hardware PCM peripheral to sample GPIO every 5µs.

If waves are being used then pigpio will also use the other hardware peripheral to time the waves.

This means neither hardware peripheral is available for use in your case.

  • 1
    Thank you for your response! I read a lot of Pi SE questions and your name shows up often. It's an honor :) Does this impact USB sound cards or using HDMI? – Beez Aug 16 '18 at 8:47
  • 2
    @Beez pigpio should not affect or be affected by USB or HDMI. That should be fine. – joan Aug 16 '18 at 9:42

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.