RPi-Jukebox-RFID icon indicating copy to clipboard operation
RPi-Jukebox-RFID copied to clipboard

After Powerup sound sometimes not initialized

Open Feuer-sturm opened this issue 6 years ago • 45 comments

Hello,

sometimes after power on the sound is not working with the phoniebox software. Actually I can't reproduce this behavior.

When there is no sound it looks like this in the web interface: grafik

After rebooting the pi everything is fine and I can start playing music: grafik

I have this behavior with a Pi 3b+ and Phoniebox SW 1.1.8-rc2 and with a Pi 3b and Phoniebox SW 1.1.8 I use this external USB sound card https://www.amazon.de/gp/product/B00C7LXUDY/ref=oh_aui_detailpage_o04_s00?ie=UTF8&psc=1 which is direktly plugged in the USB port of the Pi

Perhaps anybody can help me :-)

Feuer-sturm avatar Dec 26 '18 00:12 Feuer-sturm

Yesterday I put an extension calbe to the USB soundcard because there ist not much space when for the sound card when three USB Ports are used. After this I powered up the phoniebox for 20 times and everything was fine. Today in the morning (it was the second power up today) there was once again the problem that I can't hear music and the Volume stayed at 0% in the circle. After a reboot everything was fine.

Do other users have the same problems? Can I enable degub flags to see some informations in the log files? What is the condition for the volume grafic to go from 0% to e.g. 30% (Value for the standard sound level after power up)?

Feuer-sturm avatar Dec 29 '18 13:12 Feuer-sturm

Not sure where the audio service log files would be and what they would look like. The only thing I can think of that might also be the reason: a "mute" / sound off GPIO button that's dodgy or gets pressed accidently alongside the power off button - or is wired wrong? It might be a mute RFID chip card that's been used twice? If the same ID is used for the mute function and a folder / stream or the like: the mute overrides the playout - and then it would be muted. ...? if you find this, please share what it is.

MiczFlor avatar Dec 29 '18 14:12 MiczFlor

Thanks for the note with "muting". I don't use the feature "muting". I will check my wiring if I have a problem with BCM13 and GND. Is there a possibility to see in some log files if the mute command was triggered? I addition to this I will comment out the lines for "vol0" and "shut" in the file gpio-buttons.py and have a look if the problem is still present.

Feuer-sturm avatar Dec 29 '18 18:12 Feuer-sturm

Hi there. I got the same issue with the Spotify version and the same USB sound card as SpookyFishes mentioned. A look into the mopidy.log file shows an error, that reads like: ERROR: mopidy.audio.gst: Could not open audio device for playback. (6) I can also not reproduce the error regularly. Sometimes it just happens. But when it happens, also the startup sound is missing.

I furthermore don't pull the power cable but use the button method to turn the device off. Perhaps there is a problem with the sound card not turning off correctly or beeing in a hibernate mode. I will check again this week, if the problem will also come up with the onboard sound.

Berdsen avatar Jan 06 '19 20:01 Berdsen

When I have this error I hear the startup sound. I will check my mopidy.log if there are any errors.

Feuer-sturm avatar Jan 06 '19 21:01 Feuer-sturm

So I made a fresh install multiple times and I again had sometimes this error. But after reordering the sound cards like already mentioned in here it seems to work. I'm not quite sure but perhaps also forgetting to scan the library after adding new files could lead into this. I have forgotten it sometimes.

Berdsen avatar Jan 12 '19 20:01 Berdsen

Thanks for the link. I just made the reordering of the soundcard. I will have a look if the problem is fixed with this adaption.

Feuer-sturm avatar Jan 13 '19 20:01 Feuer-sturm

After doing the reordering there was no startup sound and there was no music when I swiped a RFID card. I used my backup of the sd card to get the phoniebox working. At the end of the week I will have some time to try once again the reordering.

@Berdsen : Did you just do the reording as described in the docs or did you do anything more?

Feuer-sturm avatar Jan 14 '19 19:01 Feuer-sturm

