Moode Forum
[SOLVED] random issue with playback starting and stopping . - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7)
+--- Thread: [SOLVED] random issue with playback starting and stopping . (/showthread.php?tid=2384)

Pages: 1 2


random issue with playback starting and stopping . - GreyLinux - 04-17-2020

Hi all ,

I have a random issue with my setup where after a while of listening to radio, randomly the playback pauses,  even stranger after listening to nothing for a while it randomly will start playing again .

my setup is Raspberry pi 4 , Hifiberry amp2, gpio handler enabled for momentary button control ( which I believe is related ot the problem) and mono output provided by sox resampling option , also I have volume control set to software .

I believe it is related either to the gpio handler configuration or the buttons themselves .

I have configured mpc toggle on gpio6 , vol up on gpio 5 and vol down on gpio26 . The other tails of the buttons are to ground, Deounce is 750ms ,   not sure if this I helpful but just in case its my handy work causing the issue!

When pressed all buttons work as expected except that when no audio is playing if I press vol up or vol down a few times , audio begins playing (not sure if this is expected behaviour ?)
no physical connection is shorting between the pins as I soldered female gpio connectors to the ends of each button tail  and they fit nice and snug .

nothing obvious appears in any of the logs but I'm not entirely sure what I'm looking for .

any ideas or advice would be great .


RE: random issue with playback starting and stopping . - Tim Curtis - 04-17-2020

You could try running the button handler from the cmd line after adding some debug print.

1. Turn off the handler in System config.
2. sudo nano /var/www/command/gpio-buttons.py
Uncomment the existing #print statements and optionally add your own

3. Run it from cmd line

Code:
sudo /var/www/command/gpio-buttons.py



RE: random issue with playback starting and stopping . - GreyLinux - 04-17-2020

(04-17-2020, 05:33 PM)Tim Curtis Wrote: You could try running the button handler from the cmd line after adding some debug print.

1. Turn off the handler in System config.
2. sudo nano /var/www/command/gpio-buttons.py
Uncomment the existing #print statements and optionally add your own

3. Run it from cmd line

Code:
sudo /var/www/command/gpio-buttons.py

what sort of debug print statement would you suggest could help ?

when I run it as is and press the volume buttons a few times I get



Code:
2020-04-17 19:09:08 bounce_time=750
2020-04-17 19:09:08 row id=1, enabled=1, command=mpc toggle
2020-04-17 19:09:08 sw_1: pin=6, enabled=1, bounce_time=750, cmd=mpc toggle
2020-04-17 19:09:08 row id=2, enabled=1, command=/var/www/vol.sh up 1
2020-04-17 19:09:08 sw_2: pin=5, enabled=1, bounce_time=750, cmd=/var/www/vol.sh up 1
2020-04-17 19:09:08 row id=3, enabled=1, command=/var/www/vol.sh dn 1
2020-04-17 19:09:08 sw_3: pin=26, enabled=1, bounce_time=750, cmd=/var/www/vol.sh dn 1
2020-04-17 19:09:08 row id=4, enabled=0, command=
2020-04-17 19:09:08 row id=5, enabled=0, command=
2020-04-17 19:09:08 row id=6, enabled=0, command=
2020-04-17 19:09:08 row id=7, enabled=0, command=
2020-04-17 19:09:08 row id=8, enabled=0, command=
2020-04-17 19:09:08 row id=99, enabled=, command=
LoungeFM: LISA BAJRAK - Обіймати Тебе
[playing] #1/1   0:50/0:00 (0%)
volume: 25%   repeat: off   random: off   single: off   consume: off
LoungeFM: LISA BAJRAK - Обіймати Тебе
[paused]  #1/1   1:10/0:00 (0%)
volume: 18%   repeat: off   random: off   single: off   consume: off
LoungeFM: LISA BAJRAK - Обіймати Тебе
[playing] #1/1   1:11/0:00 (0%)
volume: 14%   repeat: off   random: off   single: off   consume: off
LoungeFM: LISA BAJRAK - Обіймати Тебе
[paused]  #1/1   1:14/0:00 (0%)
volume: 15%   repeat: off   random: off   single: off   consume: off

I havent pressed play at al this is just with vol buttons


RE: random issue with playback starting and stopping . - Tim Curtis - 04-17-2020

Prolly add a print statement in the callback function for the particular buttons you have defined. This would show when the event occurs. It should only occur when button is pressed. 

Something like below.

Code:
       def sw_1_event(channel):
           subprocess.call(sw_1_cmd)
           print('sw_1_event')



RE: random issue with playback starting and stopping . - GreyLinux - 04-17-2020

