andrew-bolin / pi_hifi_ctrl

Raspberry Pi Hi-Fi Amplifier Control
29 stars 9 forks source link

Raspberry with hi berry DAC #9

Open thecharpy opened 5 years ago

thecharpy commented 5 years ago

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 commented 5 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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

damirsamardzic commented 2 years ago

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:

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 commented 1 year ago

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 commented 1 year ago

nope, you'll need to use the digital IO pins on the Raspberry Pi's 40 pin header

On Fri, 13 Jan 2023 at 08:57, marcgarciamarti @.***> wrote:

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?

— Reply to this email directly, view it on GitHub https://github.com/andrew-bolin/pi_hifi_ctrl/issues/9#issuecomment-1381038521, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE3DXROYKJRTJAU3DO7H5PTWSB435ANCNFSM4IXVW7KA . You are receiving this because you commented.Message ID: @.***>

marcgarciamarti commented 1 year ago

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 commented 1 year ago

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.

On Sat, 21 Jan 2023 at 04:47, marcgarciamarti @.***> wrote:

nope, you'll need to use the digital IO pins on the Raspberry Pi's 40 pin header @andrew-bolin https://github.com/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?

— Reply to this email directly, view it on GitHub https://github.com/andrew-bolin/pi_hifi_ctrl/issues/9#issuecomment-1398736979, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE3DXRO4Y7VKHPN6EUZGTOTWTLFTXANCNFSM4IXVW7KA . You are receiving this because you were mentioned.Message ID: @.***>

marcgarciamarti commented 1 year ago

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 commented 1 year ago

@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. :)