Yado_tech

旅館+ITとはなんぞ

サーバー変更につきraspotify→spoconに変更した。


[2023/05/27追記] spotifyの認証周りが変更されたので、librespotのバージョンを確認する必要があります。 こちらからlibrespot-api-1.6.3.jarをダウンロードし、 opt/spocon/llibrespot-java-api-v1.6.2.jarを削除し、librespot-api-1.6.3.jarをlibrespot-java-api-v1.6.2.jarと同名に書き換えた後、spoconを再起動する必要があります。

github.com


音楽サーバーをラズパイからheroboxに変更した。

raspotifyが少し不安定になりそうだったのでspoconに変更した。

github.com

基本的なインストール方法、運用方法はraspotifyと同じなのだが、設定は opt/spocon/conig.toml にて行うようになっている。

config.tomlはこんな感じ

### 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 = "AUDIO_DONGLE"
### Device name ###
deviceName = "【ここに名前】"
### 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 = ""
    # 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 = "USER_PASS"
    # Spotify username (BLOB, USER_PASS only)
    username = "【ここにユーザー名】"

### Preload ###
[preload]
    # Preload enabled
    enabled = true

### Network ###
[network]
    # If ping isn't received within this amount of seconds, reconnect
    connectionTimeout = 10

### 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"
    # Connect to proxy using SSL (HTTP only)
    ssl = false
    # 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 = 1704

### Shell ###
[shell]
    onTrackSeeked = ""
    onStartedLoading = ""
    onConnectionDropped = ""
    onMetadataAvailable = ""
    onTrackChanged = ""
    onPanicState = ""
    onFinishedLoading = ""
    # Shell events enabled
    enabled = false
    onPlaybackResumed = ""
    onConnectionEstablished = ""
    onPlaybackEnded = ""
    onContextChanged = ""
    # Execute the command with `bash -c`
    executeWithBash = false
    onPlaybackPaused = ""
    onInactiveSession = ""
    onVolumeChanged = ""

### 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
    # Whether librespot-java should ignore volume events, sink volume is set to the max
    bypassSinkVolume = false
    # Release mixer line after set delay (in seconds)
    releaseLineDelay = 20
    # Normalisation pregain in decibels (loud at +6, normal at +3, quiet at -5)
    normalisationPregain = 0.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 = "VORBIS_320"
    # Where librespot-java should search for local files
    localFilesPath = ""
    # Audio output device (MIXER, PIPE, STDOUT, CUSTOM)
    output = "PIPE"
    # Crossfade overlap time (in milliseconds)
    crossfadeDuration = 0
    # Audio output Java class name
    outputClass = ""
    # Whether the player should retry fetching a chuck if it fails
    retryOnChunkError = true
    # Mixer/backend search keywords (semicolon separated)
    mixerSearchKeywords = ""
    # Output raw (signed) PCM to this file (`player.output` must be PIPE)
    pipe = "/tmp/snapfifo"
    # Log available mixers
    logAvailableMixers = true
    # Number of volume notches
    volumeSteps = 64


基本的に編集してもらうところには【】をつけています。

しかしUbuntuだとなぜかなりませんでした。

ということでcat /dev/urandom > /tmp/snapfifoとしてみるとpermission deniedとでたので所有権がらみで音が出てないみたいでした。

unix.stackexchange.com

てことでsudo chmod -t /tmpとしたら上手くいきました。