Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raspberry with hi berry DAC #9

Open
thecharpy opened this issue Sep 17, 2019 · 11 comments
Open

Raspberry with hi berry DAC #9

thecharpy opened this issue Sep 17, 2019 · 11 comments

Comments

@thecharpy
Copy link

Dear Andrew,
Thanks for the excellent work you have done. I have tried it and it does work perfectly for me with the HDMI cable connected.

However in my specific case, I have purchased a hifiberry hat DIGI+ Pro to stream my music (Airplay for example). Do you know by any chance how I could detect this audio stream in the Pi to trigger my Cambridge amp ?

Thanks,

Alex

@andrew-bolin
Copy link
Owner

Hey Alex, thanks, glad to hear you've found it useful.

I'm not sure I understand your question. Are you saying you want to detect when the Pi is playing audio?

The easiest way would be to get your playback program to tell you, modify the script that's doing the playback, or something along those lines.

Otherwise, there are ways to interrogate the audio drivers, e.g.
https://unix.stackexchange.com/questions/106461/how-to-get-sound-intensity-of-an-audio-input-through-terminal

@damirsamardzic
Copy link

Hi Andrew,

I'm sorry for resurrecting the old issue, but I faced the same problem when using HiFiBerry DAC on RPi 4. It seems that pigpiod interferes with the DAC and sound doesn't work anymore as soon as first command is issued to the GPIO4.

To make it work, I added separate ca_amp_ctrl and web tools which work with RPi.GPIO and so far everything looks good with my CA 540a V2. You can check my fork here:
https://github.com/damirsamardzic/pi_hifi_ctrl

Anyhow, thanks for the great tool!

Regards,
Damir

PS: I see that the default cmd mapping swaps volup and voldown commands, but this is separate issue.

@andrew-bolin
Copy link
Owner

Hi Damir,
Thanks for the update. It's great to see this code is still getting some use, even though my own Cambridge Audio amplifier stopped working long ago (I did try to fix it...)

Nice catch on the volup and voldown!

I'm impressed that RPi.GPIO works here, considering it claims to be unsuitable for real time applications. If I'm bored later maybe I could try to merge your change in and add a command-line option to select the IO driver...

@andrew-bolin
Copy link
Owner

Just checking I got the volume commands right:
code 16 for up, 17 for down ?

@damirsamardzic
Copy link

I found your tool some time ago but now finally took time to set it up. Brings a new (digital?) life to my trusty 540a, thanks a lot for that! :-)

Volup is 16, voldown is 17, vol+ and vol- are OK (I wrongly swapped these as well, fixed it now in my fork).

With regards to RPi.GPIO, I didn't investigate too much though, just made it work for my case. My setup is:

  • RPi 4 (headless, no HDMI TV) with HiFiBerry DAC2 Pro
  • raspotify / shairport-sync / bluealsa-aplay
  • and the web.py as service so that I can control the 540a using HTTP

Basically, I do all music related things from phones/tablets/PCs and don't use CEC so I'm not sure if RPi.GPI would be sufficient for all scenarios which you covered.

Interesting would be to have the amp powered on if there is for example 5 sec continuously sound coming out from the DAC (similar logic as for the CEC I guess). And maybe power off the amp if there is no activity (sound) for 1h... Might give it a try.

@marcgarciamarti
Copy link

This project looks very very interesting. I'm not sure I dare to tamper with the RPI pinout. One question: if "Control In" has an RCA input, could this all be achieved using an USB to RCA cable?

@andrew-bolin
Copy link
Owner

andrew-bolin commented Jan 13, 2023 via email

@marcgarciamarti
Copy link

nope, you'll need to use the digital IO pins on the Raspberry Pi's 40 pin
header
@andrew-bolin Could you possibly share some pictures of your setup? I have special interest in seeing how you have done the wiring and how it is attached to the pinout. Did you solder it?

@andrew-bolin
Copy link
Owner

andrew-bolin commented Jan 24, 2023 via email

@marcgarciamarti
Copy link

Sadly I no longer have the amplifier, and I can't find the Pi either - may have been repurposed. From memory I soldered 2 wires to an RCA socket and the Pi Zero. A small piece of large diameter heat shrink around the whole width of the Pi Zero board to hold the wires all in place. But you could use push-on jumper wires on the header pins, whatever's easy for you.

It is just too bad that you don't have your amp. This means that this project won't evolve much from here on I guess. What a pity!! :(

@jimToo
Copy link

jimToo commented Feb 19, 2023

@damirsamardzic thanks a lot to translate to RPi.GPIO, I don't think I could have done it on my own.
Works pretty well. A little less reliable with RPi.GPIO or gpiozero compared to pigpio, but if you start your command a second time, you can be sure that the amp turns on for example.
:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants