Features

Phonograph

The music app: placing a phonograph, playing links and YouTube records for players nearby, turning the record to seek, playlists, sharing, tone, YouTube and Spotify links, import, and Config.Music.

Phonograph (music) plays music on phonographs the player sets up in the world. Players near a phonograph hear it. Settings are in apps/music/config.lua (Config.Music) and apps/music/config_server.lua.

#What the player can do

  • Place a phonograph: use the pocketbook_phonograph item (or the place button in the app), aim and confirm. The item goes into the world; picking the phonograph up gives it back.
  • Pick one of their phonographs and control it: play, pause, stop, next, previous, seek, volume, repeat, shuffle and the queue.
  • Volume is heard at once while the slider is dragged, by the owner and by the players nearby. The new level is saved when the slider rests for VolumeSaveDelay ms.
  • Turn the record by hand to seek: drag the record on the turntable clockwise to go forward, the other way to go back. The time and the slider follow and the owner hears the spot. On release one jump goes to the server, and listeners jump there without the record loading again. This works for records of known length.
  • Put a record on at once from a link, search records by name, or play from the server's own selection (Catalog). YouTube links from www.youtube.com, m.youtube.com (phone) and music.youtube.com all work.
  • Paste a YouTube playlist link (playlist?list=..., or watch?v=...&list=...): it opens the list import. This needs YouTubeApiKey on the server; without the key only the video named in the link plays, if it names one.
  • Keep a collection: playlists, favourites, history and play counters.
  • Share a playlist with a player close by. The other player sees a frozen copy and accepts or declines it.
  • Set the tone (bass, mid, treble, presets), a soft transition between records, and autoplay from suggestions.
  • Import a list and export one.
  • With Spotify set up: search record details and open official Spotify links. A pasted Spotify track, album or playlist link is matched to YouTube records: each record is searched as "artist - title", a hit within 10% of Spotify's length is preferred, a track goes on the turntable and a list replaces the queue. The player gets a note with how many were found. Spotify audio itself is never played in the game.

Looking at their own placed phonograph in the world, the owner can change the record, pause or play, skip, set the volume and pick it up. This uses your target script when one runs, otherwise hold prompts (E, R, G).

#What it needs

Need Notes
Item pocketbook_phonograph to place a phonograph
Signal Sending a new record, building playlists, search, import and sharing need signal

#Settings

Key Default What it does
Enabled true Turns the app on
Item / Model 'pocketbook_phonograph' / 'p_phonograph01x' The item and the world model
MaxPerCharacter 2 Phonographs one character can place
PlaceDistance / ControlDistance / MinSpacing 6.0 / 5.0 / 2.0 Metres for placing, for controlling, and between two phonographs
HearingDistance 25.0 Metres at which a phonograph is heard
StreamDistance 60.0 Metres at which the phonograph model is shown
MaxAudible 3 Phonographs one player hears at once
DefaultVolume 0.45 Starting volume
MaxQueue / MaxPlaylists / MaxTracks 50 / 20 / 100 Queue length, playlists, tracks per playlist
SearchCooldown / LinkCooldown 3000 / 3000 Ms between two searches, and between two links of one player
VolumeSaveDelay 2000 Ms the volume slider must rest before the new level is saved and logged. Listeners hear the change at once
AllowedHosts {} Hosts for direct audio links. Empty: any HTTPS host
YouTube true YouTube links and search
YouTubeSearch Direct = true, endpoint and client values, Language = 'tr', Country = 'TR', Timeout = 8000 Search by name without an API key. Direct = false turns the keyless search off
Interior.Mode / Interior.Volume 'muffle' / 0.45 A wall between listener and phonograph: 'muffle', 'mute' or 'off'
Target Enabled = true, System = nil, Distance = 2.0, Prompt = true, HoldTime = 600 World interaction. System = nil uses Config.TargetSystem of config_shops.lua
Target.Keys Change = 0xCEFD9220 (E), Toggle = 0xE30CD707 (R), Next = 0x760A9C6F (G) Hold prompts. false hides one
Spotify { Enabled = false, Market = 'TR', Limit = 10 } Spotify details search and pasted Spotify links. Needs the keys in config_server.lua
Spotify.Match Enabled = true, MaxTracks = 25, Wait = 500, Cooldown = 30000, MaxJobs = 2 Matching Spotify links to YouTube records, see below
AutoAdvance true The server moves to the next record when one ends
History { Enabled = true, Limit = 100, RetentionDays = 30 } Played records
Listening { Enabled = true, RetentionDays = 90 } Listening progress
Statistics { Enabled = true } Play counters
Crossfade { Enabled = true, MaxSeconds = 8 } Soft transition, direct audio only. Each phonograph starts at 0 (off)
Sharing Enabled = true, Range = 5.0, ExpireHours = 48, MaxIncoming = 20, MaxOutgoing = 10, CooldownSeconds = 15 Playlist sharing
Tone { Enabled = true } Bass, mid and treble from -6 to 6 dB. Direct audio only; YouTube cannot use it
Imports Enabled = true, YouTube = true, MaxTracks = 100, MaxScan = 300, CooldownSeconds = 5, ExpireMinutes = 30 List import
Recommendations Enabled = true, Personalize = true, Limit = 12, Autoplay = true Suggestions. Autoplay starts off on every phonograph until its owner turns it on
Catalog {} The server's own records and radio streams

A pasted Spotify link is matched to YouTube records, because Spotify audio cannot be streamed in the game. It needs Spotify.Enabled = true, the Spotify ClientId and ClientSecret in config_server.lua, YouTube = true and the record search (YouTubeSearch.Direct, or a YouTubeApiKey).

Spotify.Match key Default What it does
Enabled true false keeps the Spotify catalogue page but refuses pasted links
MaxTracks 25 Records matched per link. Also capped by MaxQueue
Wait 500 Ms between two searches
Cooldown 30000 Ms between two Spotify links of one player
MaxJobs 2 Links matched at the same time on the server

Spotify may refuse some playlist data to newly created apps (its own editorial and generated lists). User playlists, albums and tracks are read.

#Catalog

Fill Catalog only with playable links you are allowed to use:

luaCatalog = {
    { title = 'Record name', artist = 'Artist', url = 'https://cdn.myserver.com/record.ogg', duration = 180 },
},

#Server-only settings

apps/music/config_server.lua:

Key Default What it does
Spotify.ClientId / Spotify.ClientSecret '' Credentials of an app made on developer.spotify.com. Needed with Spotify.Enabled = true, for the catalogue page and pasted Spotify links
YouTubeApiKey '' Optional. With a key the official YouTube search is used and YouTube playlist links can be imported. Direct links need no key
Logs enabled, core webhook fallback This app's Discord log