Just wanted to say that I was using your OpenELEC builds, and now just updated to your LibreELEC build, and everything works great
Thanks for everything!
Just wanted to say that I was using your OpenELEC builds, and now just updated to your LibreELEC build, and everything works great
Thanks for everything!
Hi Hias,
How are you? I have moved from Openelec to Libreelec now (your latest 7.x build).
Need your help!
I am trying following setup and it is not working. Please note that my Wolfson card is already configured and working fine. Current setup is, its mounted on RPi3 and its playing music from my HDD that is connected to RPi3 (USB). My RPi3 is also outputting local HDD media to TV via HDMI.
Use case: I have connected my Amazon FireTV stick to TV (TV is connected to RPi3 via HDMI cable ARC compatible) and I want the audio from the programs played on TV from FireTV stick to play on external speakers connected to Woflson Card on RPi3.
So far from my reading, I understand the RPi3 does not support ARC audio playback from TV (Please let me know if this is possible though).
Hence as an alternative, I am trying to connect my TV Toslink audio output to RPi3 via Wolfson card SPDIF input/RX and get output to the speakers connected to Wolfson speaker terminals (amplified ones). Since SPDIF on Audio card only takes Coaxial input, I have purchased a cheap Toslink optical to Coaxial cable converter and connected TV to Wolfson Card.
However, this setup is not working. Can you please help me to resolve this issue?
1. I have copied listen scripts from listen-scripts.tgz to /storage and also provide it will 777 permissions (just in case).
2. My UDEV rules look like:
# enable SPDIF plus all analog outputs
SUBSYSTEM=="sound", ACTION=="add|change", ATTR{id}=="sndrpiwsp", \
RUN+="/usr/bin/SPDIF_playback.sh -q", \
RUN+="/usr/bin/Playback_to_Lineout.sh -q", \
RUN+="/usr/bin/Playback_to_Headset.sh -q", \
RUN+="/usr/bin/Playback_to_Speakers.sh -q", \
RUN+="/storage/Listen_to_SPDIF_on_Speakers.sh eq", \
RUN+="/storage/Listen_to_LineIn_on_Lineout.sh eq", \
RUN+="/storage/Listen_to_LineIn_on_SPDIF.sh eq", \
RUN+="/storage/Listen_to_LineIn_on_Speakers.sh eq", \
RUN+="/storage/Listen_to_SPDIF_on_LineOut.sh eq", \
RUN+="/storage/Listen_to_SPDIF_on_SPDIF.sh eq"
Note: From putty terminal I tried running one of the listen scripts "/storage/Listen_to_SPDIF_on_Speakers.sh" and one of the error/output that shows on the terminal is :
"
+ amixer -q -Dhw:0 cset name=TX Playback Switch off
amixer: Cannot find the given element from control hw:0
"
Can you please let me know what is going wrong here? I have read your initial response on similar topic on this forum and have followed all the instructions?
Cheers
Vijay.
Hi I am not Hias but saw your post and thought I could help. I think the issue is a couple of missing quotation marks in the line bellow
+ amixer -q -Dhw:0 cset name=TX Playback Switch off
I looked through some of the Use Case Scripts and it seems the above line should be:
amixer -q -Dhw:0 cset name="TX Playback Switch" off
Try changing that and see if it works, otherwise you might just have to wait for Hias to reply
Sent from my iPhone using Tapatalk
Display More
Hi I am not Hias but saw your post and thought I could help. I think the issue is a couple of missing quotation marks in the line bellowI looked through some of the Use Case Scripts and it seems the above line should be:
amixer -q -Dhw:0 cset name="TX Playback Switch" off
Try changing that and see if it works, otherwise you might just have to wait for Hias to reply
Sent from my iPhone using Tapatalk
Hi Gvasco,
Thanks for your response and a good observation. However, that line was from the terminal output when I tried running "Listen_to_SPDIF_on_Speakers.sh" from putty. In the file itself, it has quotation marks as follows.
amixer ${BEQUIET} -D${CARD} cset name='TX Playback Switch' off
Cheers
Vijay.
Thanks for your response and a good observation. However, that line was from the terminal output when I tried running "Listen_to_SPDIF_on_Speakers.sh" from putty. In the file itself, it has quotation marks as follows.amixer ${BEQUIET} -D${CARD} cset name='TX Playback Switch' off
Those listen scripts were written for a rather old version of the driver, "TX Playback Switch" doesn't exist in the current version.
If you already set up speaker output (i.e. run "Playback_to_Speakers.sh) you can mix in SPDIF in via these commands (using the second of 4 inputs, the first one is used for standard playback output from RPi):
amixer cset name="SPKOUTL Input 2' AIF2RX1
amixer cset name="SPKOUTL Input 2 Volume' 32
amixer cset name="SPKOUTR Input 2' AIF2RX2
amixer cset name="SPKOUTR Input 2 Volume' 32
But all this probably won't work as you'd expect, there are some nasty details to keep in mind when using SPDIF input:
The card has to be set up to the same sampling rate as the signal on the SPDIF input. Setting the card to 44.1kHz and trying to receive a 48kHz signal, for example, doesn't work. So you have to make sure the SPDIF sampling rate is fixed and then configure kodi to only use that rate - in this case it can work.
When you are using SPDIF input the sound card locks onto the SPDIF signal and uses that as it's clock source instead of it's internal oscillator. So when there's no SPDIF input signal present or the card can't lock onto it (eg wrong samplingrate) you'll get no or only distorted output.
You'd be better off using one of the analog inputs instead, they don't suffer from any of these limitations.
so long,
Hias
You'd be better off using one of the analog inputs instead, they don't suffer from any of these limitations.
Hi Hias, Thanks for your response.
I have already got "Playback_to_Speakers.sh" configured and speakers are working. However, for me to use the analog inputs (Line In) and listen on speakers, do I need to make any furter changes to "Playback_to_Speakers.sh"? The reason I am asking this question is, I do not see an command in the file to use "Line In". "Playback_to_Speakers.sh" in the build looks like this:
"
# $1 added to support 1st line argument. i.e. "./Playback_to_Speakers.sh -q" wi$
#Playback from AP to Speaker
amixer $1 -Dhw:sndrpiwsp cset name='Speaker Digital Volume' 128
# reset speaker mixer inputs
amixer $1 -Dhw:sndrpiwsp cset name='SPKOUTL Input 1' None
amixer $1 -Dhw:sndrpiwsp cset name='SPKOUTR Input 1' None
amixer $1 -Dhw:sndrpiwsp cset name='SPKOUTL Input 2' None
amixer $1 -Dhw:sndrpiwsp cset name='SPKOUTR Input 2' None
# Route AP to Speaker mixer
amixer $1 -Dhw:sndrpiwsp cset name='SPKOUTL Input 1' AIF1RX1
amixer $1 -Dhw:sndrpiwsp cset name='SPKOUTL Input 1 Volume' 32
amixer $1 -Dhw:sndrpiwsp cset name='SPKOUTR Input 1' AIF1RX2
amixer $1 -Dhw:sndrpiwsp cset name='SPKOUTR Input 1 Volume' 32
# Unmute speaker output
amixer $1 -Dhw:sndrpiwsp cset name='Speaker Digital Switch' on
"
Cheers,
Vijay.
Have a look at the Listen_to_LineIn_on_Speakers.sh script as an example of how this can be configured. But note you can't use that script out of the box, it also uses Input 1 of the speaker output mixer (same as the playback to speaker script).
It's best to copy the Playback_to_Speakers.sh script to the storage partition, let's say /storage/speaker-setup.sh and make some alterations. You probably also want to change the volumes of Kodi audio output, the signal received on line-in and the speaker output volume.
First, route the line-in signal (IN3L/IN3R) to the second input of speaker out, using the default input gain of 0dB (input volume 32)
amixer cset name="SPKOUTL Input 2" IN3L
amixer cset name="SPKOUTL Input 2 Volume" 32
amixer cset name="SPKOUTR Input 2" IN3R
amixer cset name="SPKOUTR Input 2 Volume" 32
There are several knobs to turn to control the volume. Let's go input-to-output:
"IN3L Volume"/"IN3R Volume" control the analog input gain (before the ADC). Default is 0 (0dB), 1 is +1dB etc. Usually values between 0 and 8 should be OK (depending on the analog signal level).
"IN3L Digital Volume"/"IN3R Digital Volume" control the gain in the digital domain (after the ADC). Usually it's best to keep that at the default 128 which means 0dB (i.e. no volume change).
"SPKOUTL Input 2 Volume"/"SPKOUTR Input 2 Volume" set the output mixer level. Default is 32 which again means 0dB (31 is -1dB, 33 +1dB etc). Adjust these and also the "SPKOUTL/R Input 1 Volume" (RPi/Kodi volume) settings so that the line-in signal and kodi signal are about the same level. But be careful: if you set it above 32 the signal might clip (especially for Kodi output).
"Speaker Digital Volume" sets the speaker output volume, that's your "master volume knob". Default is 128 / 0dB, 127 is -0.5dB etc. Again, better only use values lower or equal to 128 to attenuate the signal, values above 128 may cause clipping.
so long,
Hias
Hi Hias, Please bear with me.
Now I have written following .sh file and placed it under /storage (chmod 777) and running it from the Udev rules file. I have provided a Line-In input from a sandisk player. However, I am still not able to get any output on speakers connected to wolfson DAC.
I have attached "Listen_to_LineIn_on_Speakers_vk.sh" and "90-wolfson.rules" files to this message in a single zip files.
One more observation, when I try to run "./Listen_to_LineIn_on_Speakers_vk.sh" from putty command line, get "-sh: ./Listen_to_LineIn_on_Speakers_vk.sh: not found" error consistently.
As mentioned above, I have given 777 permissions to the file as well as I am running it from "/storage" directory.
Any help will be appreciated.
Cheers,
Vijay.
Hi Vijay!
Your listen script contains DOS lineendings (CR+LF), change that to unix EOL style (LF only). Ah, and better use #!/bin/sh instead of #!/bin/bash.
You also have to reorder the scripts in the udev file, currently Playback_to_Speakers runs after your Listen scripts and resets the Input 2 settings.
It's best to merge that into 1 single file, setup Input 1 to AIF1RX1/2 and Input 2 to IN3L/R
so long,
Hias
Display More
Hi Vijay!Your listen script contains DOS lineendings (CR+LF), change that to unix EOL style (LF only). Ah, and better use #!/bin/sh instead of #!/bin/bash.
You also have to reorder the scripts in the udev file, currently Playback_to_Speakers runs after your Listen scripts and resets the Input 2 settings.
It's best to merge that into 1 single file, setup Input 1 to AIF1RX1/2 and Input 2 to IN3L/R
so long,
Hias
Yahoooo! That worked. Feels good. You Rock!
Thanks a lot Hias! And appreciate your patience.
Yahoooo! That worked. Feels good. You Rock!
Thanks a lot Hias! And appreciate your patience.
Hi Hias,
There is one small problem outstanding; every time I switch on TV on switch the inputs, there is a loud switching noise (like popping or sharp loud tick sound). This only happens during switching. I tried 'Speaker Digital Switch' off, but the noise is still there. Any ways to mute that?
Cheers
Vijay.
There is one small problem outstanding; every time I switch on TV on switch the inputs, there is a loud switching noise (like popping or sharp loud tick sound). This only happens during switching. I tried 'Speaker Digital Switch' off, but the noise is still there. Any ways to mute that?
When did you try the Speaker Digital Switch off setting? Right before switching on the TV?
The "Speaker Digital Switch" control is the mute-control for the Speaker output. If it's set to off you shouldn't get anything on speaker output.
so long,
Hias
When did you try the Speaker Digital Switch off setting? Right before switching on the TV?The "Speaker Digital Switch" control is the mute-control for the Speaker output. If it's set to off you shouldn't get anything on speaker output.
so long,
Hias
Sorry, didn't give you full picture earlier. Attaching the script now. I am switching it off at the start of the script and then on at the end. However, I now realize this won't work as I guess it only run once at the startup of RPI.
The popping noise appears when I switch between inputs (Line In or onboard) as well as ones or twice randomly.
Any resolution to this please?
This script is only run during bootup. After that you'll get any signal that's present on LineIn to your speaker - if your TV (I assume lineout of the TV is connected to linein on the Cirrus card) outputs a transient on powerup/down you'll hear that - not nice.
There's not much we can do to avoid this, except manually muting the signal or manually switching between "output kodi sound" and "output line-in sound".
You could do that with the help of some external shell scripts (with mixer settings) that you then call from kodi - for example mapped to some buttons on your keyboard or remote.
Calling a shell script from within kodi is a little bit tricky, System.exec doesn't work as expected (it messes up AudioEngine), you have to use Runscript to call a python script which then can use os.system to run the shell script. Look here for more info: LibreELEC
so long,
Hias
Thanks Hias. I'll probably leave it alone for time being.