Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 6 of 6
  1. #1
    Junior Member
    Join Date
    Sep 2021
    Posts
    3

    Raspberry Pi Squeezelite not honoring WaveInput sample rate

    Hello.

    I am running LMS on a Windows PC to listen to music on a Raspberry Pi (raspbian) running Squeezelite with a Hifiberry DAC2 HD hat. This combination has worked well for me with the exception being hearing some pops and crackles when the DAC changes sample rates. That's not the issue I'm trying to fix though.

    What I need help with is getting the Squeezelite or the DAC? to honor the sample rate I set with wavin2cmd. I am trying to stream SiriusXM/Spotify playing on my Windows PC to the Pi. When I set wavin2cmd.exe with "-s 44100 -b 16" the sound works although I had to turn the volume down on my computer to get rid some distortion I was hearing. But when I set wavin2cmd.exe with "-s 96000 -b 16" the music plays in slow-motion on the Pi. I checked the alsa settings on the Pi when this happens and see it shows the DAC sample rate still set at 44100, it's not changing to 96000 as I would expect.


    cat /proc/asound/card0/pcm0p/sub0/hw_params

    access: MMAP_INTERLEAVED
    format: S32_LE
    subformat: STD
    channels: 2
    rate: 44100 (44100/1)
    period_size: 441
    buffer_size: 1764


    Has anyone here run into this sort of issue that can help me? I'd also like help understanding WaneInput more. I don't understand the difference between pcm, flc, and mp3. I've only been able to get WaveInput to stream to the Pi when I use the pcm settings. Below is my custom-convert.conf file.


    wavin pcm * *
    # R
    [wavin2cmd] -w -o $FILE$ -s 44100 -b 16


    Reading older posts I manually captured output and was able to play it just fine with ffplay on the Windows PC using the commands below.


    wavin2cmd.exe -w wave -s 96000 -b 16 -o wavin:0 > audiocapture.wav
    ffplay -f s16le -ar 96000 -ac 2 audiocapture.wav

  2. #2
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    20,754
    The conf file entry is "wavin pcm" that is the plugin supplies a PCM stream.

    PCM stream has no header and there is nothing in the PCM sample which provides the format (unlike for example Flac or MP3) so LMS does not know from the stream what is the sample format and so LMS assumes CD (44.1kHz 16 bit 2 chan)

    If you want to change sample rate from CD etc you should add a WAV or Flac rules which have header and so LMS will know what the source format is.

  3. #3
    Junior Member
    Join Date
    Sep 2021
    Posts
    3
    Thanks BPA. Changing the custom-convert.conf file fixed the sample rate on the Pi. Any advice on how to optimize the sound quality? Even after lowering the sound and stereo mix levels the sound sounds a bit canny. Do you know if a new sound card would help? Currently using the builtin card on my motherboard. Sound card is capable of 192/24 but recording/stereo mix only allow max of 96/16.

    wavin flc * *
    # R
    [wavin2cmd] -o $FILE$ -s 96000 -b 16 | [flac] -cs --totally-silent --compression-level-0 --endian=little --sign=signed --channels=2 --sample-rate=96000 --bps=16 -

  4. #4
    Junior Member
    Join Date
    Sep 2021
    Posts
    3
    Changing --compression-level-0 to --compression-level-8 improved the sound but increased the delay. I can live with this. Sounds much better.

  5. #5
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    20,754
    Quote Originally Posted by hafnpin View Post
    Thanks BPA. Changing the custom-convert.conf file fixed the sample rate on the Pi. Any advice on how to optimize the sound quality? Even after lowering the sound and stereo mix levels the sound sounds a bit canny. Do you know if a new sound card would help? Currently using the builtin card on my motherboard. Sound card is capable of 192/24 but recording/stereo mix only allow max of 96/16.
    Comments below assume only one soundcard.

    Different/higher sample rate are unlikely to help unless the source application "knows" it is outputting to the sample rate.
    IIRC Most Windows applications output at 48/16 (and windows system sounds) and so Windows Audio converts everything to that rate.

    A better soundcard won't help - wavin.exe takes the audio directly from Windows Audio API before the PCM samples before being sent to audio card but after Windows messing about with the Audio.

    As system audio output on Windows can be shared/mixed amongst all application - Audio quality can vary depending on what is running. I suggest make sure only the only audio "playing" application is running(i.e. no other application or explorer etc) and turn off all Windows sound effects/processing and probably use 48000 or 44100 16 bit.

    A second dedicated audio card (e.g. usb audio) might produce different results freed from shared use with Windows apps. AS PCM samples are being gathered before the sound card the "quality" of the audio card doesn;t matter - just that it is an output not being used by anything else.

  6. #6
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    20,754
    Quote Originally Posted by hafnpin View Post
    Changing --compression-level-0 to --compression-level-8 improved the sound but increased the delay. I can live with this. Sounds much better.
    That makes little sense - expectation bias ?

    Flac is lossless - so audio stream output from flac is identical regardless of compression level used.

    Processing power to decompress level 8 is usually higher and has caused problems for some players especially at 96000..

Tags for this Thread

Posting Permissions

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