Reordering will not fix this issue. As I said, I set up a complete new sd card and the following setup: RPi 3B+, Micro SDHX 128GB, latest Raspbian, latest RPi Jukebox Spotify Edition (did a pip install pylast==2.4.0 before for fixing #436). I uploaded two audiobooks and I added a spotify user with around 30 playlists. I turned on mopidy debug log and added one playlist from spotify with around 80 tracks. After the next reboot, the same issue appeared. In the mopidy debug log you can see, that the mopidy-spotify will load all playlists into cache. That took around 5 minutes. After finishing that, the sound was set up to the initial 30% value and everything worked as expected. That seemed to happen not just only once, so I activated in the mopidy.conf the cache and playlist switches (uncommented). In the docs it is said, that it is the default, but after setting these explicit, I had now two days (and a lot of reboots) where it worked @SpookyFishes can you try and confirm this behaviour?

See also here

Berdsen avatar Jan 15 '19 18:01 Berdsen

I hope I will have some time on next weekend for testing your steps.

Feuer-sturm avatar Jan 15 '19 22:01 Feuer-sturm

@Berdsen : Is this the way you enabled the debug mode?

grafik

grafik

Can you please give the path where I can find the log file you looked at?

Feuer-sturm avatar Jan 20 '19 09:01 Feuer-sturm

@SpookyFishes After setting up the box up I connected to the webinterface and started the Iris spotify part and connected one plalist to a rfid chip.

After doing this I started a terminal and changed the loglevel in the logging section of the mopidy.conf from INFO to debug. Then I deleted the current logfile and rebooted the system.

sudo nano /etc/mopidy/mopidy.conf Change loglevel and save with Ctrl + X - > y - > Enter sudo rm /var/log/mopidy/mopid.log ( filename was perhaps error.log, can't check it now) reboot

After the next start you have a new log file and you can check what is done, when the box is initialized.

Berdsen avatar Jan 20 '19 12:01 Berdsen

Hello @Berdsen I just installed on a new sd card phoniebox software 1.1.9-rc6 with mopidy 3.31.8

The debug level I changed in /etc/mopidy/logging.conf with this new value level = DEBUG

The logfile will be stored here: /var/log/mopidy/mopidy.log

In file /etc/mopidy/mopidy.conf it looks like this:

[core]
cache_dir = /var/cache/mopidy
config_dir = /etc/mopidy
data_dir = /var/lib/mopidy

How did you activate the cache in mopidy.conf? Or did your mopidy.conf looked different? What do you mean with 'I activated in the mopidy.conf the cache and playlist switches (uncommented).'

At the moment I added one playlist with 50 songs to one rfid card. I will have a look if the problem is still there in the next days. If everything is fine I will add more spotify playlists to the accounts and to some new rfid cards.

Feuer-sturm avatar Jan 24 '19 20:01 Feuer-sturm

Hi I have the same problem with the Classic Edition 1.1.8-rc and the identical Sound Card. Where can I get logs? Thanks

iwishitwassummer avatar Jan 28 '19 21:01 iwishitwassummer

Hello @iwishitwassummer , what do you mean with "Where can I get logs". Please check my last posting

The logfile will be stored here: /var/log/mopidy/mopidy.log

At the moment I have just one spotify playlist integrated in my phoniebox. The rest of the music is stored as mp3s. I just made a fresh install 7 days ago with 1.1.9-rc6 and mopidy 3.31.8 and at the moment I didn't have the problem. In the next days I will add some more spotify playlist and I will have a look if the problem is will come back again.

Feuer-sturm avatar Jan 31 '19 20:01 Feuer-sturm

@SpookyFishes thanks, I wanted to check my logs but I have the classic edition, hence it's mpd.

iwishitwassummer avatar Feb 01 '19 20:02 iwishitwassummer

I'm using the + Spotify version of Phoniebox 1.1.9 and I'm gonna add my two cents to this issue. Please see section "Debugging" for additional information that might be helpful to pin this down.

Current behavior

  1. Boot Phoniebox
  2. Hear startup sound
  3. Swipe a card connected to a Spotify playlist/song or an MP3 file
  4. Delay of 1-2 minutes
  5. Spotify playlist/song or an MP3 is played
  6. Swipe another card connected to the same or another Spotify playlist/song or MP3 file
  7. Spotify playlist/song or MP3 file is played immediately

Hint: It doesn't matter how long I wait between step 2 and 3. Every first swipe is followed by the delay in step 4.

Debugging

Instead of swiping a card I've tried to start the rfid_trigger_play.sh script via SSH after hearing the startup sound. This throws the following error messages:

pi@raspberrypi:~ $ /home/pi/RPi-Jukebox-RFID/scripts/rfid_trigger_play.sh --cardid=0000243241
/home/pi/RPi-Jukebox-RFID/scripts/rfid_trigger_play.sh: line 358: [: -eq: unary operator expected
/home/pi/RPi-Jukebox-RFID/scripts/rfid_trigger_play.sh: line 362: [: too many arguments`

After 1-2 minutes the following messages appear and the sound is played.

volume: 30%   repeat: off   random: off   single: off   consume: off
volume: 30%   repeat: off   random: off   single: off   consume: off
volume: 30%   repeat: off   random: off   single: off   consume: off
loading: Piano C
OK MPD 0.19.0
OK

After this the sounds are immediately played and executing the script doesn't throw any errors any more:

pi@raspberrypi:~ $ /home/pi/RPi-Jukebox-RFID/scripts/rfid_trigger_play.sh --cardid=0000243241
volume: 30%   repeat: off   random: off   single: off   consume: off
volume: 30%   repeat: off   random: off   single: off   consume: off
volume: 30%   repeat: off   random: off   single: off   consume: off
loading: Piano C
OK MPD 0.19.0
OK

I don't have any coding experience hence I'm not able to use the error messages above to look at the code. But maybe it does ring a bell to anyone else?

mangenehm avatar Jun 08 '19 23:06 mangenehm

Hi, did you find a solution for that issue? Unfortunately I have the same problem.

MemanSH avatar Sep 06 '19 20:09 MemanSH

Unfortunately not.

mangenehm avatar Sep 08 '19 11:09 mangenehm

Ich habe das gleiche Problem, und bemerkt dass mopidy in dem Moment wo der Sound nicht geht nicht verbunden ist. Und glaube es liegt daran das die Zeit und das Datum nicht richtig sind. Evt kann man noch eine RTC nutzen. Bin mir aber noch nicht zu 100% sicher,

maddin78 avatar Sep 11 '19 15:09 maddin78

Thanks for the update, @maddin78! Keep us posted if you find something out. Would be great if we could solve this issue. My 2 year old is understandably too impatient to wait for so long after the box has booted and has crashed the box several times now. 😬

mangenehm avatar Sep 11 '19 18:09 mangenehm

I agree with @maddin78 finding assuming we are on the Spotify version. Sometimes it takes 5-8min till mopidy successfully connect As soon as mopidy is connected, local MP3 as well as Spotify works.

domu83 avatar Sep 11 '19 19:09 domu83

got it,

i installed a ds3231 rtc (other should work also) and now mopidy only takes a few seconds to connect

maddin78 avatar Sep 12 '19 18:09 maddin78

Great news! Thank you for sharing this. Now I have to wrap my head about how to add an rtc on top of the on/off shim. I will share my results once I have tested it.

mangenehm avatar Sep 13 '19 12:09 mangenehm

that is not a big deal, i use an on/off shim also. you only need to connect the rtc to pin 1-3-5-9 3.3v-SDA-SDL-Ground.

maddin78 avatar Sep 13 '19 12:09 maddin78

I have issues connecting the DS3231 to the Pi. I used the same pins you've mentioned and followed instructions on https://pimylifeup.com/raspberry-pi-rtc/ to configure the RTC. Unfortunately it doesn't show any ID when running sudo i2cdetect -y 1. Oddly it does show the ID when I use a freshly formatted SD card with a clean Raspbian Stretch on it.

I still have the feeling that the On/Off-Shim prevents the RTC from working. How did you install the On/Off-Shim @maddin78? Did you use the official software from Pimoroni? And did you do anything else to get the RTC running?

Thanks for your help!

mangenehm avatar Oct 10 '19 18:10 mangenehm

I use the original softtware from pimoroni. Did you try it on the same pi? I have first installed the on off shim and then the rtc.

maddin78 avatar Oct 22 '19 04:10 maddin78

Yes, I used the same Pi. I did run a few more tests and it doesn't seem to be connected to the Shim though. On a fresh Stretch system the RTC and the Shim work perfectly together. Once I install the Jukebox, the RTC stops working.

Did you do anything special to get the RTC running? Did you follow a tutorial on the web?

mangenehm avatar Oct 22 '19 10:10 mangenehm

Nothing special

In the next days i will set up a new jukebox and write down the steps

maddin78 avatar Nov 02 '19 08:11 maddin78

Yes, I used the same Pi. I did run a few more tests and it doesn't seem to be connected to the Shim though. On a fresh Stretch system the RTC and the Shim work perfectly together. Once I install the Jukebox, the RTC stops working.

Did you do anything special to get the RTC running? Did you follow a tutorial on the web?

I think it has something to do with i2c. I installed yesterday a new raspberry pi 3 with 2 i2c devices attached. After the fresh install of raspian stretch i2cdetect found the the devices. After installing the jukebox software i2cdetect was not able to detect any devices anymore. I tried the same with a new raspberry pi 4 with the same result. The same happened with raspian buster. I then used a backup from a old raspian installation where I had installed the jukebox already. i2cdetect found the devices with that without any problems. It looks for me that something get installed which prevents i2c from working.

swissmaster1 avatar Nov 24 '19 11:11 swissmaster1