After Buster April update Bash Sound scripts stops working Topic is solved

All kinds of 'OS' scripts

Moderator: leecollings

McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash scripts stops working

Post by McJohn »

My previous post/test was with a remote session.
With VNC I saw the speaker icon going up and down.

But after a local test, I discovered there is still no sound. Nothing.
And after editing the script (it is and was and is still executable) it does nothing anymore, neither does the sound on and off.
I also did a test with a simple Bash script that executes this VolumeUp.sh script (this works from the terminal and GUI) but even that "via" Script with Domoticz don't want to work.

I even tested a working Bash script from Domoticz and placed the codes
amixer cset numid=1 -- 100
espeak -v nl+f4 -s 180 "Sound. On" --stdout | aplay
into that script and that part of the script don't want to work from Domoticz.


This time it's a tough challenge of the hobby...

Kind regards
User avatar
FireWizard
Posts: 1905
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: After Buster April update Bash Sound scripts stops working

Post by FireWizard »

Hi McJohn,

Isn't there something wrong with the programs, you call in the script?
Such as espeak, aplay or amixer? Or their access rights?

It is just a quick guess.

Regards
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash Sound scripts stops working

Post by McJohn »

- It's a command to the "system" / aplay/ amixer to switch the sound on or off
- And a command to eSpeak.

Both commands/Bash scripts are working well and perfect from the GUI and the Terminal. No problem at all.

But they won't work anymore from Domoticz and the Buster April version. :x

As said; with the January version and Domoticz it was working well.

So, tell me the trick, please....
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash Sound scripts stops working

Post by McJohn »

FireWizard wrote: Friday 12 June 2020 15:45 Or their access rights?
How can I check their acces rights?
Or change them?

Thanks for all the support.

Kind regards
User avatar
FireWizard
Posts: 1905
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: After Buster April update Bash Sound scripts stops working

Post by FireWizard »

Hi,

@McJohn

All 3 programs are installed in /usr/bin.

To find ou where a particular file has been installed you can issue the following command:

Code: Select all

sudo find /-iname name_of_ the_file
In my case the ownership and rights is as follows:
pi@RPi1:~ $ ls -l /usr/bin/aplay
-rwxr-xr-x 1 root root 62968 Mar 30 2019 /usr/bin/aplay
pi@RPi1:~ $ ls -l /usr/bin/amixer
-rwxr-xr-x 1 root root 42516 Mar 30 2019 /usr/bin/amixer
pi@RPi1:~ $ ls -l /usr/bin/espeak
-rwxr-xr-x 1 root root 14244 Oct 23 2018 /usr/bin/espeak
If you want to change the ownership of a file: https://www.computerhope.com/unix/uchown.htm
If you want to change the access rights of a file: https://www.computerhope.com/unix/uchmod.htm

In this example the owner of these files is "root" and the file can be executed all, can be read by all, but only written by the user (root).

Does this help to check?

Regards
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash Sound scripts stops working

Post by McJohn »

Hi,

Thank you so much for your feedback and all the information.
I know something about chmod and rights etc. for files but I thought maybe there are also rights for a program to execute.
I my case as said: the 2 bash files have rights for everybody to execute and this was working well for years before the April update of Buster.

There is something really strange going on:
I started from scretch: burned a new fresh ssd from the Raspberry site, did an upgrade to the April version of Buster and a fresh installation of Domoticz and import our database.
Installed:

Code: Select all

ESPEAK
sudo su
cd
sudo apt-get install espeak
sudo apt-get install alsa-utils

And same problem occurs:
In the GUI and terminal both bash scripts are working well (Sound goes On and Off and speak text)
and from Domoticz they won’t want to work, totally no action. (But they are normally displayed into the log.)
2020-06-13 21:34:45.010 Status: User: Admin initiated a switch command (113/Sound On_Off/On)

I checked the rights of the programs and compare these with yours.
It seems to be they are the same..
pi@raspberrypi:~ $ ls -l /usr/bin/aplay
-rwxr-xr-x 1 root root 62968 Mar 30 2019 /usr/bin/aplay
pi@raspberrypi:~ $ ls -l /usr/bin/amixer
-rwxr-xr-x 1 root root 42516 Mar 30 2019 /usr/bin/amixer
pi@raspberrypi:~ $ ls -l /usr/bin/espeak
-rwxr-xr-x 1 root root 14244 Oct 23 2018 /usr/bin/espeak

So, are there still any tips or tricks after this fresh install to make this working well?

It's a hobby .. :oops: :x
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash Sound scripts stops working

Post by McJohn »

Found the problem.
(Not yet the solution..)

Domoticz is execution commands via the root user.
The root user sends audio commands through HDMI.
But we have no audio connected to HDMI.

So, FireWizard, did you really test the audio via the audio jacket of the RPi?

When we connect the Rpi to an HDMI connection, the Bash script is sending his audio from Domoticz to the HDMI port.
When we execute the exact same script from the GUI or terminal, the audio is sending to the 3.5MM audio jacket.

The official Raspberry site says:
https://www.raspberrypi.org/documentati ... -config.md
But when we execute this command in the terminal, it gives an error (since the Buster update of April):
pi@raspberrypi:~ $ amixer cset numid=3 1
amixer: Cannot find the given element from control default

