Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 3 123 LastLast
Results 1 to 10 of 29
  1. #1

    Squeezelite: How to get the sample rate of the stream ???

    Hello,

    Probably very basic, but I spent hours looking all around and couldn't find the info.

    LMS is displaying the stream bitrate so the information should be easy to get
    Squeezelite with the resmple option also know the original sample rate as it can resample in sync mode

    I can get the hardware sample rate info from alsa but what I want to know is the stream sample rate before it is upsampled
    What is the command line ?

    Thank you.
    Jean

  2. #2
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    20,146
    This is usually part of LMS "more info" when track is playing.

    If a stream is downsampled - it will be because LMS has decided what is the maximum rate which all players in a sync group can support and when synced - resampling will be done by LMS not the player..
    Last edited by bpa; 2020-12-21 at 18:32.

  3. #3
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    1,180
    Quote Originally Posted by bidule View Post
    LMS is displaying the stream bitrate so the information should be easy to get
    Squeezelite with the resmple option also know the original sample rate as it can resample in sync mode
    I can get the hardware sample rate info from alsa but what I want to know is the stream sample rate before it is upsampled
    activate squeezelite's logging e.g.
    Code:
    squeezelite -d all=info ...
    it will output resampling info:
    Code:
    [08:54:48.785042] resample_newstream:189 resampling from 44100 -> 48000
    Various SW: Web Interface | TUI | Playlist Editor / Generator | Music Classification | Similar Music | Announce | EventTrigger | DB Optimizer | Chiptunes | LMSlib2go | ...
    Various HowTos: build a self-contained LMS | Bluetooth/ALSA | Control LMS with any device | ...

  4. #4
    Thank you to both of you for taking care.

    However, I'm not sure that I was clear with my question.

    I use squeezelite with the resample option activated on a Pi.
    Squeezelite upsample fine at the max Sync rate of my DAC that is 44K1 -> 176.4K and 48K -> 192K
    This I can be sure of, as I get the Squeezelite output stream info from the following :
    Playing a 44K1 file:
    Code:
    # cat /proc/asound/card0/pcm0p/sub0/hw_params
    access: MMAP_INTERLEAVED
    format: S32_LE
    subformat: STD
    channels: 2
    rate: 176400 (176400/1)
    period_size: 706
    buffer_size: 2824

    Playing a web radio (48K)
    Code:
    cat /proc/asound/card0/pcm0p/sub0/hw_params
    access: MMAP_INTERLEAVED
    format: S32_LE
    subformat: STD
    channels: 2
    rate: 192000 (192000/1)
    period_size: 768
    buffer_size: 3072

    And here is the result of
    Code:
    squeezelite -d all=info
    [13:20:30.877187] stream_init:448 init stream
    [13:20:30.884567] output_init_alsa:940 init output
    [13:20:30.884782] output_init_alsa:980 requested alsa_buffer: 40 alsa_period: 4 format: any mmap: 1
    [13:20:30.894822] test_open:281 playback open error: Device or resource busy
    [13:20:30.894959] output_init_common:394 unable to open output device: default
    root@StudioCube:~#
    root@StudioCube:~#
    root@StudioCube:~# squeezelite -d all=info
    [13:21:23.445301] stream_init:448 init stream
    [13:21:23.452988] output_init_alsa:940 init output
    [13:21:23.453208] output_init_alsa:980 requested alsa_buffer: 40 alsa_period: 4 format: any mmap: 1
    [13:21:23.533024] output_init_common:425 supported rates: 768000 705600 384000 352800 192000 176400 96000 88200 48000 44100 32000 24000 22500 16000 12000 11025 8000
    [13:21:23.553898] output_init_alsa:1006 memory locked
    [13:21:23.555051] output_init_alsa:1012 glibc detected using mallopt
    [13:21:23.557047] output_thread:687 open output device: default
    [13:21:23.557756] alsa_open:351 opening device at: 44100
    [13:21:23.636925] alsa_open:422 opened device default using format: S32_LE sample rate: 44100 mmap: 1
    [13:21:23.642707] alsa_open:513 buffer: 40 period: 4 -> buffer size: 1764 period size: 441
    [13:21:23.649591] decode_init:153 init decode
    [13:21:23.651425] load_faad:633 loaded libfaad.so.2
    [13:21:23.651536] register_faad:663 using faad to decode aac
    [13:21:23.654889] load_vorbis:351 loaded libvorbisfile.so.3
    [13:21:23.655016] register_vorbis:380 using vorbis to decode ogg
    [13:21:23.658369] load_flac:304 loaded libFLAC.so.8
    [13:21:23.658503] register_flac:332 using flac to decode ogf,flc
    [13:21:23.658562] register_pcm:483 using pcm to decode aif,pcm
    [13:21:23.661695] load_mad:394 loaded libmad.so.0
    [13:21:23.661832] register_mad:423 using mad to decode mp3
    [13:21:23.664125] discover_server:788 sending discovery
    [13:21:23.665466] discover_server:799 got response from: 192.168.1.10:3483
    [13:21:23.666345] slimproto:887 connecting to 192.168.1.10:3483
    [13:21:23.667379] slimproto:926 connected
    [13:21:23.668254] slimproto:937 local player
    [13:21:23.668406] sendHELO:142 mac: b8:27:eb:f0:1a:54
    [13:21:23.669736] sendHELO:144 cap: Model=squeezelite,AccuratePlayPoints=1,HasDigitalO ut=1,HasPolarityInversion=1,Firmware=v1.9.8-1307,ModelName=SqueezeLite,MaxSampleRate=768000,aa c,ogg,ogf,flc,aif,pcm,mp3,loc
    [13:21:23.695869] decode_flush:236 decode flush
    [13:21:23.696034] output_flush:438 flush output buffer
    [13:21:23.697920] decode_flush:236 decode flush
    [13:21:23.698143] output_flush:438 flush output buffer

    However what I need to get on the fly is the Squeezelite INPUT sample rate

    I'm sure that the Squeezelite Iput rate information is availlabe somehow as Squeezelite knows at which rate to do the upsampling.
    So my question is which command line will give me the Squeezelite INPUT Sample rate ?

    Thank you for your help.
    Jean

  5. #5
    Senior Member
    Join Date
    Aug 2012
    Location
    Austria
    Posts
    1,180
    Quote Originally Posted by bidule View Post
    [13:21:23.669736] sendHELO:144 cap: Model=squeezelite,AccuratePlayPoints=1,HasDigitalO ut=1,HasPolarityInversion=1,Firmware=v1.9.8-1307,ModelName=SqueezeLite,MaxSampleRate=768000,aa c,ogg,ogf,flc,aif,pcm,mp3,loc
    [13:21:23.695869] decode_flush:236 decode flush
    [13:21:23.696034] output_flush:438 flush output buffer
    [13:21:23.697920] decode_flush:236 decode flush
    [13:21:23.698143] output_flush:438 flush output buffer
    This doesn't look like you have actually played something

    However what I need to get on the fly is the Squeezelite INPUT sample rate
    I'm sure that the Squeezelite Iput rate information is availlabe somehow as Squeezelite knows at which rate to do the upsampling.
    There's no such thing as a fixed input sample rate.
    squeezelite indicates to LMS which sample rates are supported (MaxSampleRate). If a file's sample rate is <= MaxSampleRate, it's sent as is to squeezelite, which will re-sample or not, depending on the output device's capabilities. If a file's sample rate is > MaxSampleRate, LMS will transcode before transmitting it to squeezelite.
    Various SW: Web Interface | TUI | Playlist Editor / Generator | Music Classification | Similar Music | Announce | EventTrigger | DB Optimizer | Chiptunes | LMSlib2go | ...
    Various HowTos: build a self-contained LMS | Bluetooth/ALSA | Control LMS with any device | ...

  6. #6
    Senior Member
    Join Date
    Jan 2010
    Location
    Hertfordshire
    Posts
    6,262
    Quote Originally Posted by Roland0 View Post
    This doesn't look like you have actually played something


    There's no such thing as a fixed input sample rate.
    squeezelite indicates to LMS which sample rates are supported (MaxSampleRate). If a file's sample rate is <= MaxSampleRate, it's sent as is to squeezelite, which will re-sample or not, depending on the output device's capabilities. If a file's sample rate is > MaxSampleRate, LMS will transcode before transmitting it to squeezelite.
    The OP is forcing Squeezelite to upsample though.

    Sent from my Pixel 3a using Tapatalk

  7. #7
    Thank you Roland,
    Quote Originally Posted by Roland0 View Post
    This doesn't look like you have actually played something
    Well, you are absolutely right but I can't get in the same time squeezelite playing music and squeezelite -d all=info

    Quote Originally Posted by Roland0 View Post
    There's no such thing as a fixed input sample rate.
    That's again absolutely right, that is why I have my files upsampled from 44K1 to 176k4 and web radios upsampled from 48k to 192K.

    Quote Originally Posted by Roland0 View Post
    There's no such thing as a fixed input sample rate.
    That is not my point.

    Quote Originally Posted by Roland0 View Post
    Squeezelite indicates to LMS which sample rates are supported (MaxSampleRate). If a file's or STREAM sample rate is <= MaxSampleRate, it's sent as is to squeezelite, which will re-sample or not, depending on the output device's capabilities. If a file's sample rate is > MaxSampleRate, LMS will transcode before transmitting it to squeezelite.
    That's exact, so my question is still open, how can I get that incoming file/stream bitrate information from a comand line ?

    Lets say I ask for a Deezer track, LMS will stream that track to Squeezelite as is.
    Squeezelite will upsample it.
    What I want to know from a Linux command line is the original stream sample rate on the fly.
    I'm sure that information exist, I just don't know how to get it.

    Jean
    Last edited by bidule; 2020-12-22 at 09:26.

  8. #8
    Quote Originally Posted by bpa View Post
    This is usually part of LMS "more info" when track is playing.
    Name:  more info.jpg
Views: 116
Size:  14.4 KB
    Yes bpa, that is exactly what I want to get from a Linux command line.
    Is it possible ? and how ?
    Jean

  9. #9
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    20,146
    Quote Originally Posted by bidule View Post
    Name:  more info.jpg
Views: 116
Size:  14.4 KB
    Yes bpa, that is exactly what I want to get from a Linux command line.
    Is it possible ? and how ?
    I think you'll have to use CLI (i.e. curl with JSON) . I don't know the right command offhand.

  10. #10
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    20,146
    No need for JSON.

    From WebUI Help / technical Information / The Logitech server command line interface

    Status command shoud giev the info

    Code:
     <playerid> status <start> <itemsPerResponse> <taggedParameters>
    
    The "status" query returns the complete status about a given player, including the current playlist. Set the <start> parameter to "-" to get the playlist data starting from the current song.
    In this "curent" mode and if repeat is on, the server will attempt to return <itemsPerResponse> elements, by repeating the playlist at most once, unless shuffling is on and the server is configured to re-shuffle the playlist at each loop (in which case it is impossible to predict the song following the last one in the playlist until this last song has finished playing).
    Similarly, in the "curent" mode, if repeat is one, only the current song is returned, regardless of the value of <itemsPerResponse>.
    Clients can subscribe to "status" queries, so that the query results are automatically returned asynchronously whenever a change occurs to a player. Please note this mechanism is completely distinct from the "listen" and "subscribe" commands described elsewhere in this document.
    
    Accepted tagged parameters:
    Tag 	Description
    tags 	Determines which tags are returned. Each returned tag is identified by a letter (see command "songinfo" for a list of possible fields and their identifying letter). The default tags value for this query is "gald". In addition to the tags supported by "songinfo" there's the special "DD" tag, which would return no track information, but the total duration of the current playlist only.
    subscribe 	This optional parameter controls the subscription to the player status. Only one status subscription is possible per player and connection.
    Subscription is enabled by using this parameter with a positive integer. It is disabled by using "-". When the subscription is enabled, normal "status" queries (i.e. not using the "subscribe" parameter) can be performed and will have no effect on the subscription in place.
    When enabled, the "status" request is automatically re-generated on player change (and sent asynchronously to the CLI client). The number indicates the time interval in seconds between automatic generations in case nothing happened to the player in the interval. Use "0" to disable this last feature and only be notified on player or playlist changes. .
    .
    .
    .Example:
    
        Simple example
        Request: "a5:41:d2:cd:cd:05 status 0 2 tags:<LF>"
        Response: "a5:41:d2:cd:cd:05 status 0 2 tags: player_name:127.0.0.1 player_connected:1 power:1 mode:play rate:1 time:13.7129358076728 duration:252.630204081633 mixer%20volume:50 mixer%20treble:50 mixer%20bass:50 mixer%20pitch:100 playlist%20repeat:2 playlist%20shuffle:0 playlist_cur_index:1 playlist_tracks:3 playlist%20index:0 title:Left%20Outside%20Alone playlist%20index:1 title:Bounce%20[Original%20Version]<LF>"
    
        Current mode example
        Request: "a5:41:d2:cd:cd:05 status - 2 tags:<LF>"
        Response: "a5:41:d2:cd:cd:05 status - 2 tags: player_name:127.0.0.1 player_connected:1 power:1 mode:play rate:1 time:18.721127818274 duration:252.630204081633 mixer%20volume:50 mixer%20treble:50 mixer%20bass:50 mixer%20pitch:100 playlist%20repeat:2 playlist%20shuffle:0 playlist_cur_index:1 playlist_tracks:3 playlist%20index:1 title:Bounce%20[Original%20Version] playlist%20index:2 title:Open%20Up%20[Radio%20Edit]<LF>"
    
        Subscribe mode example
        Request: "a5:41:d2:cd:cd:05 status - 2 subscribe:30<LF>"
        Response: "a5:41:d2:cd:cd:05 status - 2 subscribe:30 player_name:127.0.0.1 ... (same as above)
    
        10 seconds later, player is turned off, CLI generates and sends:
        "a5:41:d2:cd:cd:05 status - 2 subscribe:30 player_name:127.0.0.1 player_connected:1 power:0<LF>"
    
        30 seconds (the subscribe value) elapse, no changes to the player, the CLI generates and sends:
        "a5:41:d2:cd:cd:05 status - 2 subscribe:30 player_name:127.0.0.1 player_connected:1 power:0<LF>"
    songinfo tags
    Code:
     	Tag 	Description
    	rescan 	Returned with value 1 if the server is still scanning the database. The results may therefore be incomplete. Not returned if no scan is in progress.
    	count 	Number of results returned by the query, that is, total number of elements to return for this song.
    	id 	Track ID.
    	title 	Song title
    a 	artist 	Artist name.
    A 	<role> 	For every artist role (one of "artist", "composer", "conductor", "band", "albumartist" or "trackartist"), a comma separated list of names.
    B 	buttons 	A hash with button definitions. Only available for certain plugins such as Pandora.
    c 	coverid 	coverid to use when constructing an artwork URL, such as /music/$coverid/cover.jpg
    C 	compilation 	1 if the album this track belongs to is a compilation
    d 	duration 	Song duration in seconds.
    e 	album_id 	Album ID. Only if known.
    f 	filesize 	Song file length in bytes. Only if known.
    g 	genre 	Genre name. Only if known.
    G 	genres 	Genre names, separated by commas (only useful if the server is set to handle multiple items in tags).
    i 	disc 	Disc number. Only if known.
    I 	samplesize 	Song sample size (in bits)
    j 	coverart 	1 if coverart is available for this song. Not listed otherwise.
    J 	artwork_track_id 	Identifier of the album track used by the server to display the album's artwork. Not listed if artwork is not available for this album.
    k 	comment 	Song comments, if any.
    K 	artwork_url 	A full URL to remote artwork. Only available for certain online music services.
    l 	album 	Album name. Only if known.
    L 	info_link 	A custom link to use for trackinfo. Only available for certain online music services.
    m 	bpm 	Beats per minute. Only if known.
    M 	musicmagic_mixable 	1 if track is mixable, otherwise 0.
    n 	modificationTime 	Date and time song file was last changed on disk.
    N 	remote_title 	Title of the internet radio station.
    o 	type 	Content type. Only if known.
    p 	genre_id 	Genre ID. Only if known.
    P 	genre_ids 	Genre IDs, separated by commas (only useful if the server is set to handle multiple items in tags).
    D 	addedTime 	Date and time song file was first added to the database.
    U 	lastUpdated 	Date and time song file was last updated in the database.
    q 	disccount 	Number of discs. Only if known.
    r 	bitrate 	Song bitrate. Only if known.
    R 	rating 	Song rating, if known and greater than 0.
    O 	playcount 	Song play count.
    s 	artist_id 	Artist ID.
    S 	<role>_ids 	For each role as defined above, the list of ids.
    t 	tracknum 	Track number. Only if known.
    T 	samplerate 	Song sample rate (in KHz)
    u 	url 	Song file url.
    v 	tagversion 	Version of tag information in song file. Only if known.
    w 	lyrics 	Lyrics. Only if known.
    x 	remote 	If 1, this is a remote track.
    E 	extid 	Some tracks have an external identifier (eg. from an online music service).
    X 	album_replay_gain 	Replay gain of the album (in dB), if any
    y 	year 	Song year. Only if known.
    Y 	replay_gain 	Replay gain (in dB), if any

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •