Closed Zageron closed 3 years ago
Can you try starting the playback, pausing, waiting 30 seconds and then executing speaker-test -dcard:Device
. The device should be released after 20 seconds of inactivity (and also when the session is closed).
My config: (Note that I changed the releaseLineDelay
to 2.)
### Device type (COMPUTER, TABLET, SMARTPHONE, SPEAKER, TV, AVR, STB, AUDIO_DONGLE, GAME_CONSOLE, CAST_VIDEO, CAST_AUDIO, AUTOMOBILE, WEARABLE, UNKNOWN_SPOTIFY, CAR_THING, UNKNOWN) ###
deviceType = "COMPUTER"
### Device name ###
deviceName = "SpotiPi"
### Device ID (40 chars, leave empty for random) ###
deviceId = ""
### Log level (OFF, FATAL, ERROR, WARN, INFO, DEBUG, TRACE, ALL) ###
logLevel = "TRACE"
### Preferred locale ###
preferredLocale = "en"
### Cache ###
[cache]
dir = "./cache/"
# Cache enabled
enabled = true
doCleanUp = true
### Authentication ###
[auth]
# Credentials file (JSON)
credentialsFile = "credentials.json"
# Spotify password (USER_PASS only)
password = ""
# Spotify authentication blob Base64-encoded (BLOB only)
blob = ""
# Whether to store reusable credentials on disk (not a plain password)
storeCredentials = false
# Strategy (USER_PASS, ZEROCONF, BLOB, FACEBOOK, STORED)
strategy = "ZEROCONF"
# Spotify username (BLOB, USER_PASS only)
username = ""
### Preload ###
[preload]
# Preload enabled
enabled = true
### Proxy ###
[proxy]
# Basic auth password
password = ""
# The proxy hostname
address = ""
# The proxy port
port = 0
# Whether authentication is enabled on the server
auth = false
# The proxy type (HTTP, SOCKS)
type = "HTTP"
# Whether the proxy is enabled
enabled = false
# Basic auth username
username = ""
### Zeroconf ###
[zeroconf]
# Listen on all interfaces (overrides `zeroconf.interfaces`)
listenAll = true
# Listen on these interfaces (comma separated list of names)
interfaces = ""
# Listen on this TCP port (`-1` for random)
listenPort = -1
### Time correction ###
[time]
# Manual time correction in millis
manualCorrection = 0
# Time synchronization method (NTP, PING, MELODY, MANUAL)
synchronizationMethod = "NTP"
### API ###
[api]
# API port (`api` module only)
port = 24879
# API listen interface (`api` module only)
host = "0.0.0.0"
### Player ###
[player]
# Whether to apply the Spotify loudness normalisation
enableNormalisation = true
# Initial volume (0-65536)
initialVolume = 65536
# Release mixer line after set delay (in seconds)
releaseLineDelay = 2
# Normalisation pregain in decibels (loud at +6, normal at +3, quiet at -5)
normalisationPregain = 3.0
# Output metadata in Shairport Sync format (https://github.com/mikebrady/shairport-sync-metadata-reader)
metadataPipe = ""
# Autoplay similar songs when your music ends
autoplayEnabled = true
# Preferred audio quality (NORMAL, HIGH, VERY_HIGH)
preferredAudioQuality = "VERY_HIGH"
# Audio output device (MIXER, PIPE, STDOUT)
output = "MIXER"
# Crossfade overlap time (in milliseconds)
crossfadeDuration = 0
# Whether the player should retry fetching a chuck if it fails
retryOnChunkError = true
# Mixer/backend search keywords (semicolon separated)
mixerSearchKeywords = "Device [plughw:1,0]"
# Output raw (signed) PCM to this file (`player.output` must be PIPE)
pipe = ""
# Log available mixers
logAvailableMixers = true
# Number of volume notches
volumeSteps = 64
❯ speaker-test -dcard:Device -c2
speaker-test 1.1.8
Playback device is default Stream parameters are 48000Hz, S16_LE, 2 channels Using 16 octaves of pink noise Rate set to 48000Hz (requested 48000Hz) Buffer size range from 96 to 262144 Period size range from 48 to 131072 Using max buffer size 262144 Periods = 4 was set period_size = 65536 was set buffer_size = 262144 Hardware PCM card 1 'USB Modi Device' device 0 subdevice 0 Its setup is: stream : PLAYBACK access : RW_INTERLEAVED format : S16_LE subformat : STD channels : 2 rate : 48000 exact rate : 48000 (48000/1) msbits : 16 buffer_size : 262144 period_size : 65536 period_time : 1365333 tstamp_mode : NONE tstamp_type : MONOTONIC period_step : 1 avail_min : 65536 period_event : 0 start_threshold : 262144 stop_threshold : 262144 silence_threshold: 0 silence_size : 0 boundary : 1073741824 appl_ptr : 0 hw_ptr : 0 0 - Front Left 1 - Front Right Time per period = 5.539558 0 - Front Left 1 - Front Right Time per period = 4.040951
*Plays Sound* ^
- `speaker-test -dcard:Device -c2` works.
- `sudo speaker-test` or `speaker-test -c2` works.
Alright, time to open spotify.
- On my PC, I select SpotiPi. (On an android and iphone device SpotiPi does not appear until it has been activated on the PC.)
![image](https://user-images.githubusercontent.com/1892473/103375913-27e50a80-4a90-11eb-89fd-72b91514b951.png)
- This connection tool 50 seconds to appear in desktop spotify.
- Pressing play on a file resulted in no output on the speakers.
- Pausing and unpausing resulted in the connection switching to my phone's instance with no prompt.
- I am not unable to switch to SpotiPi from the PC.
- Attempting from my phone resulted in no success.
- Closing and reopening Spotify on my PC allowed me to connect to SpotiPi.
- Playing audio at this point does not function.
Back to speaker-test.
- Wait 30 seconds:
```zsh
❯ speaker-test -c2
speaker-test 1.1.8
Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
Playback open error: -16,Device or resource busy
❯ speaker-test -c2
speaker-test 1.1.8
Playback device is default Stream parameters are 48000Hz, S16_LE, 2 channels Using 16 octaves of pink noise Rate set to 48000Hz (requested 48000Hz) Buffer size range from 96 to 262144 Period size range from 48 to 131072 Using max buffer size 262144 Periods = 4 was set period_size = 65536 was set buffer_size = 262144 0 - Front Left 1 - Front Right Time per period = 20.341798
## Fresh Reboot
- `sudo reboot`
- Connect to SpotiPi (connection took about 30 seconds)
- Pressing play results in audio.
- Pause spotify.
- Wait 30 seconds.
- `speaker-test -c2`: Pink noise outputs.
- Repeat test results in the same audio.
- Pressing play in spotify results in no audio.
- Pause spotify.
- Immediate `speaker-test -c2` results in `Playback open error: -16,Device or resource busy`
- Wait 30 seconds.
- `speaker-test -c2`: No audio.
## Another fresh reboot attempt
- `sudo reboot`
- Connect to SpoiPi (connection took 60 seconds)
- Pressing play resulted in 1 second of audio, and then nothing.
- Pause spotify.
- Wait 30 seconds.
- `speaker-test -c2`: Device Busy
- `sudo systemctl restart spocon`
- `speaker-test -c2`: No audio.
## Attempt number 3:
- Reboot
- Connect to SpotiPi
- Play
- Pause
- speaker-test: (good, period 3 seconds)
- Play (Got audio)
- Pause
- speaker-test: (no audio, not busy, period 20 seconds again)
- Play (no audio)
https://pastebin.com/u5ayZSBD
I've ordered a Raspberry Pi 4 so I can use the likely better supported Java11 to see if it works better.
As you can see there is no clear pattern in what's happening. The fact is that a Raspberry Pi Zero can't run a Java program properly and in a reliable way. You'll see many of this problems disappear on the Raspberry Pi 4 (hopefully).
Yeah everything worked flawlessly on the first try with rpi4 and performance is far superior. Perhaps you should add a warning at the front that using a Raspberry Pi Zero W is unsupported and wont work as expected.
Thanks!
Describe the bug When librespot / spocon stops playback, I believe the device is left open and is not forcefully reopened or killed when a new playback attempt is made. There are no clear logs that describe this. Spotify continues to play back, but no audio is heard.
To Reproduce
Additionally:
Expected behavior
Screenshots/Stracktraces/Logs
Version/Commit 1.5.3
Using alsa.
I did see this in the logs, not sure if it helps.