or:
sudo amixer cset numid=3 1
amixer: Cannot find the given element from control default
So, how can we change the default audio setting of the root user to always 3.5mm audio?
User avatar
FireWizard
Posts: 1905
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: After Buster April update Bash Sound scripts stops working

Post by FireWizard »

Hi,

@McJohn
So, FireWizard, did you really test the audio via the audio jacket of the RPi?
Yes, I did.

Can you try to set the card to "auto"?

Code: Select all

amixer cset numid=3 0
What happens then?

Regards
User avatar
HansieNL
Posts: 964
Joined: Monday 28 September 2015 15:13
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

Re: After Buster April update Bash Sound scripts stops working

Post by HansieNL »

Have you tried to force the sound to jack via raspi-config?
sudo raspi-config - Advanced Options - Audio ( Force audio out through HDMI or 3.5mm jack )
Blah blah blah
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash Sound scripts stops working

Post by McJohn »

Thanks for both answers.

When I do:
pi@raspberrypi:~ $ amixer cset numid=3 0
amixer: Cannot find the given element from control default

pi@raspberrypi:~ $ sudo amixer cset numid=3 0
amixer: Cannot find the given element from control default
And I already tried:
sudo raspi-config - Advanced Options - Audio ( Force audio out through HDMI or 3.5mm jack )
(I think this option is also for User "Pi"?)

It keeps sending the audio commands from Domoticz to the HDMI port.

Is there no master command for the root to force audio via analog 3.5 mm output?
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash Sound scripts stops working

Post by McJohn »

It seems to be I'm not the only one:

https://www.raspberrypi.org/forums/view ... 6&t=276110

https://www.raspberrypi.org/forums/view ... 1&t=277039
jamesh
Raspberry Pi Engineer & Forum Moderator:
"We have now moved to a more standard Linux sound system setup"
No solution until yet, tried everything.
User avatar
FireWizard
Posts: 1905
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: After Buster April update Bash Sound scripts stops working

Post by FireWizard »

Hi,

@McJohn

I looked to it once more.
I did the following:

Code: Select all

sudo raspi-config
Screenshot_raspi-config1.png
Screenshot_raspi-config1.png (21.63 KiB) Viewed 1642 times
Screenshot_raspi-config2.png
Screenshot_raspi-config2.png (27.85 KiB) Viewed 1642 times
Screenshot_raspi-config3.png
Screenshot_raspi-config3.png (5.92 KiB) Viewed 1642 times
As you can see, I don't have HDMI connected.

You can try to issue just the command, after you run the raspi-config (as above):

Code: Select all

espeak -v nl+f4 -s 180 "Sound. On" --stdout | aplay
without setting amixer.

I do not have further suggestions. If the Raspberry Pi engineers have no idea, then it will be difficult.

Regards
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash Sound scripts stops working

Post by McJohn »

Thank you very much for your contribution.
You are a (very) lucky person that you don't have the HDMI option! :)

In my case HDMI want to play the master role and with or without an HDMI screen, with user root it's always HDMI.
(Sudo Raspi-config gives 2 options: 0 HDMI and 1 Headphones)
This is with an upgrade of the January version of Buster AND also with a fresh new image of the Raspberry site.

Tried your suggestions but unfortunately same results:
Bash script (your code) is working perfect in the GUI and Terminal but from Domoticz no sounds.

OK, I think I have to go back in time and go to the January version of Buster.
That one works good and stable and finally time should give us a solution...

Thanks again for all your time and work!

Kind regards.
Attachments
Screen Shot 2020-06-14 at 16.24.36.png
Screen Shot 2020-06-14 at 16.24.36.png (112.16 KiB) Viewed 1642 times
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash Sound scripts stops working

Post by McJohn »

And this is the difference with the January version of Buster in Raspi-config) (At a Rpi 3B+):
Attachments
Screen Shot 2020-06-14 at 17.08.38.png
Screen Shot 2020-06-14 at 17.08.38.png (81.93 KiB) Viewed 1642 times
User avatar
FireWizard
Posts: 1905
Joined: Tuesday 25 December 2018 12:11
Target OS: Raspberry Pi / ODroid
Domoticz version: Beta
Location: Voorthuizen (NL)
Contact:

Re: After Buster April update Bash Sound scripts stops working

Post by FireWizard »

hi,

@McJohn

I tested it with raspi-config on 3 different Pi's(RPi1B, RPi2B and RPI3B+) and on nome of them I have HDMI connected.
All 3 Pi's show only 0 Headphones.

Have you seen this: https://www.raspberrypi.org/forums/view ... p?t=245736
and: https://www.element14.com/community/com ... e-pi-4-fix

Regards
Last edited by FireWizard on Sunday 14 June 2020 19:00, edited 1 time in total.
McJohn
Posts: 91
Joined: Wednesday 10 October 2018 17:01
Target OS: Raspberry Pi / ODroid
Domoticz version: 2020.2
Location: The Netherlands
Contact:

Re: After Buster April update Bash Sound scripts stops working

Post by McJohn »

Thanks for testing at the 3 Rpi models.
On the other side isn't it strange that you don't have any displayed HDMI source?

Yes, I have read all that links (and I think 20 extra, and the whole internet at every corner..... :x ) and learned all of them and memorized them all but all that links are speaking about no sound at all from the 3.5Mm audio jacket.
We have perfect sound from the audio jacket!
But not with a command from / via Domoticz :x :x
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest