Home of the Squeezebox™ & Transporter® network music players.
Page 1 of 4 123 ... LastLast
Results 1 to 10 of 32
  1. #1
    Senior Member philchillbill's Avatar
    Join Date
    Jan 2019
    Location
    The Netherlands
    Posts
    821

    Alexa can now handle FLAC streams

    Great news!

    Although it's (as yet) undocumented by Amazon, I've long suspected that the AudioPlayer interface would be upgraded to handle lossless streams. There are actually 2 versions of AudioPlayer - one for 'skill developers' and one for 'equipment makers' who integrate the Alexa Voice Service (AVS) into non-Amazon hardware like cars and fridges. The AVS version of AudioPlayer is more capable and specifically mentions: Accepted values: FLAC, VORBIS, OPUS, AAC, MP3, PCM, AC3, DTS, MHA1, EC-3, AC-3, MHA1, MHA2, MHM1, MP4.40, MP4.40.2, MP4.40.5. The skill dev version mentions a paltry AAC/MP4, MP3, PLS, M3U/M3U8, and HLS. Bitrates: 16kbps to 384 kbps. Because Amazon HD handles lossless, it was obvious that they had access to the AVS version for 'their' service but it was unavailable to me.

    When I originally got MediaServer to successfully stream to Echos using Paul Webster's clever https/PLS trick, I tested if AudioPlayer would accept a FLAC file fudged to look to Alexa like a stream. This resulted in an error that boiled down to an unsupported stream/file type. So it was lossy-streaming only to Echos from LMS. That was in 2019 and 2020.

    Anyway, just now I retried the fake FLAC stream as an experiment and it played no problem on every type of Echo device I have at my disposal. This means that if we can get a /stream.flac equivalent implemented in LMS, MediaServer will be able to stream lossless files from LMS to Echos without the transcoding that's needed today. While the basic Echo Dots are hardly worthy of HiFi playback, the Echo Show gen 2 (which I have) and Echo Studio are very different beasts worthy of lossless.

    Under the hood, the Echo grabs the stream itself (once the skill has told it where to look), so there's no proxy/relay in between. This 'appears' to be a https stream coming from the internet, but in reality the Echo just opens a PLS file sent to it from my server. This contains an entry for http://yourlmsip:port/stream.mp3?player=Alexa so that the Echo then fetches the audio over your WiFi connection from LMS. Once the stream starts it's bulletproof as the Echo just becomes a LAN-connected audio sink, albeit one with heavy buffering.

    Do any of the geniuses like @philippe_44, @bpa, @mherger know what it would take to implement a lossless /stream from LMS?

    EDIT: I just tried a UHD (FLAC, 24-bit, 88.2KHz) file and it also played without error
    Last edited by philchillbill; 2021-05-10 at 06:41.

  2. #2
    Senior Member
    Join Date
    Feb 2011
    Location
    Cheshire, UK
    Posts
    6,213
    Quote Originally Posted by philchillbill View Post
    Great news!

    Although it's (as yet) undocumented by Amazon, I've long suspected that the AudioPlayer interface would be upgraded to handle lossless streams. There are actually 2 versions of AudioPlayer - one for 'skill developers' and one for 'equipment makers' who integrate the Alexa Voice Service (AVS) into non-Amazon hardware like cars and fridges. The AVS version of AudioPlayer is more capable and specifically mentions: Accepted values: FLAC, VORBIS, OPUS, AAC, MP3, PCM, AC3, DTS, MHA1, EC-3, AC-3, MHA1, MHA2, MHM1, MP4.40, MP4.40.2, MP4.40.5. The skill dev version mentions a paltry AAC/MP4, MP3, PLS, M3U/M3U8, and HLS. Bitrates: 16kbps to 384 kbps. Because Amazon HD handles lossless, it was obvious that they had access to the AVS version for 'their' service but it was unavailable to me.

    When I originally got MediaServer to successfully stream to Echos using Paul Webster's clever https/PLS trick, I tested if AudioPlayer would accept a FLAC file fudged to look to Alexa like a stream. This resulted in an error that boiled down to an unsupported stream/file type. So it was lossy-streaming only to Echos from LMS. That was in 2019 and 2020.

    Anyway, just now I retried the fake FLAC stream as an experiment and it played no problem on every type of Echo device I have at my disposal. This means that if we can get a /stream.flac equivalent implemented in LMS, MediaServer will be able to stream lossless files from LMS to Echos without the transcoding that's needed today. While the basic Echo Dots are hardly worthy of HiFi playback, the Echo Show gen 2 (which I have) and Echo Studio are very different beasts worthy of lossless.

    Under the hood, the Echo grabs the stream itself (once the skill has told it where to look), so there's no proxy/relay in between. This 'appears' to be a https stream coming from the internet, but in reality the Echo just opens a PLS file sent to it from my server. This contains an entry for http://yourlmsiport/stream.mp3?player=Alexa so that the Echo then fetches the audio over your WiFi connection from LMS. Once the stream starts it's bulletproof as the Echo just becomes a LAN-connected audio sink, albeit one with heavy buffering.

    Do any of the geniuses like @philippe_44, @bpa, @mherger know what it would take to implement a lossless /stream from LMS?

    EDIT: I just tried a UHD (FLAC, 24-bit, 88.2KHz) file and it also played without error
    One of the issues with stream.mp3 is that it is very laggy from a control point of view. Does that issue exist with an Alexa using existing method?

    Can Alexa play, for example, the Radio Paradise FLAC url using this method?
    Jim
    https://jukeradio.double6.net


    VB2.4 storage QNAP TS419p (NFS)
    Living Room Joggler & Pi4/Khadas -> Onkyo TXNR686 -> Celestion F20s
    Office Joggler & Pi3 -> Denon RCD N8 -> Celestion F10s
    Dining Room SB Radio
    Bedroom (Bedside) Pi Zero+DAC ->ToppingTP21 ->AKG Headphones
    Bedroom (TV) & Bathroom SB Touch ->Denon AVR ->Mordaunt Short M10s + Kef ceiling speakers
    Guest Room Joggler > Topping Amp -> Wharfedale Modus Cubes

  3. #3
    Senior Member philchillbill's Avatar
    Join Date
    Jan 2019
    Location
    The Netherlands
    Posts
    821
    Quote Originally Posted by d6jg View Post
    One of the issues with stream.mp3 is that it is very laggy from a control point of view. Does that issue exist with an Alexa using existing method?

    Can Alexa play, for example, the Radio Paradise FLAC url using this method?
    There's no lag whatsoever when Alexa controls the stream and continues to control it when you change things. That's already the case with MediaServer today with stream.mp3 because I make sure to clear the Echo's buffer before any new item selected by voice plays. Ask Alexa to play some Classic Rock = instant start. Say "Alexa, next" = instant playback of next track. Do it in the GUI = wait a while *unless* you say "Alexa, resume" after doing it (when you do that, she clears the buffer). So the issue with lag is when you just change it in the GUI with Alexa out of the loop - then you have to wait for the Echo's buffer to clear before you see/hear the change. The overall experience is much better when you stay within Alexa for directing audio.

    I just tried https://stream.radioparadise.com/flacm and it played no problem. I have an idea. If you define a FLAC favorite then I could deliberately use a different route than proxying via stream.mp3 and just feed that stream directly from the source to the Echo, keeping LMS out of the loop. I'd have to whitelist FLAC streams somehow or else recognise them on the basis of /flac?/i being somewhere in the stream name in the URL in the favorite.
    Last edited by philchillbill; 2021-05-10 at 10:53.

  4. #4
    Senior Member
    Join Date
    Feb 2011
    Location
    Cheshire, UK
    Posts
    6,213
    Quote Originally Posted by philchillbill View Post
    There's no lag whatsoever when Alexa controls the stream and continues to control it when you change things. That's already the case with MediaServer today with stream.mp3 because I make sure to clear the Echo's buffer before any new item selected by voice plays. Ask Alexa to play some Classic Rock = instant start. Say "Alexa, next" = instant playback of next track. Do it in the GUI = wait a while *unless* you say "Alexa, resume" after doing it (when you do that, she clears the buffer). So the issue with lag is when you just change it in the GUI with Alexa out of the loop - then you have to wait for the Echo's buffer to clear before you see/hear the change. The overall experience is much better when you stay within Alexa for directing audio.

    I just tried https://stream.radioparadise.com/flacm and it played no problem. I have an idea. If you define a FLAC favorite then I could deliberately use a different route than proxying via stream.mp3 and just feed that stream directly from the source to the Echo, keeping LMS out of the loop. I'd have to whitelist FLAC streams somehow or else recognise them on the basis of /flac?/i being somewhere in the stream name in the URL in the favorite.
    I do think people would want to see an Echo appear as a pseudo player so that it could be controlled by any means available eg Alexa, Material, Default GUI, iPeng etc so I do think stream.flac is required to establish the audio sink.
    Jim
    https://jukeradio.double6.net


    VB2.4 storage QNAP TS419p (NFS)
    Living Room Joggler & Pi4/Khadas -> Onkyo TXNR686 -> Celestion F20s
    Office Joggler & Pi3 -> Denon RCD N8 -> Celestion F10s
    Dining Room SB Radio
    Bedroom (Bedside) Pi Zero+DAC ->ToppingTP21 ->AKG Headphones
    Bedroom (TV) & Bathroom SB Touch ->Denon AVR ->Mordaunt Short M10s + Kef ceiling speakers
    Guest Room Joggler > Topping Amp -> Wharfedale Modus Cubes

  5. #5
    Senior Member philchillbill's Avatar
    Join Date
    Jan 2019
    Location
    The Netherlands
    Posts
    821
    Quote Originally Posted by d6jg View Post
    I do think people would want to see an Echo appear as a pseudo player so that it could be controlled by any means available eg Alexa, Material, Default GUI, iPeng etc so I do think stream.flac is required to establish the audio sink.
    I agree. That's the way it works today - the Echo shows up as a network client in LMS and lag or no lag, it's great to browse the playlist for the AlexaPlayer in LMS.

    Philippe did have a shot at starving the stream so that the lag became acceptable (see https://forums.slimdevices.com/showt...l=1#post991361) and it certainly resulted in an instant GUI-experience but due to the quick-and-dirty nature of the hack it resulted in lots of rebuffering.

    If the stream.flac route is possible then it would be worth revisiting the starvation topic. It could be a command line parameter to enable drip-feed or not, so existing applications not requiring it would not be adversely affected.

    p.s. In the specific case of RP, there's https://www.amazon.com/Cratorsoft-Ra.../dp/B06XHZ46XG
    Last edited by philchillbill; 2021-05-10 at 11:33.

  6. #6
    Senior Member
    Join Date
    Feb 2011
    Location
    Cheshire, UK
    Posts
    6,213
    Quote Originally Posted by philchillbill View Post
    I agree. That's they way it works today - the Echo shows up as a network client in LMS and lag or no lag, it's great to browse the playlist for the AlexaPlayer in LMS.

    Philippe did have a shot at starving the stream so that the lag because acceptable (see https://forums.slimdevices.com/showt...l=1#post991361) and it certainly resulted in an instant GUI-experience but due to the quick-and-dirty nature of the hack it resulted in lots of rebuffering.

    If the stream.flac route is possible then it would be worth revisiting the starvation topic. It could be a command line parameter to enable drip-feed or not, so existing applications not requiring it would not be adversely affected.

    p.s. In the specific case of RP, there's https://www.amazon.com/Cratorsoft-Ra.../dp/B06XHZ46XG
    In the past I have tried to get an instance of Squeezelite to pipe its output to an instance of Icecast as FLAC stream. I can do it with a physical player into an ADC and then to Icecast but I have never managed to do it purely in software but thatĺs sort of what you want.
    Jim
    https://jukeradio.double6.net


    VB2.4 storage QNAP TS419p (NFS)
    Living Room Joggler & Pi4/Khadas -> Onkyo TXNR686 -> Celestion F20s
    Office Joggler & Pi3 -> Denon RCD N8 -> Celestion F10s
    Dining Room SB Radio
    Bedroom (Bedside) Pi Zero+DAC ->ToppingTP21 ->AKG Headphones
    Bedroom (TV) & Bathroom SB Touch ->Denon AVR ->Mordaunt Short M10s + Kef ceiling speakers
    Guest Room Joggler > Topping Amp -> Wharfedale Modus Cubes

  7. #7
    Senior Member
    Join Date
    Feb 2011
    Location
    Cheshire, UK
    Posts
    6,213
    PS I know there is an RP skill but I also knew there is a playable URL
    Jim
    https://jukeradio.double6.net


    VB2.4 storage QNAP TS419p (NFS)
    Living Room Joggler & Pi4/Khadas -> Onkyo TXNR686 -> Celestion F20s
    Office Joggler & Pi3 -> Denon RCD N8 -> Celestion F10s
    Dining Room SB Radio
    Bedroom (Bedside) Pi Zero+DAC ->ToppingTP21 ->AKG Headphones
    Bedroom (TV) & Bathroom SB Touch ->Denon AVR ->Mordaunt Short M10s + Kef ceiling speakers
    Guest Room Joggler > Topping Amp -> Wharfedale Modus Cubes

  8. #8
    Senior Member philchillbill's Avatar
    Join Date
    Jan 2019
    Location
    The Netherlands
    Posts
    821
    I have a P.O.C. working to direct the 'real' lossless stream to the Echo instead of using the /stream.mp3 route if an LMS favorite (1) represents a https stream and (2) has the word FLAC or lossless anywhere in the path. So if you want to see if you can hear a sound-quality difference between lossy vs lossless, you could define 2 favorites in LMS where one points to the lossy stream and the other to the lossless. The lossy one would go via /stream.mp3 and the FLAC would go direct. Let me know and I can put it in the live skill later today.

    When this is active, no pseudo-player shows in the LMS GUI so stopping the Echo's audio is done with "Alexa, stop". Things like "next" or "previous" don't make much sense for internet radio anyway.



    EDIT: It's now live. Feedback welcome. See https://forums.slimdevices.com/showt...=1#post1022461
    Last edited by philchillbill; 2021-05-11 at 11:29.

  9. #9
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    7,559
    Quote Originally Posted by philchillbill View Post
    I agree. That's the way it works today - the Echo shows up as a network client in LMS and lag or no lag, it's great to browse the playlist for the AlexaPlayer in LMS.

    Philippe did have a shot at starving the stream so that the lag became acceptable (see https://forums.slimdevices.com/showt...l=1#post991361) and it certainly resulted in an instant GUI-experience but due to the quick-and-dirty nature of the hack it resulted in lots of rebuffering.

    If the stream.flac route is possible then it would be worth revisiting the starvation topic. It could be a command line parameter to enable drip-feed or not, so existing applications not requiring it would not be adversely affected.

    p.s. In the specific case of RP, there's https://www.amazon.com/Cratorsoft-Ra.../dp/B06XHZ46XG
    I had a shot at the stream.flac. It kind of works but is more complicated than expected. The lag makes testing painful as well. The biggest issue so far is that flac are streamable formats, yes, but some players are still unhappy when there is no header at all (just frames). The difficulty is that LMS sends the same silence buffer over and over for such stream.(mp3/flac). It workds for mp3 but not always for flac due to this header requirement
    LMS 8.2 on Odroid-C4 - SqueezeAMP!, 5xRadio, 5xBoom, 2xDuet, 1xTouch, 1xSB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000, ShairPortW, 2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5, RivaArena 1 & 3

  10. #10
    Senior Member
    Join Date
    May 2008
    Location
    Canada
    Posts
    7,559
    Quote Originally Posted by philippe_44 View Post
    I had a shot at the stream.flac. It kind of works but is more complicated than expected. The lag makes testing painful as well. The biggest issue so far is that flac are streamable formats, yes, but some players are still unhappy when there is no header at all (just frames). The difficulty is that LMS sends the same silence buffer over and over for such stream.(mp3/flac). It workds for mp3 but not always for flac due to this header requirement
    I've submitted a PR here https://github.com/Logitech/slimserver/pull/606 but I think you should try it more because I think there are still various challenges with trying to stream flac like that.
    LMS 8.2 on Odroid-C4 - SqueezeAMP!, 5xRadio, 5xBoom, 2xDuet, 1xTouch, 1xSB3. Sonos PLAY:3, PLAY:5, Marantz NR1603, Foobar2000, ShairPortW, 2xChromecast Audio, Chromecast v1 and v2, Squeezelite on Pi, Yamaha WX-010, AppleTV 4, Airport Express, GGMM E5, RivaArena 1 & 3

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
  •