Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 2 12 LastLast
Results 1 to 10 of 14
  1. #1
    Junior Member
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    25

    Converting sub-44.1kHz MP3 streams to 44.1/48?

    Hi,

    I wonder if anyone can help me with a custom-convert.conf entry to convert MP3 streams with sampling rates below 44.1kHz to 44.1kHz?

    I run LMS on a Win 7, 64-bit machine but use a Joggler running Squeezeplay on it's stock OS, connected to a USB DAC to listen (I also have an SB3)

    I have the alsa mixer disabled on the Joggler so that things play at the native sampling rate of the file and there is no problem with 44.1kHz or 48kHz material (my DAC, Cambridge Dacmagic, has LEDs to show the sampling rate used).

    Streams with lower sampling rates play too fast however, so I just need settings that will convert MP3 radio streams to one of the playable rates on the fly, but ONLY if they are not already 44.1 or 48.

    Incidentally the Joggler's internal sound chip has the same problem when the mixer is disabled.

    Here's an example, Talksport is only 16kHz mono (@32kbps), good enough for football commentary.
    http://webradio.radiomonitor.com/stream/talksport

    Thanks!
    Glenn

  2. #2
    Senior Member ralphy's Avatar
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    937
    Try creating a custom-convert.conf like this in the same location as convert.conf.

    Code:
    mp3 mp3 squeezeplay *
            # IFB:{BITRATE=-B %B}D:{RESAMPLE=--resample %D}
            [lame] --silent -q $QUALITY$ -v $BITRATE$ --resample 44100 --mp3input
    lame should not resample if the source is already at the same rate as the resample option.

    You'll also need to install lame on the server if you haven't already and restart the server.
    Ralphy

    1-Touch, 4-Classics, 2-Booms, 2-Squeezeslaves, 3-Squeezeplays, 3-Squeezelites
    Squeezeslave donations always appreciated.

  3. #3
    Junior Member
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    25
    Thanks Ralphy,

    I guess what I'm looking for really is an MP3->FLC or MP3->PCM equivalent of this, that resamples to 44100, rather than needlessly re-encoding back to MP3. Aplogies for not making this clear initially.

    Prior to your reply I did get a bit further, getting LAME to decode MP3s server-side (I thought that would be a good first step, and then I could fix the sample rate) but then I discovered that I could no longer seek within MP3 files even though they were being correctly decoded and sent as PCM, and I couldn't play any MP3 internet radio streams at all, so I took it out again.

    Glenn

  4. #4
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    11,253
    Do you only want to resample specific internet radio streams ?

  5. #5
    Junior Member
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    25
    Yes, there are just some low-quality streams that as well as being low bitrate they are also low sample rate too, below what either my USB DAC or the Joggler's built-in sound card support. E.g., the talkSPORT one is 16khz@32kbps.

    I was hoping for something that would decode MP3s server-side to flac or pcm and resample only <44.1kHz streams to 44.1kHz, but I don't really want playback of 44.1kHz MP3 files compromised.

  6. #6
    Senior Member ralphy's Avatar
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    937
    Quote Originally Posted by Glenn2 View Post
    Thanks Ralphy,

    I guess what I'm looking for really is an MP3->FLC or MP3->PCM equivalent of this, that resamples to 44100, rather than needlessly re-encoding back to MP3. Aplogies for not making this clear initially.
    No problem.

    I've been using sox lately for squeezeslave. Try this in your custom-convert.conf

    Code:
    mp3 flc squeezeplay *
        [sox] -q -t mp3 $FILE$ -t flac -C 0 -r 44100 -
    Last edited by ralphy; 2012-04-03 at 05:38.
    Ralphy

    1-Touch, 4-Classics, 2-Booms, 2-Squeezeslaves, 3-Squeezeplays, 3-Squeezelites
    Squeezeslave donations always appreciated.

  7. #7
    Junior Member
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    25
    Thanks Ralphy, appreciate the effort but no joy I'm afraid.
    That made all MP3 (files or streams) give an error.

    Cheers,
    Glenn

  8. #8
    Senior Member
    Join Date
    Oct 2005
    Location
    Ireland
    Posts
    11,253
    I created a general purpose plugin for myself a few years ago which would pass any stream (e.g. a Favorite) to the plugin which would then use mplayer to play the stream - always making the output 44.1kHz.

    It was useful to for playing unusual streams. I think it will solve your issue but I need to retrieve from an archive and update it to 7.6.

  9. #9
    Senior Member ralphy's Avatar
    Join Date
    Jan 2006
    Location
    Canada
    Posts
    937
    Quote Originally Posted by Glenn2 View Post
    Thanks Ralphy, appreciate the effort but no joy I'm afraid.
    That made all MP3 (files or streams) give an error.

    Cheers,
    Glenn
    Can you confirm you didn't miss the hyphen (-) at the end.

    It's a bit strange it doesn't work since I'm currently using it on my 7.7.3 test server for squeezeslave players and I just tested it with squeezeplay as well.

    When bpa gets the plugin working that would be ideal as you can pick the streams you need resampled instead of everything.
    Ralphy

    1-Touch, 4-Classics, 2-Booms, 2-Squeezeslaves, 3-Squeezeplays, 3-Squeezelites
    Squeezeslave donations always appreciated.

  10. #10
    Junior Member
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    25
    Ok I just tried it again from scratch, still no joy. I can make it work with LAME (but that breaks track seeking) just not SOX.

    The server is 7.7.2 - r33893 by the way (on Win 7 64 machine)

    I've been using the Joggler (linux client) with alsa mixer disabled, so it attempts to play everything at native sample rates, but I've since figured out how to enable the mixer (dmix) with the rate fixed at 44.1 instead of its default 48. This configuration seems to play everything, although I'm a little unhappy that my 44.1/16 flacs will pass through it, but it must be clever enough to not resample streams that don't need it... so I can't see why they wouldn't emerge unscathed... hopefully...

Posting Permissions

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