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

    Squeezelite on Pi4 playing way too fast

    Just got Squeezelite running on Raspberry Pi 4 (Raspbian Desktop) using an AudioInjector Stereo hat. Plays fine for a while then starts stuttering. However, I didn't realize that the playback speed/pitch of the music was way to fast/high until I played a song that I knew the relative correct pitch for (Pink Floyd's "Breathe" from Dark Side of the Moon) So I synchronized another player with the Pi4/Squeezelite and boy was there a lot of synchronization noise... stuttering, skipping, etc. At first I wanted to blame the audio card as I had read of a similar problem with another Pi Hat brand. However, when I played the same song from a network MP3 file via VLC the playback speed was normal.

    So, something in my Squeezelite setup somehow isn't right. Perhaps something relating playback clock timing or perhaps sample rates?

    Any advice and guidance is greatly appreciated!

  2. #2
    Looks Like I figured out how to capture a Squeezelite Logfile: (See Attachment)
    Attached Files Attached Files

  3. #3
    Senior Member
    Join Date
    Jan 2011
    Location
    Staffordshire. UK
    Posts
    3,096
    Hi Michael

    Try changing

    squeezelite_settings.sh file contents:

    SL_SOUNDCARD="dmix:CARD=audioinjectorpi"

    to

    SL_SOUNDCARD="hw:CARD=audioinjectorpi,DEV=0"

    and adjust any other alterations to default settings

    ronnie

    Edit:

    I have not looked at the log as I don't know what to look for

    Edit2: I have now looked at the log and I was right.......I don't know what to look for
    Last edited by Man in a van; 2020-01-15 at 04:31.

  4. #4
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    18,079
    The log shows the output device being opened at 44100.

    Usually when something is played fast - it is a 44100 being played at 48000 so speed increase is slight about 8%
    Sometime the issues is a mono file being played so track is played at twice the speed.
    Other rarer problem is sample size.

    What is the specific speed difference ? (e.g. how long does track to play vs what is the duration according to LMS) - the specifc difference will point at the issue.

    Isd the track playing direct or through some transcoder or other processing (e.g. BrutFIR, C3PO, upsampling, downsampling)

    What does LMS say the characteristics of the problem track ? (i.e. drill down through GUI to get sample rate , sample size, number of channels).
    What does VLC say the characteristics of the problem track ? (i.e. Tools/Codec tab on GUI).

    edit:

    Code:
    22:08:33.053960] sendRESP:220 RESP
    [22:08:33.064928] mad_decode:244 setting track_start
    [22:08:33.065184] mad_decode:273 gapless: skipping 529 frames at start
    [22:08:33.105470] _output_frames:64 start buffer frames: 52463
    [22:08:33.105639] _output_frames:149 track start sample rate: 44100 replay_gain: 0
    [22:08:33.115742] output_thread:687 open output device: dmix:CARD=audioinjectorpi,DEV=0
    [22:08:33.117317] alsa_open:351 opening device at: 44100
    [22:08:33.124738] alsa_open:422 opened device dmix:CARD=audioinjectorpi,DEV=0 using format: S32_LE sample rate: 44100 mmap: 1
    [22:08:33.124869] alsa_open:513 buffer: 40 period: 4 -> buffer size: 4096 period size: 1024
    Last edited by bpa; 2020-01-15 at 07:37.

  5. #5
    You guys are incredible detectives and I'm learning an awful lot. I'm very glad I decided to take this project on and engage the support of the forums as it's filling in a lot of the knowledge gaps I've had around my love of both computers and audio.

    Here's what I've discovered:

    @Ronnie - Your suggestion of switching the Squeezelite Soundcard setting was well targeted: I changed the SoundCard line in /usr/local/bin/squeeezelite_settings.sh from SL_SOUNDCARD="dmix:CARD=audioinjectorpi" to SL_SOUNDCARD="hw:CARD=audioinjectorpi,DEV=0". This made Squeezelite play at normal speed/pitch again (see results below). Of note, I DID leave on the DEV=0," on the entry as it was already there. However, when I tried to simultaneously play another audio file in VLC, an error was returned in VLC stating that the audio device DMIX was "Busy". When I changed the entry back to DMIX the playback speed and pitch in Squeezelite increased again, but also, as expected, audio sharing was re-established across applications.

    @Bpa - Thanks for suggesting the details of the files. Note that both playback time and pitch are affected. As far as I can tell, the track isn't being played back through any kind of transcoders or processing. Or at least, I haven't set any up, so if they are they are part of the default install of my AudioInjector card, LMS or Squeezelite I suppose. The test file is an MP3 stored on a USB drive attached to a networked PC. However, I also notice that playback of a network stream (SomaFM, Venice Classic Radio) also renders the same problem affecting both speed and pitch. (I wasn't sure until I chose a Classic Rock radio station where I could hear familiar music - Tom Petty's Refugee as if he's 9 years old ). After a few minutes of playback I hear "corrections" in the stream dropping, skipping, stuttering.

    Of note, VLC's playback speed/pitch doesn't appear to be affected by DMIX. It seems that Squeezelite gets a little "excited" being hooked up to the ALSA Dmix plugin. If you guys like I could make an audio capture of the differences in pitch for your listening pleasure. 9 year old David Gilmore .

    STATISTICS

    Windows Attributes:
    Speak To Me - Breathe
    Length: 03:57
    Bit rate: 128kbs
    Size: 3.62mb
    ===========================================
    VLC Codec Info on Windows
    Codec: MPEG Audio layer 1/2 (mpga)
    Type: Audio
    Channels: Stereo
    Sample Rate: 44100 Hz
    Bits per sample: 32
    Bitrate: 128 kb/s
    ===========================================
    VLC Codec Info on Pi
    Codec: MPEG Audio layer 1/2 (mpga)
    Type: Audio
    Channels: Stereo
    Sample Rate: 44100 Hz
    Bits per sample: 32
    Bitrate: 128 kb/s
    ===========================================
    LMS File Attributes
    File Format: MP3
    Duration: 3:57
    Bitrate: 128kbps CBR
    Sample Rate: 44.1 kHz
    File Length: 3,799,144
    URL: tmp:///G:/Mp3/M - R/Pink Floyd/Dark Side Of The Moon/01_Speak To Me - Breathe.mp3
    Tag Version: ID3v2.3.0, ID3v1.1
    View Tags
    Title: Speak To Me - Breathe
    ===========================================
    Playback Times:
    Squeezelite time to play 3:57 sec file when HW is selected - 3:57
    Squeezelite time to play 3:57 sec file when DMIX is selected - 3:38 (19 seconds faster)
    VLC Windows time to play 3:57 sec file - 3:57
    VLC Pi time to play 3:57 sec file when HW is selected - 3:57
    VLC Pi time to play 3:57 sec file when DMIX is selected - 3:57

  6. #6
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    18,079
    Quote Originally Posted by noexit View Post
    Playback Times:
    Squeezelite time to play 3:57 sec file when HW is selected - 3:57
    Squeezelite time to play 3:57 sec file when DMIX is selected - 3:38 (19 seconds faster)
    VLC Windows time to play 3:57 sec file - 3:57
    VLC Pi time to play 3:57 sec file when HW is selected - 3:57
    VLC Pi time to play 3:57 sec file when DMIX is selected - 3:57
    The ratio of 3:57 to 3:38 is the same as 48000 to 44100. Squeezelite doesn;t do anything specific to pitch - the issues is purely speed - the rate at which samples are played back.
    Squeezelite just opens ALSA - ALSA is supposed to do the work - it looks like a ALSA DMIX issue.

    Are you trying to mix a 48kHz stream with the playback of a 44.1kHz squeezleite output ?

    edit:
    According to this post dmix only supports a fixed sample rate. which measn if you are mixing 44.1kHz with 48kHz - no upsampling will take place.
    https://unix.stackexchange.com/quest...an-application
    Last edited by bpa; 2020-01-15 at 11:11.

  7. #7
    Quote Originally Posted by bpa View Post
    Are you trying to mix a 48kHz stream with the playback of a 44.1kHz squeezleite output ?
    Not intentionally. I'm simply using this Pi to act as a "media PC" where the family can play what they like on it on the family room TV and speakers. I take the audio from the TV (HDMI Firestick, Roku, Chromecast attached) and send it to the input of the Pi to be simply passed on to the output and thus the speakers. I also intend to play local media via VLC or Web via Chromium Browser on the desktop using the TV as it's monitor. So, if the AudioInjector Soundcard on the Pi is generating a 48kHz stream I'm not sure where it would be. Perhaps from it's RCA Line IN?

    EDIT--- HOT DAMN - I THINK I FOUND IT!!! Based on your clues I found this in the Asoundrc page of the AlsaProject: (https://www.alsa-project.org/main/index.php/Asoundrc)
    Some notes:

    The dmix PCM name is already defined in the global configuration file /usr/share/alsa/alsa.conf.

    - The default sample rate for this device is 48000Hz. If you would like to change it use:

    aplay -D"plug:'dmix:RATE=44100'" test.wav
    So I changed the following line in /usr/share/alsa/alsa.conf
    to now read defaults.pcm.dmix.rate 41000 It was, by default, 48000.

    Reboot and now ole David Gilmore is sounding all grown up again and I can simultaneously play Spongebob on the VLC player! You guys are awesome! Come to the US and I'll buy you all a few beers and make you some homemade Pizza!

  8. #8
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    18,079
    Quote Originally Posted by noexit View Post
    Not intentionally. I'm simply using this Pi to act as a "media PC" where the family can play what they like on it on the family room TV and speakers. I take the audio from the TV (HDMI Firestick, Roku, Chromecast attached) and send it to the input of the Pi to be simply passed on to the output and thus the speakers. I also intend to play local media via VLC or Web via Chromium Browser on the desktop using the TV as it's monitor. So, if the AudioInjector Soundcard on the Pi is generating a 48kHz stream I'm not sure where it would be. Perhaps from it's RCA Line IN?

    EDIT--- HOT DAMN - I THINK I FOUND IT!!! Based on your clues I found this in the Asoundrc page of the AlsaProject: (https://www.alsa-project.org/main/index.php/Asoundrc)

    So I changed the following line in /usr/share/alsa/alsa.conf
    to now read defaults.pcm.dmix.rate 41000 It was, by default, 48000.

    Reboot and now ole David Gilmore is sounding all grown up again and I can simultaneously play Spongebob on the VLC player! You guys are awesome! Come to the US and I'll buy you all a few beers and make you some homemade Pizza!
    44100 not 41000 I hope

    That's good but what if you try play a 48Khz stream such as internet radio station (e.g. BBC) ? now the problem will reoccur ?

    If you really really want to use dmix - then make squeezelite always play at 48000 (i.e. make squeezelite or LMS resample as required).

  9. #9
    Senior Member
    Join Date
    Jan 2011
    Location
    Staffordshire. UK
    Posts
    3,096
    Michael

    try this, add 'C-5' to the end of your Squeezelite

    Name:  squeezelite c-5.png
Views: 140
Size:  152.4 KB

    this will delay Squuezelite from starting if not used.

    ronnie

  10. #10
    Senior Member
    Join Date
    Feb 2011
    Location
    Cheshire, UK
    Posts
    4,509
    Quote Originally Posted by noexit View Post
    You guys are incredible detectives and I'm learning an awful lot. I'm very glad I decided to take this project on and engage the support of the forums as it's filling in a lot of the knowledge gaps I've had around my love of both computers and audio.

    Here's what I've discovered:

    @Ronnie - Your suggestion of switching the Squeezelite Soundcard setting was well targeted: I changed the SoundCard line in /usr/local/bin/squeeezelite_settings.sh from SL_SOUNDCARD="dmix:CARD=audioinjectorpi" to SL_SOUNDCARD="hw:CARD=audioinjectorpi,DEV=0". This made Squeezelite play at normal speed/pitch again (see results below). Of note, I DID leave on the DEV=0," on the entry as it was already there. However, when I tried to simultaneously play another audio file in VLC, an error was returned in VLC stating that the audio device DMIX was "Busy". When I changed the entry back to DMIX the playback speed and pitch in Squeezelite increased again, but also, as expected, audio sharing was re-established across applications.

    @Bpa - Thanks for suggesting the details of the files. Note that both playback time and pitch are affected. As far as I can tell, the track isn't being played back through any kind of transcoders or processing. Or at least, I haven't set any up, so if they are they are part of the default install of my AudioInjector card, LMS or Squeezelite I suppose. The test file is an MP3 stored on a USB drive attached to a networked PC. However, I also notice that playback of a network stream (SomaFM, Venice Classic Radio) also renders the same problem affecting both speed and pitch. (I wasn't sure until I chose a Classic Rock radio station where I could hear familiar music - Tom Petty's Refugee as if he's 9 years old ). After a few minutes of playback I hear "corrections" in the stream dropping, skipping, stuttering.

    Of note, VLC's playback speed/pitch doesn't appear to be affected by DMIX. It seems that Squeezelite gets a little "excited" being hooked up to the ALSA Dmix plugin. If you guys like I could make an audio capture of the differences in pitch for your listening pleasure. 9 year old David Gilmore .

    STATISTICS

    Windows Attributes:
    Speak To Me - Breathe
    Length: 03:57
    Bit rate: 128kbs
    Size: 3.62mb
    ===========================================
    VLC Codec Info on Windows
    Codec: MPEG Audio layer 1/2 (mpga)
    Type: Audio
    Channels: Stereo
    Sample Rate: 44100 Hz
    Bits per sample: 32
    Bitrate: 128 kb/s
    ===========================================
    VLC Codec Info on Pi
    Codec: MPEG Audio layer 1/2 (mpga)
    Type: Audio
    Channels: Stereo
    Sample Rate: 44100 Hz
    Bits per sample: 32
    Bitrate: 128 kb/s
    ===========================================
    LMS File Attributes
    File Format: MP3
    Duration: 3:57
    Bitrate: 128kbps CBR
    Sample Rate: 44.1 kHz
    File Length: 3,799,144
    URL: tmp:///G:/Mp3/M - R/Pink Floyd/Dark Side Of The Moon/01_Speak To Me - Breathe.mp3
    Tag Version: ID3v2.3.0, ID3v1.1
    View Tags
    Title: Speak To Me - Breathe
    ===========================================
    Playback Times:
    Squeezelite time to play 3:57 sec file when HW is selected - 3:57
    Squeezelite time to play 3:57 sec file when DMIX is selected - 3:38 (19 seconds faster)
    VLC Windows time to play 3:57 sec file - 3:57
    VLC Pi time to play 3:57 sec file when HW is selected - 3:57
    VLC Pi time to play 3:57 sec file when DMIX is selected - 3:57
    I note that the file mentioned above is 128kbps mp3. You will notice the difference even more if you re-rip it as FLAC!

    Seriously 128kbps is low grade audio by todayĺs standards. If all of your music is at this level then you will be re-ripping at some point for sure.

    Most of us made mistakes when we first started ripping and have had to re-rip after using LMS for a while. I know I did.

    When you find yourself at this point (you will), make sure you come back here for advice in the Ripping, Tagging area so that hopefully you will only ever need to do it again once not multiple times. There are things that are easy to miss without detailed knowledge of what LMS is capable of.
    VB2.4 storage QNAP TS419p (NFS)
    Living Room - Joggler & SB3 -> Onkyo TS606 -> Celestion F20s
    Office - Pi3+Sreen -> Sony TAFE320 -> Celestion F10s / Pi2+DAC & SB3 -> Onkyo CRN755 -> Wharfedale Modus Cubes
    Dining Room -> SB Boom
    Kitchen -> UE Radio (upgraded to SB Radio)
    Bedroom (Bedside) - Pi2+DAC ->ToppingTP21 ->AKG Headphones
    Bedroom (TV) - SB Touch ->Sherwood AVR ->Mordaunt Short M10s
    Everything controlled by iPeng

Posting Permissions

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