Code:
Apr 17 18:58:53 moode-lounge kernel: [16174.011128] pcm512x 1-004d: No SCLK, using BCLK: -2
Apr 17 19:01:41 moode-lounge nmbd[563]: [2020/04/17 19:01:41.425225,  0] ../source3/nmbd/nmbd_namequery.c:109(query_name_response)
Apr 17 19:01:41 moode-lounge nmbd[563]:   query_name_response: Multiple (2) responses received for a query on subnet 192.168.1.231 for name WORKGROUP<1d>.
Apr 17 19:01:41 moode-lounge nmbd[563]:   This response was from IP 192.168.1.1, reporting an IP address of 192.168.1.1.


these are the only repeated logs in syslog but I believe they are unrelated .


RE: random issue with playback starting and stopping . - GreyLinux - 04-17-2020

(04-17-2020, 06:26 PM)Tim Curtis Wrote: Prolly add a print statement in the callback function for the particular buttons you have defined. This would show when the event occurs. It should only occur when button is pressed. 

Something like below.

Code:
       def sw_1_event(channel):
           subprocess.call(sw_1_cmd)
           print('sw_1_event')

after adding this


Code:
sw_2_event
sw_2_event
sw_2_event
sw_3_event
sw_3_event
sw_3_event
sw_3_event
sw_2_event
sw_2_event
sw_2_event
sw_2_event
sw_3_event
sw_3_event
sw_3_event
sw_3_event
sw_2_event
sw_3_event
LoungeFM: LISA BAJRAK - Обіймати Тебе
[playing] #1/1   1:14/0:00 (0%)
volume: 14%   repeat: off   random: off   single: off   consume: off
sw_1_event
sw_2_event
sw_2_event
sw_3_event
sw_3_event
sw_3_event
sw_2_event
sw_2_event
sw_2_event
sw_2_event
sw_3_event
sw_3_event
sw_3_event
sw_2_event
sw_2_event
LoungeFM: LISA BAJRAK - Обіймати Тебе
[paused]  #1/1   1:34/0:00 (0%)
volume: 16%   repeat: off   random: off   single: off   consume: off
sw_1_event
sw_2_event

the play button was not pressed once but as you can see it randomly started playback .


RE: random issue with playback starting and stopping . - Tim Curtis - 04-17-2020

Something, most likely hardware, is changing the PUD state of the gpio which causes the event to be triggered.
https://sourceforge.net/p/raspberry-gpio-python/wiki/Inputs/

You could try disconnecting one of the buttons to confirm that no event occurs.


RE: random issue with playback starting and stopping . - GreyLinux - 04-17-2020

(04-17-2020, 06:44 PM)Tim Curtis Wrote: Something, most likely hardware, is changing the PUD state of the gpio which causes the event to be triggered.
https://sourceforge.net/p/raspberry-gpio-python/wiki/Inputs/

You could try disconnecting one of the buttons to confirm that no event occurs.

interesting !! , I did begin to think that it might be hardware related just before you posted .

Its possible that my switch is faulty so I'll try disconnecting the play button tomorrow and let you know my findings


RE: random issue with playback starting and stopping . - GreyLinux - 04-18-2020

(04-17-2020, 06:44 PM)Tim Curtis Wrote: Something, most likely hardware, is changing the PUD state of the gpio which causes the event to be triggered.
https://sourceforge.net/p/raspberry-gpio-python/wiki/Inputs/

You could try disconnecting one of the buttons to confirm that no event occurs.

I have carried out some testing this morning and discovered that it is entirely hardware related . I removed the play button from the gpio and tried the same test as above , I found that pressing one of the volume button occasionally caused the other to detect an event . this ruled out the buttons.

I did notice that when I touched the wires with no button press this caused an event to be detected suggesting either a poor connection betwen the wires and the gpio's is causing events or some noise is being caused because of proximaty to the speaker magnet or the general length of the wire , or possibly all 3 could be causing it . I have read that putting a o.1UF capacitor between terminals on the button can filter out the noise .

Thanks  Tim for you help and advice in leading me to this conclusion .

I'll add to this thread when I find a solution so as to help anyone else with a similar problem


RE: random issue with playback starting and stopping . - GreyLinux - 04-18-2020

To mark this thread as solved ,

I discovered that it was the dupont connectors on the end of the button tails did not having a good connection with the pins on the HifiBerry amp2 as they are smaller than standard 2.54mm pins this caused the playback to randomly stop and play and cause other buttons to glitch and trigger other button events .

I'm aware that soldering to the amp2 pins voids the warranty but I decided to solder the connections and create a permanent connection .