PDA

View Full Version : Yet another thread on replacing squeezebox devices



PasTim
2014-05-28, 02:12
Like many I have been wondering what to do if my squeezebox devices fail. Many of the solutions on various threads suggest hardware replacements, and I'm a little puzzled as to why this is necessary at all.

LMS (with several plugins) is still far and away more flexible than anything else I have found for organising and selecting music. For instance, on no other system have I found a way to play a random Classical Work (i.e. a randomly selected series of sequential series of tracks on an album that makes up a classical work). The best non-LMS server I have found is MinimServer (a UpNP server that has a really clever way of selecting tracks and has many other good features), but it can't do the more sophisticated stuff.

I can control what LMS is doing from a wireless device with a browser anywhere in the house. In my case I need a laptop or tablet since classical tracks tend to have long names that occupy too much space on a smartphone.

I have good quality amplifiers connected to my wired home network. These are UPnP compliant, and will accept streaming across my home network. I have used foobar2000 (running under wine on linux) with a UPnP plugin that provides a 'playback stream capture' mode. This streams anything that foobar2000 is playing locally directly to my amplifiers over the network using lpcm at up to 24/192,000 quality - more than good enough for me. I therefore know that sending digital audio in this way is possible.

So 'all I need' is something like the excellent squeezelite (which I use a lot when at my desktop PC), but instead of outputting to a local audio device, replicates what foobar can do using UPnP over my wired network. I don't mind that the amplifier won't display any information about what is currently playing, since I am usually the other side of the room and can't read it from there anyway. I use the browser for that.

I really shouldn't need another hardware device, be it based on a Raspberry Pi or Wandboard, with the attendant complexities involved. I don't need another DAC, or discussions about async USB versus optical or coax, different linux kernels and so on, much fun though such ideas are.

As a slightly playful experiment I did manage to get sound from squeezelite to my amplifiers over my wired network without using the Touch, utilising an over-complicated combination of tools pretending to be an internet radio, but I couldn't get better quality than mp3 to work, and I had too many bits of software in the chain to make it practical (squeezelite to high quality audio, monitored by vlc, streamed to a local http address, picked up via minimserver in a playlist and played by my renderer). Any attempt to stream wav (or flac) from vlc failed, and I'm guessing that is because I don't understand http streaming technology well enough. However, this really doesn't matter because this isn't a sensible solution, involving far too many intermediate steps.

So, is there any chance that some clever developer could produce something like squeezelite (so I can continue to use LMS as the best-in-class server) but get it to stream over a network to a UPnP renderer at high (but selectable) quality, rather than outputting to a local audio device? Is the reason no such solution seems to exist is that there are technical downsides of which I am unaware? Or does someone out there know of an existing solution?

Or am I just being daft.....?

callesoroe
2014-05-28, 05:25
Like many I have been wondering what to do if my squeezebox devices fail. Many of the solutions on various threads suggest hardware replacements, and I'm a little puzzled as to why this is necessary at all.

LMS (with several plugins) is still far and away more flexible than anything else I have found for organising and selecting music. For instance, on no other system have I found a way to play a random Classical Work (i.e. a randomly selected series of sequential series of tracks on an album that makes up a classical work). The best non-LMS server I have found is MinimServer (a UpNP server that has a really clever way of selecting tracks and has many other good features), but it can't do the more sophisticated stuff.

I can control what LMS is doing from a wireless device with a browser anywhere in the house. In my case I need a laptop or tablet since classical tracks tend to have long names that occupy too much space on a smartphone.

I have good quality amplifiers connected to my wired home network. These are UPnP compliant, and will accept streaming across my home network. I have used foobar2000 (running under wine on linux) with a UPnP plugin that provides a 'playback stream capture' mode. This streams anything that foobar2000 is playing locally directly to my amplifiers over the network using lpcm at up to 24/192,000 quality - more than good enough for me. I therefore know that sending digital audio in this way is possible.

So 'all I need' is something like the excellent squeezelite (which I use a lot when at my desktop PC), but instead of outputting to a local audio device, replicates what foobar can do using UPnP over my wired network. I don't mind that the amplifier won't display any information about what is currently playing, since I am usually the other side of the room and can't read it from there anyway. I use the browser for that.

I really shouldn't need another hardware device, be it based on a Raspberry Pi or Wandboard, with the attendant complexities involved. I don't need another DAC, or discussions about async USB versus optical or coax, different linux kernels and so on, much fun though such ideas are.

As a slightly playful experiment I did manage to get sound from squeezelite to my amplifiers over my wired network without using the Touch, utilising an over-complicated combination of tools pretending to be an internet radio, but I couldn't get better quality than mp3 to work, and I had too many bits of software in the chain to make it practical (squeezelite to high quality audio, monitored by vlc, streamed to a local http address, picked up via minimserver in a playlist and played by my renderer). Any attempt to stream wav (or flac) from vlc failed, and I'm guessing that is because I don't understand http streaming technology well enough. However, this really doesn't matter because this isn't a sensible solution, involving far too many intermediate steps.

So, is there any chance that some clever developer could produce something like squeezelite (so I can continue to use LMS as the best-in-class server) but get it to stream over a network to a UPnP renderer at high (but selectable) quality, rather than outputting to a local audio device? Is the reason no such solution seems to exist is that there are technical downsides of which I am unaware? Or does someone out there know of an existing solution?

Or am I just being daft.....?

I totally agree with you. The LMS music system with plugins is the most flexible music system on the market. Therefore I today got my fingers in a second Transporter for my kitchen. It runs balanced directly to a pair of active studio monitors.
Sounds great :) . I love the flexibility to create playlists with dynamic playlists from my own library and combine them new music playlists from Wimp-hifi (flac streaming). My kids have a receiver and active speakers too. They mostly listen to
Wimp. And the I have a receiver in the bedroom too. So I am not going away from my SB-system in years from now.... I am upgrading it...... :)
The software is also rock solid now, and even on the ReadyNas the upgrades works like a charm now.

LONG LIVE LMS :)

Roland0
2014-05-28, 05:56
As a slightly playful experiment I did manage to get sound from squeezelite to my amplifiers over my wired network without using the Touch, utilising an over-complicated combination of tools pretending to be an internet radio, but I couldn't get better quality than mp3 to work, and I had too many bits of software in the chain to make it practical (squeezelite to high quality audio, monitored by vlc, streamed to a local http address, picked up via minimserver in a playlist and played by my renderer). Any attempt to stream wav (or flac) from vlc failed, and I'm guessing that is because I don't understand http streaming technology well enough. However, this really doesn't matter because this isn't a sensible solution, involving far too many intermediate steps.

So, is there any chance that some clever developer could produce something like squeezelite (so I can continue to use LMS as the best-in-class server) but get it to stream over a network to a UPnP renderer at high (but selectable) quality, rather than outputting to a local audio device? Is the reason no such solution seems to exist is that there are technical downsides of which I am unaware? Or does someone out there know of an existing solution?


Try squeezelite ⟶ ALSA ⟶ PulseAudio (maybe not needed if Rygel accepts ALSA as in input?) ⟶ Rygel (https://wiki.gnome.org/action/show/Projects/Rygel?action=show&redirect=Rygel) ⟶ DLNA/UPnP
Downside will be that player synchronization will not work properly with any of these solutions.

PasTim
2014-05-28, 07:02
Try squeezelite ⟶ ALSA ⟶ PulseAudio (maybe not needed if Rygel accepts ALSA as in input?) ⟶ Rygel (https://wiki.gnome.org/action/show/Projects/Rygel?action=show&redirect=Rygel) ⟶ DLNA/UPnP
Downside will be that player synchronization will not work properly with any of these solutions.
Now you mention it I did try Rygel a while ago, with rather mixed, but mostly poor, results. It was quite a struggle to get it working at all.

So I may try Rygel again, but I'd much rather have a tool that doesn't involve local audio as an interim step.

lrossouw
2014-05-28, 07:54
So, is there any chance that some clever developer could produce something like squeezelite (so I can continue to use LMS as the best-in-class server) but get it to stream over a network to a UPnP renderer at high (but selectable) quality, rather than outputting to a local audio device? Is the reason no such solution seems to exist is that there are technical downsides of which I am unaware? Or does someone out there know of an existing solution?


Using UPnP like you suggest you lose a lot of features. Including sync, etc. Lot of upnp players are also fairly difficult with different formats etc.

I would suggest the best solutions is probably getting a WandBoard and install the Community Squeese OS on it (if you can download it). Or install some form of linux and squeezelite on it. That way you get something as close as possible to a touch less a screen. If you have a TV nearby you could probably add a now playing screen / browser / etc.

You can then pass digital to the DAC of your choice from the wandboard.

I have not tried this myself. I am actually waiting for a wandboard package to be delivered. I chose it for other things but as it seemed that lots of people are using it to replace squeezeboxes I thought that it would be good device for this reason also once my SBs die.

castalla
2014-05-28, 07:58
Using UPnP like you suggest you lose a lot of features. Including sync, etc. Lot of upnp players are also fairly difficult with different formats etc.

I would suggest the best solutions is probably getting a WandBoard and install the Community Squeese OS on it (if you can download it). Or install some form of linux and squeezelite on it. That way you get something as close as possible to a touch less a screen. If you have a TV nearby you could probably add a now playing screen / browser / etc.

You can then pass digital to the DAC of your choice from the wandboard.

I have not tried this myself. I am actually waiting for a wandboard package to be delivered. I chose it for other things but as it seemed that lots of people are using it to replace squeezeboxes I thought that it would be good device for this reason also once my SBs die.

You can achieve the same with pretty much any low-cost arm device, eg. Raspberry Pi, Odroid U3 - both of which have Truehl's squeezeplug installer available.

PasTim
2014-05-28, 08:07
Using UPnP like you suggest you lose a lot of features. Including sync, etc. Lot of upnp players are also fairly difficult with different formats etc.

I don't need sync, since I tend to sit down and listen to music rather than wander from room to room. In my fairly small house I can wind up the volume if I have to!.

I can't think of any other feature I'd lose, but I'd be happy to be disabused of this notion if someone knows better.

My understanding is that all UPnP players accept a stream in lpcm/wav format, which is all I need. Certainly both of mine do with no problems at all. The benefit of the foobar2000 'Playback Stream Capture' facility is that it can avoid almost all the format issues by streaming pcm/wav.

That way I don't need an extra box, yet another operating system, cabling options and so on, which is just what I want to avoid. All that extra kit is more to go wrong, and more to get in the way of what ought, superficially at least, to be the most direct, simple, and therefore reliable, solution.

PasTim
2014-05-28, 08:08
You can achieve the same with pretty much any low-cost arm device, eg. Raspberry Pi, Odroid U3 - both of which have Truehl's squeezeplug installer available.
But I don't want another box :-(

castalla
2014-05-28, 08:35
But I don't want another box :-(

Here's a suggestion.

Using Android - install Streambels player. Enable upnp/dnla on LMS. In streambels you can select a dlna device to play to. Use Streambels to select LMS as the music source. Streambels can also play to airplay devices or choose the phone/tablet speaker and enable bluetooth for bluetooth speakers, etc. Eats the battery!

For the money, the Raspi is a cheap easily configured alternative.

PasTim
2014-05-28, 08:57
Here's a suggestion.

Using Android - install Streambels player. Enable upnp/dnla on LMS. In streambels you can select a dlna device to play to. Use Streambels to select LMS as the music source. Streambels can also play to airplay devices or choose the phone/tablet speaker and enable bluetooth for bluetooth speakers, etc. Eats the battery!

For the money, the Raspi is a cheap easily configured alternative.
I fear my initial post was too long :-)

I really want to use the full LMS interface. The LMS DLNA facility is very limited (In fact I do use it for viewing my photo albums on my TV, but that's a very different kettle of fish) and is not what I want at all.

So:

A. I need to use the full LMS.
B. A software player such as Squeezelite is perfect, except...
C. I want it to output directly over my wired network in the UPnP stream format, rather than to an audio device - that's all.

To be honest another piece of hardware, running another version of linux, or android, is another device I have to maintain and worry about. I would need to work out whether I need to look at any security issues (there always are), update issues (there often are), read countless forum entries about which way to connect to my amplifier (conmisdering all sorts of topics I don't understand, like jitter), whether I need a tweaked kernel, and so on. All for a piece of kit I don't really want. It isn't the cost, it's the complication. Further, to connect to my other renderer in another room, do I need a second box?

No. An extension to software we already must surely be one way to go for people who like simplicity. Come to think of it, by running multiple copies of a 'squeezelite-like' player I could probably get a reasonable multi-room sync if I had to, given existing tools in LMS.

castalla
2014-05-28, 09:34
I fear my initial post was too long :-)

I really want to use the full LMS interface. The LMS DLNA facility is very limited (In fact I do use it for viewing my photo albums on my TV, but that's a very different kettle of fish) and is not what I want at all.

So:

A. I need to use the full LMS.
B. A software player such as Squeezelite is perfect, except...
C. I want it to output directly over my wired network in the UPnP stream format, rather than to an audio device - that's all.

To be honest another piece of hardware, running another version of linux, or android, is another device I have to maintain and worry about. I would need to work out whether I need to look at any security issues (there always are), update issues (there often are), read countless forum entries about which way to connect to my amplifier (conmisdering all sorts of topics I don't understand, like jitter), whether I need a tweaked kernel, and so on. All for a piece of kit I don't really want. It isn't the cost, it's the complication. Further, to connect to my other renderer in another room, do I need a second box?

No. An extension to software we already must surely be one way to go for people who like simplicity. Come to think of it, by running multiple copies of a 'squeezelite-like' player I could probably get a reasonable multi-room sync if I had to, given existing tools in LMS.

Well ... you can continue wishing. Seems it's either dlna or the squeezeserver. - dlna doesn't do live streaming, afaik.

PasTim
2014-05-28, 09:54
Well ... you can continue wishing. Seems it's either dlna or the squeezeserver. - dlna doesn't do live streaming, afaik.
My whole post was based on the proven fact that dlna does do live streaming, that is what foobar2000 'Playback Stream Capture' does. It presents as a media source on DLNA devices, and then just streams the wav/lpcm.

So I have the three parts of the solution (LMS, LMS software players, DLNA streamers) but they I can't get the latter two to talk to eachother - yet :)

Roland0
2014-05-28, 10:58
A. I need to use the full LMS.
B. A software player such as Squeezelite is perfect, except...
C. I want it to output directly over my wired network in the UPnP stream format, rather than to an audio device - that's all.

To be honest another piece of hardware, running another version of linux, or android, is another device I have to maintain and worry about. I would need to work out whether I need to look at any security issues (there always are), update issues (there often are), read countless forum entries about which way to connect to my amplifier (conmisdering all sorts of topics I don't understand, like jitter), whether I need a tweaked kernel, and so on. All for a piece of kit I don't really want. It isn't the cost, it's the complication. Further, to connect to my other renderer in another room, do I need a second box?

No. An extension to software we already must surely be one way to go for people who like simplicity.

While is may be possible to extend Squeezelite to act as a DNLA server, I think it's unlikely to happen since
- it's already possible to do this using the solution I described above
- it's a very specific and limited use case
- it results in a loss of functionality
- the only advantage I could see would be one (small, cheap (<40EUR), and e.g. with picoplayer basically maintenance-free) box less



Come to think of it, by running multiple copies of a 'squeezelite-like' player I could probably get a reasonable multi-room sync if I had to, given existing tools in LMS.

Unlikely - DNLA has no provision for this, and without any intelligence in the endpoint, the server cannot adjust anything in any case due to the lack of feedback

castalla
2014-05-28, 11:01
My whole post was based on the proven fact that dlna does do live streaming, that is what foobar2000 'Playback Stream Capture' does. It presents as a media source on DLNA devices, and then just streams the wav/lpcm.

So I have the three parts of the solution (LMS, LMS software players, DLNA streamers) but they I can't get the latter two to talk to eachother - yet :)

So it's a sort of transcoder then?

PasTim
2014-05-28, 12:45
While is may be possible to extend Squeezelite to act as a DNLA server, I think it's unlikely to happen since
- it's already possible to do this using the solution I described above

I'm trying rygel again as I write and will report.



- it's a very specific and limited use case

I disagree, quite strongly. The world is full of amplifiers supporting network streaming, as against a few thousand unsupported logitech devices (I have no idea how many) and a few technically savvy people with wandboards, picoplayers and the like. If LMS supported people who just have network amplifiers more easily, there might be very many more users, especially those of a less technical frame of mind.



- it results in a loss of functionality

Anything else apart from well-controlled multi-room sync? I can't think of anything.



- the only advantage I could see would be one (small, cheap (<40EUR), and e.g. with picoplayer basically maintenance-free) box less

Not having another box is, to my mind, an enormous advantage. It isn't about cost, it's about totally unnecessary complexity. But I have said my piece on that more than once.

PasTim
2014-05-28, 12:47
So it's a sort of transcoder then?
It's a digital audio streamer, not unlike Internet radio. My limited understanding is that it uses an http protocol.

Otto-Wilhelm
2014-05-28, 13:35
Perhaps this is a solution, if you want to use UPnP devices:

Description
Whitebear Media Server is a very specialised Media Server application, that is specifically designed to interface with Logitech's Squeezebox music server (Squeezebox Server).

Media Server

Whitebear is a UPnP (Universal Plug and Play) and DLNA (Digital Living Network Alliance) compatible Digital Media Server (DMS) that acts as a front end for Logitech's Squeezebox Server. This enables UPnP/DLNA compliant Digital Media Players (DMP) to access, browse and play tracks from your Squeezebox Server library.

Media Renderer

In addition Whitebear is an individual UPnP/DLNA compatible Digital Media Renderer (DMR) that acts as a front end for each Logitech Squeezebox player that it finds in your home audio network. This enables UPnP/DLNA compliant Control Points to control and play music files on the respective Squeezebox player by means of the "Play To" context menu.

see http://www.whitebear.ch/mediaserver

There is at least one thread here dealing with Whitebear. Perhaps Whitebear has better functionalities than the UPnP functionalities of LMS.

Otto-Wilhelm

get.amped
2014-05-28, 13:47
If LMS supported people who just have network amplifiers more easily, there might be very many more users

...

Not having another box is, to my mind, an enormous advantage. It isn't about cost, it's about totally unnecessary complexity.

But there is almost no incentive (for Logitech specifically) to provide any such functionality. Users of LMS who are not buying hardware does not result in revenue for Logitech.

Which leaves the people in the SB user community to come up with any improvements/extensions of LMS and the SB ecosytem. The only reason any of these other non-Logitech solutions for using LMS exist is that individuals in this community decided the functionality was useful, primarily in the aspect of providing functional replacements for the defunct SB product line. I think you are going to have to have a substantially more persuasive, let's say sales pitch instead of argument, to convince someone to take on this project and create some plugin that emulates a SB to LMS, meaning that you can manipulate it in the interface and give it a playlist, and takes whatever it receives and makes it available as a stream via http.

It's an interesting idea but, if you really want it, you may have to learn some programming :rolleyes:

PasTim
2014-05-28, 13:57
Perhaps this is a solution, if you want to use UPnP devices:
Description
Whitebear Media Server is a very specialised Media Server application, that is specifically designed to interface with Logitech's Squeezebox music server (Squeezebox Server).

Thanks. I have used Whitebear (for my TV) in the past, but as far as I known it's Windows only.

PasTim
2014-05-28, 14:05
But there is almost no incentive (for Logitech specifically) to provide any such functionality. Users of LMS who are not buying hardware does not result in revenue for Logitech.

Which leaves the people in the SB user community to come up with any improvements/extensions of LMS and the SB ecosytem. The only reason any of these other non-Logitech solutions for using LMS exist is that individuals in this community decided the functionality was useful, primarily in the aspect of providing functional replacements for the defunct SB product line. I think you are going to have to have a substantially more persuasive, let's say sales pitch instead of argument, to convince someone to take on this project and create some plugin that emulates a SB to LMS, meaning that you can manipulate it in the interface and give it a playlist, and takes whatever it receives and makes it available as a stream via http.

It's an interesting idea but, if you really want it, you may have to learn some programming :rolleyes:
Logitrech are really out of the loop on this, so I was hoping that the likes of Triode might be interested. He has done the first part of this brilliantly, taking the stream from LMS such that it can be controlled by the usual LMS browser. He has also done the probably much harder part of getting squeezelite to output to myriad audio devices of varying qualities and specifications, and everyone loves it. I was hoping that streaming via http/UPnP would be relatively simple, but I am no doubt being naive.

I am no salesman, as is no doubt apparent. Having started programming 43 years ago, but pretty well stopped around 20 years ago (when the IT world was an awful lot simpler than it is now and you could control almost all of it should you so wish), I doubt I could learn enough myself now.

bpa
2014-05-29, 07:29
An extension to software we already must surely be one way to go for people who like simplicity. Come to think of it, by running multiple copies of a 'squeezelite-like' player I could probably get a reasonable multi-room sync if I had to, given existing tools in LMS.

I cannot get my head around what compromise you might find acceptable.

Can you write out your ideal "use case". This would be an ideal case - what would your dream system look and feel like (not a static "component" description) if somebody created a solution.

For example, can you write the steps you would do to select and play a track on your controller ?
What steps you would need to do on your amp/player to know it is s connected to the LMS UPNP entity ?
What steps are needed to get the amp/player play music from LMS (and not the controller but on the amp/player interface) ?
Does the amp /player have to display anythin ?

oldfolkie
2014-05-29, 16:01
Thanks. I have used Whitebear (for my TV) in the past, but as far as I known it's Windows only.

You've been using foobar2000. Isn't that Windows only?

PasTim
2014-05-30, 03:32
You've been using foobar2000. Isn't that Windows only?
Indeed it is, but it runs extremely reliably under 'wine', the Windows emulator, on linux.

PasTim
2014-05-30, 06:25
I cannot get my head around what compromise you might find acceptable.

Can you write out your ideal "use case". This would be an ideal case - what would your dream system look and feel like (not a static "component" description) if somebody created a solution.

For example, can you write the steps you would do to select and play a track on your controller ?
What steps you would need to do on your amp/player to know it is s connected to the LMS UPNP entity ?
What steps are needed to get the amp/player play music from LMS (and not the controller but on the amp/player interface) ?
Does the amp /player have to display anythin ?
A use case. Some of this is expressed in terms of the solution, for instance I have no better way to describe an ideal controller than to say 'just like LMS'. I don't want to throw away amplifiers or servers that I have that do an excellent job as it is. Some of the components are, therefore, part of my ideal system.

I want:

1) To use a browser on a wireless laptop or tablet to play music in my lounge, and sometimes in one other room.
2) The user interface needs to be as flexible as LMS is now, which means I can customise menus to play things like 'Works By Composer' and select a performance by a particular Artist, or 'Random Works', or 'Random Movements', or 'Albums by Conductor', and so on.... I have no need for anything better than that which LMS provides, so I want to keep it as it is.
3) This user interface includes the ability to select a 'player' which in this case would be the streaming software (i.e. just like squeezelite, especially in its 'local player' guise).
4) The music is in flacs, up to 24/192 quality, on a linux server.
5) My amplifiers are connected to my wired home network.
6) I want to select the input to the amplifier to be the music source and stream (i.e. the streamer on the server), no more than that, and nothing need be displayed on it for each track. It's just an input, like a tuner, LP player (yes, I still have more than one!) or whatever.
7) I have no need for additional hardware boxes, indeed I have a positive aversion to them. There is no need for them. They perform no useful function that I can detect.
8) I have no need for multi-room sync.
9) The KISS principle applies (Keep It Simple, Stupid). I just want to play music as simply and reliably as possible. Thus removing the Touch from my current set-up should make the solution better.

So, since both amplifiers already support streamed music over the wired network using UpnP, I want to use something like squeezelite to stream directly to them, rather than to an audio device on my server.

bpa
2014-05-30, 08:04
I want to use something like squeezelite to stream directly to them, rather than to an audio device on my server.

As another point for comparison, how would your ideal solution differ (aside from using mp3) from making your amplifier play the current LMS stream.mp3 stream.

PasTim
2014-05-30, 08:23
As another point for comparison, how would your ideal solution differ (aside from using mp3) from making your amplifier play the current LMS stream.mp3 stream.
I don't know, because I am unsure as to which stream you refer (I know very little indeed about what goes on under the lid), unless you are referring to the existing UPnP plugin. If the latter, it can't be controlled in the same manner, or nearly as flexibly, as the normal LMS audio.

Whilst I wouldn't use it, the use of several 'players' using one server to play different music is probably useful for many people. Thus a model that would support having several 'squeezelite-like' instances is probably sensible.

bpa
2014-05-30, 08:53
I don't know, because I am unsure as to which stream you refer (I know very little indeed about what goes on under the lid), unless you are referring to the existing UPnP plugin. If the latter, it can't be controlled in the same manner, or nearly as flexibly, as the normal LMS audio.

IIRC The stream.mp3 feature is an LMS feature that has been around since at least 6.0

You need to have lame installed as all audio is converted into MP3.

LMS has a "player" which appears as http MP3 stream and has same URL as LMS webUI but extension stream.mp3 (e.g. http://localhost:9000/stream.mp3). Start a real player (e.g. tell your amp that it is a radio station and use the LMS host IP address instead of localhost) playing this stream and it will play silence and then a new player will appear in the drop down menu (you may need to refresh). Then select whatever audio you want and play it on this new player - audio will be converted and then routed to the http stream which should be played on your amp/whatever. The problem is usually the real audio amp has a buffer and it buffers up the stream and so there is a delay between choice and hearing the audio.

PasTim
2014-05-30, 10:04
IIRC The stream.mp3 feature is an LMS feature that has been around since at least 6.0

You need to have lame installed as all audio is converted into MP3.

LMS has a "player" which appears as http MP3 stream and has same URL as LMS webUI but extension stream.mp3 (e.g. http://localhost:9000/stream.mp3). Start a real player (e.g. tell your amp that it is a radio station and use the LMS host IP address instead of localhost) playing this stream and it will play silence and then a new player will appear in the drop down menu (you may need to refresh). Then select whatever audio you want and play it on this new player - audio will be converted and then routed to the http stream which should be played on your amp/whatever. The problem is usually the real audio amp has a buffer and it buffers up the stream and so there is a delay between choice and hearing the audio.
Thanks! I learn something every day. I wonder whether is documented anywhere. I don't recall ever reading anything about it.

Three problems :

1) I'd want it in better quality, like wav or pcm based on the quality of my flacs (I am not sure that flac can be streamed, can it?)
2) Some devices, including both of mine, don't support direct entry of a station. It may be possible to add it to 'vtuner' or whatever the system supports - I shall investigate.
3) If I can get (2) to work, it may mean that I need to be connected to the Internet at all times. In the modern world many take this for granted, but I have lost outside connections on a couple of occasions for several days thanks to telco problems, so I wouldn't want to rely on that. However, it may be that by adding such a local station to my 'favourites' I could avoid this problem, but I'll have to try it and see.

bpa
2014-05-30, 10:58
Thanks! I learn something every day. I wonder whether is documented anywhere. I don't recall ever reading anything about it.

See WebGUI - remote streaming . The help has been there for years.



Three problems :

1) I'd want it in better quality, like wav or pcm based on the quality of my flacs (I am not sure that flac can be streamed, can it?)
2) Some devices, including both of mine, don't support direct entry of a station. It may be possible to add it to 'vtuner' or whatever the system supports - I shall investigate.
3) If I can get (2) to work, it may mean that I need to be connected to the Internet at all times. In the modern world many take this for granted, but I have lost outside connections on a couple of occasions for several days thanks to telco problems, so I wouldn't want to rely on that. However, it may be that by adding such a local station to my 'favourites' I could avoid this problem, but I'll have to try it and see.

I know there would be "problems" - that's why I said a "Point for comparison." and already acknowledge the audio part.

The issue about defining "local" streams is important as it is a limitation of your equipment. Probably can be overcome by "publishing " the stream under upnp.

PasTim
2014-05-30, 14:48
See WebGUI - remote streaming . The help has been there for years.
I know there would be "problems" - that's why I said a "Point for comparison." and already acknowledge the audio part.
The issue about defining "local" streams is important as it is a limitation of your equipment. Probably can be overcome by "publishing " the stream under upnp.
Just shows I didn't read the instructions properly:)

Well, the streaming does work. I had to go to vtuner websites to create the stream for each of my players, and then I set up the streams as favourites on them. If I disconnect the internet they are a bit slow to connect when they start up, but after that they can indeed play my local stream.mp3 without needing an internet connection.

vtuner appears to insist that the stream must be mp3s or 'Windows Media'. Whether (or how) that is enforced is a puzzle that I would want to look into if the 'remote streaming' facility were to be extended to cover other codecs (which I'd want if I was to pursue this method).

Apart from the codec, the other issue is one you mentioned about buffering. There does indeed seem to be quite a lag between control and the music being played. Whether that could be improved I don't know.

In the mean time I have also been experimenting with rygel. I managed to get squeezelite to talk to a pulseaudio 'upnp' audio device, in turn read by rygel and streamed by plugin 'GstLaunch' to one of my players. For some reason I can't get the other to work yet, but I have hopes. I'm struggling a bit with defining the codec I want to use, but have made some progress using existing software.

toby10
2014-05-31, 03:34
...... I had to go to vtuner websites to create the stream for each of my players....

vTuner is just an internet radio stream aggregator like Reciva or TuneIn. As such it likely only supports MP3, WMA (lossy), and AAC. Not too long ago it didn't even support AAC.

cparker
2014-06-02, 11:45
Thanks! I learn something every day. I wonder whether is documented anywhere. I don't recall ever reading anything about it.




On LMS on the web page, click the Help in the bottom left corner and then select Remote Streaming :) there is also a ton of other technical data for some late night reading

PasTim
2014-06-02, 12:14
On LMS on the web page, click the Help in the bottom left corner and then select Remote Streaming :) there is also a ton of other technical data for some late night reading
Yes, thanks. I found it once bpa pointed it out. Unfortunately it doesn't give me a good enough answer, but I am getting closer.....

lrossouw
2014-06-03, 01:49
A use case. Some of this is expressed in terms of the solution, for instance I have no better way to describe an ideal controller than to say 'just like LMS'. I don't want to throw away amplifiers or servers that I have that do an excellent job as it is. Some of the components are, therefore, part of my ideal system.

I want:

1) To use a browser on a wireless laptop or tablet to play music in my lounge, and sometimes in one other room.
2) The user interface needs to be as flexible as LMS is now, which means I can customise menus to play things like 'Works By Composer' and select a performance by a particular Artist, or 'Random Works', or 'Random Movements', or 'Albums by Conductor', and so on.... I have no need for anything better than that which LMS provides, so I want to keep it as it is.
3) This user interface includes the ability to select a 'player' which in this case would be the streaming software (i.e. just like squeezelite, especially in its 'local player' guise).
4) The music is in flacs, up to 24/192 quality, on a linux server.
5) My amplifiers are connected to my wired home network.
6) I want to select the input to the amplifier to be the music source and stream (i.e. the streamer on the server), no more than that, and nothing need be displayed on it for each track. It's just an input, like a tuner, LP player (yes, I still have more than one!) or whatever.
7) I have no need for additional hardware boxes, indeed I have a positive aversion to them. There is no need for them. They perform no useful function that I can detect.
8) I have no need for multi-room sync.
9) The KISS principle applies (Keep It Simple, Stupid). I just want to play music as simply and reliably as possible. Thus removing the Touch from my current set-up should make the solution better.

So, since both amplifiers already support streamed music over the wired network using UpnP, I want to use something like squeezelite to stream directly to them, rather than to an audio device on my server.

You kind of painted yourself into a corner here. You have complicated requirements, particularly point 2.

I see 3/4 options:

1) If you let 2 go I would suggest something like plex server on linux. I think it has DLNA features but it doesn't have the complicated browse menus. I have it but don't use DLNA or the music features so not sure how well it works. You possibly need to let go 4 as well. This also means you won't be using LMS. https://plex.tv/ (that's 3 requirements down). It has web interfaces and apps though.

2) Use LMS and somehow get it converted to the way you want. Hit's all your points but not 9. I think it will be tricky to set up and difficult to work with.

3) LMS has some upnp functionality. But I have no idea how it works. I think it acts more as a client playing other sources than anything else. Check under settings/advanced/network. It also acts as a server so you should be able to play stuff from your amp already. But it doesn't show up as a player AFAIK.

4) Set up one little box (which you have already in the form of an SB). Get one of the boards for which images exist on this forum. Write that image and you are set to go. Hit's all your points except 7. And most of these are so small you can hide them anyway.

bpa
2014-06-03, 02:00
Unfortunately it doesn't give me a good enough answer, but I am getting closer.....

Closing in on a possible solution .

What are the shortcomings ?
Perhaps now it is possibel to consider a small s/w plugin/mod when the task is manageable. As I mentioned earlier if it is appropriate, looking at the feasibility of upnp "publishing" something like a flac version of stream.mp3 should be considered.

PasTim
2014-06-03, 02:29
You kind of painted yourself into a corner here. You have complicated requirements, particularly point 2.
Thanks for your response. (2) is vital. I cannot play classical music sensibly without it. It really hard for me to understand why people think this is complex. I want to play classical works consisting of one or more tracks, and sometimes randomly. Because the idiots who invented the tagging formats didn't have a clue what they were doing we have been left with a ridiculous mess.... rant over for now :)



I see 3/4 options:

1) If you let 2 go I would suggest something like plex server on linux. I think it has DLNA features but it doesn't have the complicated browse menus. I have it but don't use DLNA or the music features so not sure how well it works. You possibly need to let go 4 as well. This also means you won't be using LMS. https://plex.tv/ (that's 3 requirements down). It has web interfaces and apps though.

plex is not that good. minimserver is much better, but has no random play of 'works'.



2) Use LMS and somehow get it converted to the way you want. Hit's all your points but not 9. I think it will be tricky to set up and difficult to work with.

I am getting there. Finding out how to do it without programming something new is not easy, but I'm currently testing a solution that is running CD quality sound to 2 different renderers and doesn't need any user interfaces (ie just boot the server) apart from the LMS web interface itself and selecting a 'stream' on the renderer when I start.



3) LMS has some upnp functionality. But I have no idea how it works. I think it acts more as a client playing other sources than anything else. Check under settings/advanced/network. It also acts as a server so you should be able to play stuff from your amp already. But it doesn't show up as a player AFAIK.

It's very limited. I use it for pictures to my TV, but the user interface, even with a decent upnp controller, is limited and doesn't handle classical well at all.



4) Set up one little box (which you have already in the form of an SB). Get one of the boards for which images exist on this forum. Write that image and you are set to go. Hit's all your points except 7. And most of these are so small you can hide them anyway.
[/QUOTE]
The whole point of the exercise was to see if it is possible to avoid hardware (it has nothing to do with size). Looking at forum entries about the Touch, EDO, squeezelite on Raspberry Pis etc, this is not as simple as some suggest. In addition, if your DAC only has a USB input there's a choice of different kernels and several people have found it very hard to make it all work.

I will report after more tests (if anyone is interested!)

TheLastMan
2014-06-03, 02:49
You kind of painted yourself into a corner here. You have complicated requirements, particularly point 2.

I see 3/4 options:

1) If you let 2 go I would suggest something like plex server on linux. I think it has DLNA features but it doesn't have the complicated browse menus. I have it but don't use DLNA or the music features so not sure how well it works. You possibly need to let go 4 as well. This also means you won't be using LMS. https://plex.tv/ (that's 3 requirements down). It has web interfaces and apps though.

2) Use LMS and somehow get it converted to the way you want. Hit's all your points but not 9. I think it will be tricky to set up and difficult to work with.

3) LMS has some upnp functionality. But I have no idea how it works. I think it acts more as a client playing other sources than anything else. Check under settings/advanced/network. It also acts as a server so you should be able to play stuff from your amp already. But it doesn't show up as a player AFAIK.

4) Set up one little box (which you have already in the form of an SB). Get one of the boards for which images exist on this forum. Write that image and you are set to go. Hit's all your points except 7. And most of these are so small you can hide them anyway.

I agree with every point you make. The OP seems to be ignoring the existing solutions and suggesting somebody writes him some complex software, free of charge of course, just so he can make use of the otherwise useless DLNA function in his amplifiers. Nice try, but not likely to get him what he wants.

The extra Squeezebox device is the least hassle solution and already easily achieved for about 50. With a WiFi enabled Raspberry Pi and PiCorePlayer it is a matter of minutes to build a working player and the Pi is so small that you could easily hide it behind virtually all but the tiniest amp. It is actually smaller than a Receiver, I have two Receivers and I barely notice those as it is!

If you want "hi-fi" you can always solder in a PiDac - which is supported by PiCorePlayer and produces a pretty decent sound by all accounts. True Hi-fi needs a separate DAC, of course, but that would be the same with his system as the DLNA DACs in his amplifiers are unlikely to be a match for even relatively lowly standalone DACs.

My only qualm is that every extra box is yet another power supply, plug and set of cables. But you can't have everything...

PasTim
2014-06-03, 02:53
Closing in on a possible solution .

What are the shortcomings ?
Perhaps now it is possible to consider a small s/w plugin/mod when the task is manageable. As I mentioned earlier if it is appropriate, looking at the feasibility of upnp "publishing" something like a flac version of stream.mp3 should be considered.
Very briefly I have squeezelite writing to a pulseaudio null sink. I found a very short python script on the web which then uses parec and sox to monitor this sink and write it in wav format making it available as http:192.168.m.n/8080:xyz.wav. I connect the renderer to this wav stream using minimserver (UPnP/DLNA) which has a playlist containing that http address.

This might sound complex from a use point of view, but in fact it is not. Everything starts automatically when I boot the server. On the amplifier I select the minimserver playlist and leave it at that (in much the same way that you select an input from a Touch or other device). So it's no different from using a hardware interface.

On the LMS web page I select the squeezelite 'player' and then select and play music I want as before.

I can run another copy of the python script reading the same source, writing to a different port, and get another renderer to use that (when trying to share the same streaming port it seems to break). The sound between the 2 seems in sync to me.

I can get up to CD quality but no more as yet. I haven't done sound stability tests because I'm trying to get better quality to play, so far without success. I think it is an issue with pulseaudio's 'monitor' feature.

So I think this is all possible and practical. If I could bypass the interim steps and get a version of squeezelite that made the audio stream directly available via an http port that would make the software a lot simpler to set up, discarding the need for the puleseaudio monitor, parec and (additional) sox steps. Having said that, given the varying capabilities of different renderers, using sox to adjust the stream quality to a specific renderer may provide a more flexible solution, unless I can run multiple 'squeezelite' processes, each outputting a specific quality stream.

If what I have done so far is of interest, I could write it up in more detail, including how I have configured and automated it on ubuntu. Let me know.

Personally I think this is a real and potentially fairly simple solution to replacing Logitech hardware without needing any other hardware. That it's also free is a wonder of the open software movement :)

PasTim
2014-06-03, 02:59
I agree with every point you make. The OP seems to be ignoring the existing solutions and suggesting somebody writes him some complex software, free of charge of course, just so he can make use of the otherwise useless DLNA function in his amplifiers. Nice try, but not likely to get him what he wants.

The extra Squeezebox device is the least hassle solution and already easily achieved for about 50. With a WiFi enabled Raspberry Pi and PiCorePlayer it is a matter of minutes to build a working player and the Pi is so small that you could easily hide it behind virtually all but the tiniest amp. It is actually smaller than a Receiver, I have two Receivers and I barely notice those as it is!

If you want "hi-fi" you can always solder in a PiDac - which is supported by PiCorePlayer and produces a pretty decent sound by all accounts. True Hi-fi needs a separate DAC, of course, but that would be the same with his system as the DLNA DACs in his amplifiers are unlikely to be a match for even relatively lowly standalone DACs.

My only qualm is that every extra box is yet another power supply, plug and set of cables. But you can't have everything...
As the nearly OAP OP I demur. I am not ignoring the hardware solutions. I am looking for software solutions. My hardware abilities are not good, and I avoid wielding a soldering iron whenever possible because I make a mess of things. That's all.

As far as I can tell the DLNA DAC in my Musical Fidelity M1CL1C is the same DAC as it uses for coax input, at 24/19200 uncompressed, so I don't thin k it lacks for quality.

ralphy
2014-06-03, 03:45
If I could bypass the interim steps and get a version of squeezelite that made the audio stream directly available via an http port that would make the software a lot simpler to set up, discarding the need for the puleseaudio monitor, parec and (additional) sox steps. Having said that, given the varying capabilities of different renderers, using sox to adjust the stream quality to a specific renderer may provide a more flexible solution, unless I can run multiple 'squeezelite' processes, each outputting a specific quality stream.
squeezelite supports writing the stream to stdout in little endian 16, 24 or 32 bits, that should allow you to remove the pulseaudio, monitor and parec steps.

If the python script can serve raw pcm, or be modified to do so, that would simplify it further.



Squeezelite v1.6.2, Copyright 2012-2014 Adrian Smith. See -t for license terms
Usage: squeezelite [options]
-o <output device> Specify output device, default "default", - = output to stdout
-a <f> Specify sample format (16|24|32) of output file when using -o - to output samples to stdout (interleaved little endian only)

PasTim
2014-06-03, 04:39
squeezelite supports writing the stream to stdout in little endian 16, 24 or 32 bits, that should allow you to remove the pulseaudio, monitor and parec steps.

If the python script can serve raw pcm, or be modified to do so, that would simplify it further.



Squeezelite v1.6.2, Copyright 2012-2014 Adrian Smith. See -t for license terms
Usage: squeezelite [options]
-o <output device> Specify output device, default "default", - = output to stdout
-a <f> Specify sample format (16|24|32) of output file when using -o - to output samples to stdout (interleaved little endian only)

Thanks very much.

I was aware of this but I couldn't figure out how to use it, my python skills being close to zero. I was also unsure how it would work, my linux knowledge being limited.

If squeezelite outputs an audio stream to stdout, what happens if no one is reading that stream? I can sort of see that when writing to a specific 'null' sink, the data just gets thrown away. Pulseaudio provides a monitor of that stream so that it gets read before it gets discarded. The python script I am using is below. I have to specify the input sox parameters because it doesn't know what 'raw' is. Only 44100 works at present. I specified the output parameters as well so I could change them easily. 44100 16 works, as does 96000 32.

I only dimly understand how this script works, but work it does! To bypass pulseaudio and parec I need to get the stdout of squeezelite into sox, but how?



!/usr/bin/python

import BaseHTTPServer
import SocketServer
import subprocess

PORT = 8082
# run "pactl list short |grep monitor" to see what monitors are available
# you may add a null sink for streaming, so that what is streamed is not played back locally
# add null sink with "pactl load-module module-null-sink"
MONITOR = 'null.monitor'
MIMETYPE = 'audio/x-wav'
ENCODER = 'sox -t raw -r 44100 -b 16 -L -e signed -c 2 - -t wav -r 44100 -b 16 -L -e signed -c 2 -'
BUFFER = 65536
class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_HEAD(s):
print s.client_address, s.path, s.command
s.send_response(200)
s.send_header('content-type', MIMETYPE)
s.end_headers()
def do_GET(s):
s.do_HEAD()
pa = subprocess.Popen('parec -d {} | {}'.format(MONITOR, ENCODER), shell = True, bufsize = BUFFER, stdout = subprocess.PIPE)
while True:
data = pa.stdout.read(1024)
if len(data) == 0: break
s.wfile.write(data)
print 'stream closed'


httpd = SocketServer.TCPServer(("", PORT), Handler)

print "listening on port", PORT

try:
httpd.serve_forever()

except KeyboardInterrupt:
pass

httpd.server_close()

bpa
2014-06-03, 05:00
So I think this is all possible and practical. If I could bypass the interim steps and get a version of squeezelite that made the audio stream directly available via an http port that would make the software a lot simpler to set up, discarding the need for the puleseaudio monitor, parec and (additional) sox steps. Having said that, given the varying capabilities of different renderers, using sox to adjust the stream quality to a specific renderer may provide a more flexible solution, unless I can run multiple 'squeezelite' processes, each outputting a specific quality stream.

If what I have done so far is of interest, I could write it up in more detail, including how I have configured and automated it on ubuntu. Let me know.

No need to write it up - I've seen this approach documented elsewhere - (personally I don't like pulseaudio it adds complexity to many of these "redirect" solutions) .

The problem with a http: stream is that - Flac (espec > 48kHz ) stream which tecnically feasible ( ) are not "usual" and many devices which play "http" stream can't handle Flac/Wav and/or > 48kHz (and also possibly the stream aggregator used such as vTuner) so you'd need to verify your devices can handle such a stream before making an effort to change LMS to generate one.

The only uncompressed stream I know of is a KEXP live http://kexp.org/audio/kexp-uncomp.wmx ( a strange variation on a Windows media stream) which streams at about 1.5mbits/sec for CD quality. Can your devices try to play this ? (it is opens then there is a chance of success even if it cannot play due to bandwidth). However, IIRC this stream can be a problem if not in the US.

PasTim
2014-06-03, 05:09
No need to write it up - I've seen this approach documented elsewhere - (personally I don't like pulseaudio it adds complexity to many of these "redirect" solutions) .

The problem with a http: stream is that - Flac (espec > 48kHz ) stream which tecnically feasible ( ) are not "usual" and many devices which play "http" stream can't handle Flac/Wav and/or > 48kHz (and also possibly the stream aggregator used such as vTuner) so you'd need to verify your devices can handle such a stream before making an effort to change LMS to generate one.

The only uncompressed stream I know of is a KEXP live http://kexp.org/audio/kexp-uncomp.wmx ( a strange variation on a Windows media stream) which streams at about 1.5mbits/sec for CD quality. Can your devices try to play this ? (it is opens then there is a chance of success even if it cannot play due to bandwidth). However, IIRC this stream can be a problem if not in the US.
I already know that both my renderers will happily play at least 24/96000 wav streams over UPnP, bypassing any vtuner and Internet Radio issues. I used foobar2000 upnp to prove it.

I too would like to avoid pulseaudio (having previously removed it as an unnecessary evil) and I'm trying to figure out how to do so.

bpa
2014-06-03, 05:35
I already know that both my renderers will happily play at least 24/96000 wav streams over UPnP, bypassing any vtuner and Internet Radio issues. I used foobar2000 upnp to prove it.
OK that clarifies things - "http" is a ambiguous in this context - "Http" you mean an stream "published" by a upnp server and not a stream such as one set as a favorite in vtuner.

PasTim
2014-06-03, 05:54
OK that clarifies things - "http" is a ambiguous in this context - "Http" you mean an stream "published" by a upnp server and not a stream such as one set as a favorite in vtuner.
Yes, apologies if I wasn't clear. vtuner was just one avenue of approach I tried, and failed.

I've tried more pulseaudio settings that you can shake a stick at, there being vast piles of confusing (to me at any rate) and conflicting information around, including things they say don't do (eg run a system version of pulseaudio), and loopback devices and so on. The system log tends to acquire messages that look bad, but apparently don't hurt at all, such as messages about DBus when running pulseaudio on a (usually) headless system. I've also had grief with the 'squeezeboxserver' permissions, and having no 'home' directory.

So I've been down a lot of blind alleyways thus far, but am encouraged to now have something working that seems stable enough to listen to without hassle, and doesn't rely on external information from vtuner and the like - it's all local. With work I'll find a simpler, and thus better, solution.

PasTim
2014-06-03, 13:03
I have now worked out how to pipe squeezelite directly to sox (not too hard, but I'm a little slow on the uptake at times), which packs it into a wav format and makes it available over http via UPnP to my players. I have also cracked the maximum bit rate issue, which was a setting needed on squeezelite to ensure it output at a specified rate and no other so sox knows what it is getting.

I can run separate squeezelites for each renderer, and a local one as well. Whether I can get them to sync I don't know yet, but I'm not that fussed about that.

I can also now dispose once again of pulseaudio.

If anyone is interested in how this now works I'll post more here. If not, thanks for all your help, if not altogether too encouraging from some! :)

jimmypowder
2014-06-03, 13:32
I'm waiting for my Auralic Aries Streamer to arrive the end of June.

I will give everyone a small review of this device when I get it and have played with it for about a week.

We will see if it's any good.

I'm afraid of the Olive one. Company is a very poor communicator and never lives up to its promises.

The owner of Auralic is very communicative ,has great equipment and doesnt mind posting details
in the Computer Audiophile forum

GeeJay
2014-06-03, 15:38
I'm waiting for my Auralic Aries Streamer to arrive the end of June.

I will give everyone a small review of this device when I get it and have played with it for about a week.

We will see if it's any good.

I'm afraid of the Olive one. Company is a very poor communicator and never lives up to its promises.

The owner of Auralic is very communicative ,has great equipment and doesnt mind posting details
in the Computer Audiophile forum

I checked out the Aries, too, but saw the price tag and moved on. Since I need a multi-room solution, the bill would be astronomical for me.

It is a cool looking unit, though. I'll be interested in your report, even if I can't afford to act on a positive review!

PS: Agreed on Olive. I can't believe how uncommunicative they've been. Makes one suspicious, and at the least glad I didn't invest at the get-go.

jimmypowder
2014-06-03, 16:28
I checked out the Aries, too, but saw the price tag and moved on. Since I need a multi-room solution, the bill would be astronomical for me.

It is a cool looking unit, though. I'll be interested in your report, even if I can't afford to act on a positive review!

PS: Agreed on Olive. I can't believe how uncommunicative they've been. Makes one suspicious, and at the least glad I didn't invest at the get-go.

I have an old Niles speaker selector box that can turn on speakers throughout the house from one source. The house is wired in almost every room so I do not need
a multi room unit. Just one.

I can't wait to get the Aries .I think they will do a really good job with this streamer . I will attach to a benchmark or nad m51,maybe my Audiolab mdac.

ralphy
2014-06-04, 04:14
I have now worked out how to pipe squeezelite directly to sox (not too hard, but I'm a little slow on the uptake at times), which packs it into a wav format and makes it available over http via UPnP to my players. I have also cracked the maximum bit rate issue, which was a setting needed on squeezelite to ensure it output at a specified rate and no other so sox knows what it is getting.

I can run separate squeezelites for each renderer, and a local one as well. Whether I can get them to sync I don't know yet, but I'm not that fussed about that.

I can also now dispose once again of pulseaudio.

If anyone is interested in how this now works I'll post more here. If not, thanks for all your help, if not altogether too encouraging from some! :)

I'm interested.

I couldn't use stdout from squeezelite in the python script without pretty much rewriting it.

I modified the pa script yesterday to use arecord from an ALSA loopback and with squeezelite output pointed to the same loopback device, I could stream the content but it rebuffered a lot. I suspect playing around with the buffer sizes might fix it, but from your post in the squeezelite thread, sounds like your solution is much cleaner.

Thanks in advance.

PasTim
2014-06-04, 04:38
I'm interested.

I couldn't use stdout from squeezelite in the python script without pretty much rewriting it.

I modified the pa script yesterday to use arecord from an ALSA loopback and with squeezelite output pointed to the same loopback device, I could stream the content but it rebuffered a lot. I suspect playing around with the buffer sizes might fix it, but from your post in the squeezelite thread, sounds like your solution is much cleaner.

Thanks in advance.
And here I was assuming that your initial reply was implying (very politely) that it was all easy and I was being slow in not understanding how to do it! Maybe I should have more faith in my own tinkering abilities :)

My squeezelite script, named squeezelite-streamMarantz.sh, for my Marantz player that will play 24/96 quality, is:


........./squeezelite-x86-64 -o - -a 24 -n Play-Stream-Marantz -m 00:00:00:00:00:02 -r 96000 -p 25 -u X -s localhost:3483 -f .../squeezeliteMarantz.log -d output=info

where ... is the path to squeezelite. The -u X makes sure that the output is at the specified rate, and the -m MAC is there to allow me to run multiple players by varying the MAC.

My python script, named playstreamMarantz, for the same player, is as below. The input to sox must be the same as the output from squeezelite. The script makes the stream available on port 8083 without further resampling.

#!/usr/bin/python

import BaseHTTPServer
import SocketServer
import subprocess

PORT = 8083

MIMETYPE = 'audio/x-wav'
BUFFER = 65536

class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_HEAD(s):
print s.client_address, s.path, s.command
s.send_response(200)
s.send_header('content-type', MIMETYPE)
s.end_headers()
def do_GET(s):
s.do_HEAD()
pa = subprocess.Popen('sox -t raw -r 96000 -b 24 -L -e signed -c 2 - -t wav - ', shell = True, bufsize = BUFFER, stdout = subprocess.PIPE)
while True:
data = pa.stdout.read(1024)
if len(data) == 0: break
s.wfile.write(data)
print 'stream closed'

SocketServer.TCPServer.allow_reuse_address = True
httpd = SocketServer.TCPServer(("", PORT), Handler)

print "listening on port", PORT

try:
httpd.serve_forever()

except (KeyboardInterrupt, SystemExit):
pass

httpd.server_close()


To run the player I run the following as the squeezelite user. I do this by using a user command defined in the LMS server power control plugin, which appears in the Extras menu. I also include it as a command named '.autoexec' in that plugin, so it starts when LMS is started. It starts by killing off any squeezelite and python script previously running.



pkill -SIGKILL -f playstreamMarantz
pkill -SIGKILL -f Play-Stream-Marantz
..../squeezelite-streamMarantz.sh | ..../playstreamMarantz > ...../playstreamMarantz.out 2>&1 &


All scripts must be executable by the squeezeboxserver user.

To be tidier I could parameterise the scripts so that the rate, port and so on where specified once in the startup script.

The versions above (amended on 7th June) can now supply a squeezelite log. So now I am not using any audio device or sink, which seems to me to be a clean solution. I've been playing this all morning, OK so far.

Let me know how you get on. I'm really quite intrigued by this as a way of using the best-in-class server and free software to drive many, if not all, network connected players.

Owen Smith
2014-06-04, 05:13
If I had a DLNA renderer in my amp I would be trying this out, it seems like a great idea to me. I agree with not creating more hardware boxes if none are needed.

PasTim
2014-06-04, 05:22
If I had a DLNA renderer in my amp I would be trying this out, it seems like a great idea to me. I agree with not creating more hardware boxes if none are needed.I know there's a mass of amplifiers out there without an ethernet connection, so additional hardware is needed. However, many at all price levels do now provide this. I believe almost all that have an ethernet (or wireless) connection support DLNA.

I'll be keeping my used Touch, and the one in a box in my loft, just in case.... :)

PasTim
2014-06-04, 15:06
To anyone trying out my scripts. I'm having a very strange problem whenever I stop and restart squeezelite (which I've tried to do for testing). Squeezelite goes up to 100% CPU almost every time. It seems to stop OK, but then when started again it chews up a CPU. Because I can't get a log yet, I can't figure out what the problem is.

So don't stop and restart squeezelite running in this mode :(

A fix to the python script applied in my earlier post #51 has solved this provided the renderer (player) isn't playing the stream. If you want to restart squeezelite, first stop the renderer from playing. This releases the http port, which in turn lets the python script terminate, which lets squeezelite communicate with it when restarted. If I find a way to fix it when the renderer is still playing I'll note that here as well.

ralphy
2014-06-05, 07:15
To anyone trying out my scripts. I'm having a very strange problem whenever I stop and restart squeezelite (which I've tried to do for testing). Squeezelite goes up to 100% CPU almost every time. It seems to stop OK, but then when started again it chews up a CPU. Because I can't get a log yet, I can't figure out what the problem is.

So don't stop and restart squeezelite running in this mode :(

A fix to the python script applied in my earlier post #51 has solved this provided the renderer (player) isn't playing the stream. If you want to restart squeezelite, first stop the renderer from playing. This releases the http port, which in turn lets the python script terminate, which lets squeezelite communicate with it when restarted. If I find a way to fix it when the renderer is still playing I'll note that here as well.

Thank you for the update.

Unfortunately, I didn't get a chance to try it out last night, hopefully tonight.

PasTim
2014-06-05, 10:09
Thank you for the update.

Unfortunately, I didn't get a chance to try it out last night, hopefully tonight.
I have one more fix applied to the script, adding

SocketServer.TCPServer.allow_reuse_address = True

This allows the http port to be reused if the script is killed and restarted, at which point the player will renderer will stop and lose the connection, which seems reasonable to me.

The internet is a wonderful thing. I found this knowing next to nothing about sockets, ports and python. :)

lrossouw
2014-06-06, 04:07
And here I was assuming that your initial reply was implying (very politely) that it was all easy and I was being slow in not understanding how to do it! Maybe I should have more faith in my own tinkering abilities :)


Not a bad solution you got there. I would personally prefer the a Pi/wandboard solution but this may be useful/simple way to use other devices that cannot run squeezelite or similar but do play streams. I think you can try to sync using timing settings on the server somewhere. It's not that easy and it won't be as good as a typical setup.

PasTim
2014-06-06, 04:25
Not a bad solution you got there. I would personally prefer the a Pi/wandboard solution but this may be useful/simple way to use other devices that cannot run squeezelite or similar but do play streams. I think you can try to sync using timing settings on the server somewhere. It's not that easy and it won't be as good as a typical setup.
Thanks. One less bit of hardware, cables, digital interfaces, plus operating system, seems much simpler and neater to me, but I know some people like having another bit of kit.

I did briefly try syncing (and I have the syncoptions plugin installed), but I don't think it will work too well. I've never used it other than for idle interest, so I'm not too bothered.

Mnyb
2014-06-06, 06:54
Not a bad solution you got there. I would personally prefer the a Pi/wandboard solution but this may be useful/simple way to use other devices that cannot run squeezelite or similar but do play streams. I think you can try to sync using timing settings on the server somewhere. It's not that easy and it won't be as good as a typical setup.


Thanks. One less bit of hardware, cables, digital interfaces, plus operating system, seems much simpler and neater to me, but I know some people like having another bit of kit.

I did briefly try syncing (and I have the syncoptions plugin installed), but I don't think it will work too well. I've never used it other than for idle interest, so I'm not too bothered.

yes i think only a "real" player would give you working sync . you may also experience short lags in controll play pause stop depending on how the dlna sofware player in the reciever works .

Example a real squeezebox has a alarge buffer about 30 seconds ,but the playback controll comands bypass that down in the player so your never bothered when using the player . and the small adjustments needed for sync is also done down in the player .

PasTim
2014-06-07, 10:35
I have one more fix applied to the script, adding

SocketServer.TCPServer.allow_reuse_address = True

This allows the http port to be reused if the script is killed and restarted, at which point the player will renderer will stop and lose the connection, which seems reasonable to me.

The internet is a wonderful thing. I found this knowing next to nothing about sockets, ports and python. :)
One, hopefully final, tweak, is a way to get the squeezelite log.

Add -d output=info (or whatever level you want) to the squeezelite script and in the script that pipes the output add 2> ..../squeezelite.err before the pipe.

I have updated the scripts in comment #51 accordingly.

Triode
2014-06-07, 12:22
One, hopefully final, tweak, is a way to get the squeezelite log.

Add -d output=info (or whatever level you want) to the squeezelite script and in the script that pipes the output add 2> ..../squeezelite.err before the pipe.

I have updated the scripts in comment #51 accordingly.

I believe if you use squeezelite 1.6.2 or the latest git you should not need to do this?

PasTim
2014-06-07, 12:56
I believe if you use squeezelite 1.6.2 or the latest git you should not need to do this?
Quite correct. I only just found this out from the main squeezelite thread - thanks. I'll tweak my script accordingly.

epoch1970
2014-06-08, 05:00
@PasTim: would you have any need for that? Init script to launch multiple squeezelite players (http://forums.slimdevices.com/showthread.php?98261-Sys-V-init-script-to-manage-multiple-squeezelite-players&p=740201&viewfull=1#post740201)
Not that the code is exemplary. But I had picked on OpenVPN's startup scripts design, which is very flexible in that it allows to launch (all or) any tunnel instance, each with its own configuration peculiarities.
Per-player launch scripts are sourced by the main script, so you can basically do anything you want in it (including shutdown or rm -rf /, indeed.) Players scripts receive the stop or start context information, same as the caller.
The scripts are outdated I think, some SL options have changed or have been added since I wrote this.
Just in case, and recognizing the winner of an uphill battle ;)

PasTim
2014-06-08, 10:28
@PasTim: would you have any need for that? Init script to launch multiple squeezelite players (http://forums.slimdevices.com/showthread.php?98261-Sys-V-init-script-to-manage-multiple-squeezelite-players&p=740201&viewfull=1#post740201)
Not that the code is exemplary. But I had picked on OpenVPN's startup scripts design, which is very flexible in that it allows to launch (all or) any tunnel instance, each with its own configuration peculiarities.
Per-player launch scripts are sourced by the main script, so you can basically do anything you want in it (including shutdown or rm -rf /, indeed.) Players scripts receive the stop or start context information, same as the caller.
The scripts are outdated I think, some SL options have changed or have been added since I wrote this.
Just in case, and recognizing the winner of an uphill battle ;)
Thanks. If I get into difficulty with my current method of starting squeezelite I'll certainly try this. As things are it's all working OK for now :)

PasTim
2014-06-10, 05:18
I have hit a problem with my method that currently appears to have no solution, so if you are trying it, beware.

Briefly, I cannot send more than 2GigaBytes (2^31 - 2,147,483,648). The connection is closed at that point and must be manually restarted at the renderer. This is about 31 minutes at 24/192, 62 minutes at 24/96, or over 3 hours at CD quality. A bit of a pain really. I've tried sending 'chunks' in the HTTP protocol, which made no difference.

This is not the place to ask questions about this so I won't bore you with the details. However, if you happen to know the answer I'd be very grateful! There must be a way round it, but so far no joy.

bpa
2014-06-10, 05:36
Briefly, I cannot send more than 2GigaBytes (2^31 - 2,147,483,648). The connection is closed at that point and must be manually restarted at the renderer. This is about 31 minutes at 24/192, 62 minutes at 24/96, or over 3 hours at CD quality. A bit of a pain really. I've tried sending 'chunks' in the HTTP protocol, which made no difference.

This "feels" like the maximum frame count in the WAV file header. Is you solution sending audio as WAV stream or a WAV file with a WVA header ? If so what is the length the header ? IIRC a length of 0 should be assumed by the "player" as infinite/stream but not all players understand it. IIRC LMS veraion fo Flac was modded to generate a WAV header length of 0 and sometimes users replace the LMS Flac by a standard distro Flac and get a similar problem with transcoded stream.

PasTim
2014-06-10, 05:50
This "feels" like the maximum frame count in the WAV file header. Is you solution sending audio as WAV stream or a WAV file with a WVA header ? If so what is the length the header ? IIRC a length of 0 should be assumed by the "player" as infinite/stream but not all players understand it. IIRC LMS veraion fo Flac was modded to generate a WAV header length of 0 and sometimes users replace the LMS Flac by a standard distro Flac and get a similar problem with transcoded stream.
I'm streaming wav over http. Since I don't (and can't) know the total length I am using the chunked transfer coding. I have seen elsewhere that some systems impose a 2GB limit on a stream, but all I really know as yet is that at 2GB the stream is closed, I believe by the client but I can't prove it. I'll try setting the 'content length' to 0 as well.

PasTim
2014-06-10, 12:51
This "feels" like the maximum frame count in the WAV file header. Is you solution sending audio as WAV stream or a WAV file with a WVA header ? If so what is the length the header ? IIRC a length of 0 should be assumed by the "player" as infinite/stream but not all players understand it. IIRC LMS veraion fo Flac was modded to generate a WAV header length of 0 and sometimes users replace the LMS Flac by a standard distro Flac and get a similar problem with transcoded stream.
I have looked at the wav file (created by sox) that is being streamed, and it does indeed have a size of just under 2GB. I tried setting the overall file size to 0 (after a rather rapid bit of learning about python, with which I am almost totally unfamiliar), which neither renderer liked. I also tried setting the data chunk size to 0, and again neither renderer liked that.

So it looks as if you are correct, as usual :)

I discovered there is an extended version of wav, called w64, but I suspect neither of my renderers will like it. I'll give it a quick try if I can get sox to support it.

ralphy
2014-06-11, 04:46
I have looked at the wav file (created by sox) that is being streamed, and it does indeed have a size of just under 2GB. I tried setting the overall file size to 0 (after a rather rapid bit of learning about python, with which I am almost totally unfamiliar), which neither renderer liked. I also tried setting the data chunk size to 0, and again neither renderer liked that.

So it looks as if you are correct, as usual :)

I discovered there is an extended version of wav, called w64, but I suspect neither of my renderers will like it. I'll give it a quick try if I can get sox to support it.

I might just be sox, perhaps try using the flac binary from lms as we know that supports > 2GB streaming.

--- playstreamMarantz.orig 2014-06-06 07:12:08.000000000 -0400
+++ playstreamMarantz 2014-06-11 07:36:49.000000000 -0400
@@ -6,7 +6,7 @@

PORT = 8083

-MIMETYPE = 'audio/x-wav'
+MIMETYPE = 'audio/flac'
BUFFER = 65536

class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
@@ -17,7 +17,7 @@
s.end_headers()
def do_GET(s):
s.do_HEAD()
- pa = subprocess.Popen('sox -t raw -r 96000 -b 24 -L -e signed -c 2 - -t wav - ', shell = True, bufsize = BUFFER, stdout = subprocess.PIPE)
+ pa = subprocess.Popen('/opt/logitechmediaserver/Bin/x86_64-linux/flac --totally-silent --force-raw-format --compression-level-4 --endian=little --channels=2 --bps=24 --sign=signed --sample-rate=96000 -c - ', shell = True, bufsize = BUFFER, stdout = subprocess.PIPE)
while True:
data = pa.stdout.read(1024)
if len(data) == 0: break

I've not reported on my success, as I haven't been able to get the scripts to work consistently with my popcorn hour. 1 time in 4 play attempts connect and play the stream.

PasTim
2014-06-11, 05:59
I've not reported on my success, as I haven't been able to get the scripts to work consistently with my popcorn hour. 1 time in 4 play attempts connect and play the stream.
Thanks. I believe the time-limiting problem was the wav file (as bpa suggested). I am, coincidentally, also trying flac as I write, my script now as below. I'm passing some environment variables so I can ensure squeezelite and the python program do the same thing. So far with this version the first time I tried to connect it appeared to succeed but didn't play, but from then on it's been flawless. However, I have to wait an hour or more on my test system to know if it's going to stop, which limits my testing opportunities. What problems do you get that cause it to fail?

It seems a bit silly to get my flacs converted to raw in squeezelite, and back to flac again, but never mind. If LMS had a 'stream.flac' as well as a 'stream.mp3' all this would be unnecessary, but I guess that's a wish too far!

Python - playstreamMarantz (a symbolic link to the python program so I can have multiple distinguishable copies) - a version using 'chunked' output - change the HOST for your system:



#!/usr/bin/python

import BaseHTTPServer
import SocketServer
import subprocess # For running sox
import sys # For writing to stderr
import os # For environment variables

PORT = int(os.environ.get('VBPORT'))
HOST = "192.168.1.10"
BITRATE = int(os.environ.get('BITRATE'))
DEPTH = int(os.environ.get('DEPTH'))

MIMETYPE = 'audio/flac'
BUFFER = 65536

class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
def do_HEAD(s):
sys.stderr.write (str(s.client_address) + str(', ') + str(s.path) + str(', ') + str(s.command) + '\n')
s.send_response(200) # OK
s.send_header('Content-Type', MIMETYPE) # Wav
s.send_header('Content-Length', '0') # length unknown
s.send_header('Transfer-Encoding', 'chunked') # Chunked
s.end_headers()
def do_GET(s):
s.do_HEAD() # Send the headers

# Use flac to transform raw data to flac, using the environment variables for bitrate and depth (bits)

pa = subprocess.Popen('flac - -c --channels 2 --bps ' + str(DEPTH) + ' --sample-rate ' + str(BITRATE) + ' --endian little --sign signed --fast', shell = True, bufsize = BUFFER, stdout = subprocess.PIPE)

# Loop until no data, reading and writing

while True:
data = pa.stdout.read(1024)
if len(data) == 0: break
s.wfile.write('%X\r\n%s\r\n'%(len(data), data))

# Done. Send null chunk

s.wfile.write('0\r\n\r\n')
sys.stderr.write(str('stream closed') + '\n')

# Allow the port to be re-used. If there's a failure but the client keeps the port open, restarting the server can fail
# unless this is set.

SocketServer.TCPServer.allow_reuse_address = True
httpd = SocketServer.TCPServer((HOST, PORT), Handler)

sys.stderr.write(str('listening on port ') + str(PORT) + '\n')

# And now do the above

try:
httpd.serve_forever()

# Close if run from terminal and closed, or a sigkill/term is received.

except (KeyboardInterrupt, SystemExit):
pass # Nothing

httpd.server_close()


Squeezelite - squeezelite-streamMarantz.sh - (using version 1.6.2 - which works with a log file)



/home/.../Programs/squeezelite-x86-64 -o - -a $DEPTH -n Play-Stream-Marantz -m 00:00:00:00:00:02 -r $BITRATE -p 25 -u X -s localhost:3483 -f /storage/Scripts/squeezeliteMarantz.log -d output=info


Main script to run the player.



pkill -SIGKILL -f playstreamMarantz
pkill -SIGKILL -f Play-Stream-Marantz
BITRATE=96000
DEPTH=24
VBPORT=8083
export BITRATE
export DEPTH
export VBPORT
/storage/Scripts/squeezelite-streamMarantz.sh 2> /storage/Scripts/squeezliteMarantz.err | /storage/Scripts/playstreamMarantz 2> /storage/Scripts/playstreamMarantz.err &

bpa
2014-06-11, 06:51
If LMS had a 'stream.flac' as well as a 'stream.mp3' all this would be unnecessary, but I guess that's a wish too far!

Before heading down this direction you'd need to check whether your player can actually play a http/flac stream as in your stream.flac. It is not common format and as such I think many players don't know how to handle it.

If you want to explore this - you can try getting VLC to produce a http/flac stream that is playable by your player. I tried a while a few years ago and never succeeded but things may have changed in the meantime.

PasTim
2014-06-11, 07:16
Before heading down this direction you'd need to check whether your player can actually play a http/flac stream as in your stream.flac. It is not common format and as such I think many players don't know how to handle it.

If you want to explore this - you can try getting VLC to produce a http/flac stream that is playable by your player. I tried a while a few years ago and never succeeded but things may have changed in the meantime.
My main test player/renderers can play flac. Using minimal compression flac is using less cpu that sox used to. My other player seems not to, but I may not have set it up right.

Edit - I managed to get the second player to accept flac, by not using the 'chunked' protocol, so now both will play the streams. All systems seem to interpret standards differently :(

I am now fighting flac itself. If I drop the connection from the client and reconnect, I get another copy of the flac process and its shell. With sox this did not happen. I have absolutely no idea why. I shall, at some point, by dint of trial and loads of error, find out how to stop this.

get.amped
2014-06-11, 10:19
Your perseverance is admirable. I have been following this thread with some interest even though I do not specifically have a scenario in which this implementation is useful. I really hope you work all the kinks out. When you do, maybe you will post another thread in the 3rd Party Software sub-forum with an appropriate heading and specific steps you found worked? I believe others will undertake this project once the trail is blazed but it's not obvious what path you took from the thread title.

PasTim
2014-06-11, 12:21
Your perseverance is admirable. I have been following this thread with some interest even though I do not specifically have a scenario in which this implementation is useful. I really hope you work all the kinks out. When you do, maybe you will post another thread in the 3rd Party Software sub-forum with an appropriate heading and specific steps you found worked? I believe others will undertake this project once the trail is blazed but it's not obvious what path you took from the thread title.
Thanks.

If and when I finally get all of the kinks out of this I'll start a new thread. It will, however, only show what works with my systems, my software skills being somewhat limited these days in terms of providing a well thought out generic solution. I am, for my sins, very much a hack at this :)

get.amped
2014-06-11, 13:02
Thanks.

If and when I finally get all of the kinks out of this I'll start a new thread. It will, however, only show what works with my systems, my software skills being somewhat limited these days in terms of providing a well thought out generic solution. I am, for my sins, very much a hack at this :)

And yet you have made remarkable progress from when you first posed the question and will at least have a "proof of concept" that should be of continuing value. This forum is full of threads that represent the work started by one person to address a specific need that then is expanded upon by others to do more.

PasTim
2014-06-11, 13:09
And yet you have made remarkable progress from when you first posed the question and will at least have a "proof of concept" that should be of continuing value. This forum is full of threads that represent the work started by one person to address a specific need that then is expanded upon by others to do more.
Thanks for the encouragement. I shall persist!

ralphy
2014-06-12, 03:50
Thanks. What problems do you get that cause it to fail?


I am now fighting flac itself. If I drop the connection from the client and reconnect, I get another copy of the flac process and its shell. With sox this did not happen. I have absolutely no idea why. I shall, at some point, by dint of trial and loads of error, find out how to stop this.

This is what happens to me with sox and flac, but using the older script verion.

I'll retry sox with the newer script to see if I get the same behaviour. I'm running debian 7 32-bit.

PasTim
2014-06-12, 04:20
This is what happens to me with sox and flac, but using the older script verion.

I'll retry sox with the newer script to see if I get the same behaviour. I'm running debian 7 32-bit.
I'm getting this problem with both flac and sox (sending flac format). It seems a thread is left running whenever the player reconnects. I'm struggling to find a way to kill it, my python skills being negligible. I don't recall seeing this when I sent wav format, but it may be that I just didn't notice.

PasTim
2014-06-12, 06:15
I'm getting this problem with both flac and sox (sending flac format). It seems a thread is left running whenever the player reconnects. I'm struggling to find a way to kill it, my python skills being negligible. I don't recall seeing this when I sent wav format, but it may be that I just didn't notice.
I've cracked that problem, but I should probably do more testing before going public.

Ralphy - if you want my revised flac script just let me know and I'll post it here.

ralphy
2014-06-12, 12:53
Ralphy - if you want my revised flac script just let me know and I'll post it here.

Yes, please and thank you.

Mnyb
2014-06-12, 16:41
If you eventually get down to a generic solution ( or what could be adapted to a generic solution ) .

I sugests keeping stream.wav and stream.pcm in the game as it probably would suite even more clients .

I haven't kept up with all you done , very good anyway :) the pieces I understand .

Another venue to explore is to "rescue" LMS own dlna plugin debug and extend it's capability , do you still have squeezelite instances as middlemen and players . I do get why to LMS they are just fully functionally squeezeboxes .

PasTim
2014-06-13, 00:48
Yes, please and thank you.
Here you are.

Note that you need to supply all the environment variables as shown here, included the FORMAT as WAV (uses sox) or FLAC (uses flac), and COMPRESSION -0 to -8 (or --fast), and the HOST IP address.

Script to kill off any existing player and start again.



pkill -SIGKILL -f playstreamMF
pkill -SIGKILL -f Play-Stream-MF
export BITRATE=192000
export DEPTH=24
export VBPORT=8082
export COMPRESSION="-4"
export FORMAT='FLAC'
export HOST="192.168.1.10"
/storage/Scripts/squeezelite-streamMF.sh 2> /storage/Scripts/squeezeliteMF.err | /storage/Scripts/playstreamMF 2>> /storage/Scripts/playstreamMF.err &


With WAV the player stops when it has received 2^31 bytes. Reselecting the stream on the player restarts it. I'm not sure whether it is doing something similar for FLAC (I haven't had long enough to do enough tests).

With FLAC, if you pause playing using the LMS web interface you seem to need to restart the player. This isn't true with WAV. Starting the FLAC stream is also somewhat temperamental on both my players. I think this is to do with the player software rather than the python program. If you select the stream and leave it alone it seems to run reliably for at least a couple of hours.

The python program.



#!/usr/bin/python

import BaseHTTPServer
import SocketServer
import subprocess # For running flac, sox or whatever
import sys # For writing to stderr
import os # For environment variables

HOST = os.environ.get('HOST') # The server host. Can also be set to ""
PORT = int(os.environ.get('VBPORT')) # An http port
BITRATE = int(os.environ.get('BITRATE')) # Bitrate 44100, 48000, 96000 or 192000
DEPTH = int(os.environ.get('DEPTH')) # A valid depth - 16, 24 or 32
COMPRESSION = os.environ.get('COMPRESSION') # Set to -4, or --fast or similar for flac
FORMAT = os.environ.get('FORMAT') # Format must be FLAC or WAV

FLACMIMETYPE = 'audio/flac'
WAVMIMETYPE = 'audio/x-wav'
BUFFER = 65536


class Handler(BaseHTTPServer.BaseHTTPRequestHandler):

def do_HEAD(s):
sys.stderr.write (str(s.client_address) + str(', ') + str(s.path) + str(', ') + str(s.command) + '\n')
s.send_response(200) # OK
if FORMAT == "FLAC": # A Flac or WAV audio format
MIMETYPE = FLACMIMETYPE
else:
MIMETYPE = WAVMIMETYPE
s.send_header('Content-Type', MIMETYPE) # Wav/flac

# We don't, and can't know the length. However, sending a Content-Length header with flac doesn't work, so I don't.
# I also tried 'chunked' output, but that didn't work with one of my renderers and flac.

s.end_headers()

def do_GET(s):

s.do_HEAD() # Send the headers

# Use flac or sox to transform raw data to flac or wav, using the environment variables for bitrate and depth (bits) and compression.
# All input is raw from stdin, and out to stdout (default for -c). Warnings are errors. No info/error messages.

if FORMAT == "FLAC":
engine = 'flac - -w --totally-silent --force-raw-format --channels 2 --bps ' + str(DEPTH) + ' --sample-rate ' + str(BITRATE) + ' --endian little --sign signed ' + str(COMPRESSION)
elif FORMAT == "WAV":
engine = 'sox -t raw -r ' + str(BITRATE) + ' -b ' + str(DEPTH) + ' -L -e signed -c 2 - -t wav - '
else:
sys.stderr.write(str('Assuming WAV format') + '\n')
engine = 'sox -t raw -r ' + str(BITRATE) + ' -b ' + str(DEPTH) + ' -L -e signed -c 2 - -t wav - '

pa = subprocess.Popen (engine, shell = True, bufsize = BUFFER, stdout = subprocess.PIPE)

# Loop until no data or an error, reading and writing.

try:
while True:
data = pa.stdout.read(1024)
if len(data) == 0: break
s.wfile.write(data)
sys.stderr.write(str('No more data') + '\n')

except: # Any error is bad news for real time data
sys.stderr.write(str('Exception whilst reading audio stream') + '\n')
raise

# Done. Report and kill off the subprocess.

finally:
pa.kill()

# Execution starts here....

# Allow the port to be re-used. If there's a failure but the client keeps the port open, restarting the server can fail
# unless this is set.

SocketServer.TCPServer.allow_reuse_address = True

# Define the server, using the above host and port, executing the Handler class

httpd = SocketServer.TCPServer((HOST, PORT), Handler)
sys.stderr.write(str('listening on port ') + str(PORT) + '\n')

# And now handle requests one by one. When one request finishes, usually with an error 32 (Broken pipe), the request finishes.
# Log the fact and try again.

try:
while True:
httpd.handle_request()
sys.stderr.write(str('Finished request') + '\n')

# Close if run from terminal and closed, or a sigkill/term is received.

except (KeyboardInterrupt, SystemExit):
pass # Nothing

# Something odd is going on. I never see the following, but it does stop on a SIGKILL.

sys.stderr.write(str('Exit') + '\n')
httpd.server_close()
httpd.shutdown()

PasTim
2014-06-13, 04:29
I'm close, but still have a niggle or 2.

I've had it running on flac 24/96 for nearly 3 hours so far without a stop, so I think the maximum size issue is resolved by using flac. However, with flac output (generated using flac or sox), when play stops at the end of the current list, and then you start playing again, the renderer doesn't play straight away. If you reselect the stream on the renderer it plays. A similar problem occurs if you pause play using the web page and then restart.

I'm preparing a fuller explanation of how to get all this up and running and will publish it on a separate thread fairly soon.

PasTim
2014-06-14, 08:11
Another venue to explore is to "rescue" LMS own dlna plugin debug and extend it's capability , do you still have squeezelite instances as middlemen and players . I do get why to LMS they are just fully functionally squeezeboxes .
I'd use the LMS dlna plugin to select the http stream (from an m3u playlist containing just the http stream URL) if I could, but it doesn't seem to have that functionality. I use minimserver instead. I'm sure other servers would do just as well for this very limited functionality of getting a URL to a renderer.

PasTim
2014-06-14, 08:25
I think I have got as far as I can without input from those more knowledgeable, and probably wiser, than I. The state of play now is that:

- I have cleaned up the logs so that they aren't full of trace callback errors whenever the player/renderer is restarted
- spare flac/sox programs (usually) aren't left lying around
- there are a few configuration additions from the versions published here up to now, such that the python program shouldn't have to be edited
- I've sprinkled a few hopefully helpful comments in the scripts
- I am finishing up some documentation on how to set it up.

However:

1) wavs play fine up to the limit of a single wav (> 3 hours for CD quality) and then stop - reselecting the playlist on the player/renderer restarts it

2) flacs play providing there is something has already started playing when the player/renderer selects the stream URL. However if you pause a track and restart it, and sometimes when changing tracks, you often have to reselect the stream URL on the player/renderer. I suspect the problem is that when nothing is playing, flac (from the flac or sox programs) produces no output (unlike for wavs from sox when there is a constant stream of data) and the stream protocol fails. I am not quite sure if there is an absolute upper time limit on the flac stream but it's > 3 hours at 24/192 provided the music doesn't stop!

So, should I publish on the "3rd Party Software sub-forum" and see what follows?

PasTim
2014-06-15, 05:01
So, should I publish on the "3rd Party Software sub-forum" and see what follows?
Well I have done. See http://forums.slimdevices.com/showthread.php?101721-Using-LMS-with-network-connected-amplifiers-without-SB-devices&p=783536&viewfull=1#post783536
In future I'll use that new thread for any updates, rather than this one. Note that there are some changes and additions to the start-up script, described in section 5b, and quite a lot of change to the python program.

philippe_44
2014-09-18, 02:03
I have now worked out how to pipe squeezelite directly to sox (not too hard, but I'm a little slow on the uptake at times), which packs it into a wav format and makes it available over http via UPnP to my players. I have also cracked the maximum bit rate issue, which was a setting needed on squeezelite to ensure it output at a specified rate and no other so sox knows what it is getting.

I can run separate squeezelites for each renderer, and a local one as well. Whether I can get them to sync I don't know yet, but I'm not that fussed about that.

I can also now dispose once again of pulseaudio.

If anyone is interested in how this now works I'll post more here. If not, thanks for all your help, if not altogether too encouraging from some! :)

Hi - I am interested (bridging LMS and Sonos)

PasTim
2014-09-22, 00:37
Hi - I am interested (bridging LMS and Sonos)
See my post at http://forums.slimdevices.com/showthread.php?101721-Using-LMS-with-network-connected-amplifiers-without-SB-devices&p=783536&viewfull=1#post783536

It isn't quite perfect, but I now use it all the time.

philippe_44
2014-09-22, 18:22
See my post at http://forums.slimdevices.com/showthread.php?101721-Using-LMS-with-network-connected-amplifiers-without-SB-devices&p=783536&viewfull=1#post783536

It isn't quite perfect, but I now use it all the time.

Thanks - I'll try to create something that is a single app that puts together Squeezelite and a uPNP media controller (basic) to instruct a uPNP media renderer (Sonos in my case) to HTTP-GET the audio from that app. I want everything together in a single app as I want to avoid transcoding for the sake of CPU efficiency. I'm not sure I'll be able to do that and it will certainly take me some time anyway, especially because, despite I'm a SW developer, I'm not familiar at all with uPNP, so we'll see, might be failure :-) I've started going through uPNP specs and all different options, available libraries for both Linux and Windows. But I'll certainly learn from the work you have done !

PasTim
2014-09-23, 00:12
Thanks - I'll try to create something that is a single app that puts together Squeezelite and a uPNP media controller (basic) to instruct a uPNP media renderer (Sonos in my case) to HTTP-GET the audio from that app. I want everything together in a single app as I want to avoid transcoding for the sake of CPU efficiency. I'm not sure I'll be able to do that and it will certainly take me some time anyway, especially because, despite I'm a SW developer, I'm not familiar at all with uPNP, so we'll see, might be failure :-) I've started going through uPNP specs and all different options, available libraries for both Linux and Windows. But I'll certainly learn from the work you have done !
Good luck! When you get something working I wouldn't mind trying it myself if you are willing to make it available.

If I could have worked out how to tack on the UPnP streaming code to squeezelite I would have done it in the one application myself, but I'm too rusty at software development. Reducing the amount of transcoding would be sensible but I couldn't manage that. I don't need my renderer to display what it was playing, so stream capture is good enough for my needs.

philippe_44
2014-09-28, 23:12
Good luck! When you get something working I wouldn't mind trying it myself if you are willing to make it available.

If I could have worked out how to tack on the UPnP streaming code to squeezelite I would have done it in the one application myself, but I'm too rusty at software development. Reducing the amount of transcoding would be sensible but I couldn't manage that. I don't need my renderer to display what it was playing, so stream capture is good enough for my needs.

Hi - I'm doing some progress with that, as mentionned on another thread. All uPNP MediaRendered are now discovered automatically and my app is capable to control them (play, stop, pause) and tell them to either play a file that my app pushes directly or to go an get an URI from another uPNP mediaserver (could be LMS). As a curiosity, in your example, how long is the delay between a "start" and an actual "play" on uPNP devices ? and how long is the stop to real stop ?

dafiend
2014-09-29, 00:06
Isn't UPnP a HUGE step back? What about replaygain, gapless playback, support for wide variety of formats, tight synchronization of devices etc.

What's the limitation with replacing squeezebox devices with hifiberrys and the like? why these obvious ads for the overpriced and less flexible sonos system in every replacement thread?

PasTim
2014-09-29, 00:28
Isn't UPnP a HUGE step back? What about replaygain, gapless playback, support for wide variety of formats, tight synchronization of devices etc.

I never use replaygain since I find the effect very artificial (I have never understood why people use it).
Playing using the tools I am using is gapless since it is a continuous stream from squeezlite (which is gapless), not a separate series of tracks. The renderer knows nothing about the tracks.
All my tracks are flacs, and anyway LMS and squeezelite manage transformations perfectly well.
And finally, I don't synchronise devices in separate rooms - I sit down to listen to music.

I just find all the extra hardware, software and cables to be extra sources of problems (and maintenance), preferring to pipe digitally from the server to the end DAC with only ethernet (and associated switches) in the way.

We are all different :-)

dafiend
2014-09-29, 01:09
@PasTim: I just re-read some pages of this thread and I suppose the points I made had already been raised. Although, I still disagree with you.

For one, I do think a small additional device is not as much of a burden as you make it out to be. (Particularly, cheap solutions based on Pi + HDMI out + picoreplayer or Android box + Squeeze Player exist and don't require much fiddling.)

For another, I still think if you don't need much of the functionality of LMS, it may be better to switch to a different product entirely. For example, have you looked at Asset UPnP (http://www.dbpoweramp.com/asset-upnp-dlna.htm)?

But anyways, I now realize the discussion was already a bit beyond the points I raised. Apologies.

---

EDIT


I never use replaygain since I find the effect very artificial (I have never understood why people use it).
I disagree with you here as well. I think ReplayGain tags based on EBU R128 (as implemented in fb2k) work reasonably well. Mastering of albums tends to get louder from year to year. To me, the loudness jump when listening, say, to an album mastered in the 2000s right after an album mastered in the late 1980s seems very artificial.

PasTim
2014-09-29, 01:29
...I still think if you don't need much of the functionality of LMS, it may be better to switch to a different product entirely. For example, have you looked at Asset UPnP (http://www.dbpoweramp.com/asset-upnp-dlna.htm)?

I use LMS, with additional plugins supporting non-standard tags and customised menus, precisely because the LMS software user interface is way ahead of anything else I have used. MinimServer and foobar2000 come close in their own ways, but are still not nearly as good (I haven't tried Asset, not least because it isn't free). One of the enormous advantages of open and free software is that forums, like this one, often work really well. One can comment on 'features', and get answers. No one is saying "it isn't worth the money", and so on.


...I think ReplayGain tags based on EBU R128 (as implemented in fb2k) work reasonably well. Mastering of albums tends to get louder from year to year. To me, the loudness jump when listening, say, to an album mastered in the 2000s right after an album mastered in the late 1980s seems very artificial.
I listen almost exclusively to classical music, which tends to have a much wider dynamic range than other styles of music. I find it best if I choose the volume I want rather than relying on software to do it for me :)

dafiend
2014-09-29, 04:30
One of the enormous advantages of open and free software is that forums, like this one, often work really well. One can comment on 'features', and get answers.

I wholeheartedly agree. But a big part of the problem with UPnP, in my mind, is that it's mostly implemented in products with closed software/firmware.

I own a 4-5 year old Blu Ray player from LG which is DLNA certified. Since a firmware update which I got maybe 3 years ago, it reboots (!) whenever I try to browse one of my UPnP AV servers. It does that with all four servers I've tried (the one running on my current router, the one running on my previous router, LMS, and the one running on my Synology NAS). Googling reveals it is a widespread problem with that LG model. LG won't do anything to fix it. The device is out of its warranty and support period and they want you to buy a newer model. And, of course, the device is pretty much locked down so you can't just fix the issue yourself. And the latest firmware from LG has NOT fixed the issue.

Then I have a Sony LCD TV which is maybe 3 years old. It's DLNA-certified as well. But apparently, they merely wanted to implement DLNA so that they have it as a checkbox feature. It can play hardly any format. JPEG, MPEG-2, MP3, that's it. Sony is still providing firmware updates for the TV. But all they seem to be doing is to work on their own VoD services and on Amazon VoD. You can forget about advanced DLNA/UPnP features.

Lastly, I have Pioneer AV receiver. 2014 model. On paper, it doesn't look so bad. It supports many formats/containers. However, it completely sucks as a controller, the GUI frequently hangs and functionality is extremely basic. I haven't figured out how to play to it (except for initiating the playback from the AV receiver itself). And, as Pio has released the 2015 model, it's unlikely to receive any further firmware updates. After all, Pio wants me to buy a new model in a few years and accumulate suffiently many new features in the meantime.

Compare that to a Raspberry Pi. I bought one in January 2013. It's been getting OS and application updates ever since. The community is so large that I predict I will receive updates (including new features) for at least another 3 years.

Now, I could try to put custom firmwares on some of my proprietary, DLNA-capable devices (nowadays it's even possible to root some Sony TVs). But I certainly don't wanna brick a 47" HDTV which I plan to continue using for a number of years. Compare that to a Pi which is basically un-brickable. Additionally, it's hard to customize heavily locked-down consumer electronics devices.

TL;DR: Most closed DLNA devices give you limited functionality and, furthermore, have a extremely limited support lifecycle. Sure, the Pi (or other suitable devices) constitutes yet another gadget. But it's open, configurable, and it's much more future-proof than any DLNA box you can buy off-the-shelf.



I listen almost exclusively to classical music, which tends to have a much wider dynamic range than other styles of music. I find it best if I choose the volume I want rather than relying on software to do it for me :)
Ok, that makes sense then.

PasTim
2014-09-29, 04:46
I wholeheartedly agree. But a big part of the problem with UPnP, in my mind, is that it's mostly implemented in products with closed software/firmware.

That's why I don't really use any of it except the stream capture feature. I have three different devices that all work with a plain flac stream with no library information and no control facility required of them other than to decode the stream they are given. The only tweak I have to apply is to use different quality output (24/96 for 2, 24/192 for the other - mainly just to prove it works!).

Using UPnP renderers as controllers, using libraries, different formats etc, I agree with you. I have a Humax PVR which is very particular with both video formats and how the library works - very few video streams work at all.

philippe_44
2014-09-29, 12:04
Isn't UPnP a HUGE step back? What about replaygain, gapless playback, support for wide variety of formats, tight synchronization of devices etc.

What's the limitation with replacing squeezebox devices with hifiberrys and the like? why these obvious ads for the overpriced and less flexible sonos system in every replacement thread?

Just a quick answer (although I've read your other arguments with PasTim) : this is all about a transition strategy to be able to inject any uPNP media renderer in your network and still be able to use it in conjunction with your existing LMS "ecosystem". I personally love iPeng, for example. But the reality is that the BoomBox, Radio and other SB are discontinued and some people like to buy off-the shelf, consumer grade & look "extensions/replacement" solutions and just have them working out-of-the box, even if they don't have all the flexibility of a native SB device. Some prefer quality of sound above any complication, some prefer simplicity of use of purist quality. Some prefer to be more hobbyist and tinker with hardware. I'm sitting a bit on both chairs, sometimes I go the HW route, sometimes the SW route, sometimes a bit of both. For that project, I've decided to try to see if I could build a fully SW, auto-setup, no complicated installation required, bridge between each Sonos device and LMS, so that a Sonos device would automatically show up in the LMS device list. I'm not saying this is the best and/or only solution, I'm just trying this route that would work very well for me (currently that "bridge" is done in HW in my system, by analogue connection between a Touch and PLAY:5, this is flawless for sync but not great for control). At the end of the day, this is a fun project and hopefully it will work and be useful for others. If not, I'll still have learnt something during that development :-)

Re UPNP huge step back, I would agree with you that trying to have MediaServer and MediaRenderer working well with any MediaControlPoint is a nightmare in general - it never works, it is slow to enumerate, crashes all the time, complains about unsupported formats etc etc. But in that precise case, LMS and Squeezelite are still at the core and do the heavy lifting. uPNP is just used for a small subset of MediaRenderer and MediaControlPoint capabilities

BTW, I'm _not_ solely focused on Sonos, any MediaRenderer will work, in fact my app discovers and manages a JBL and a Marants devices that sits in my home, but my n1 objective currently is Sonos.

PasTim
2014-09-29, 14:19
...For that project, I've decided to try to see if I could build a fully SW, auto-setup, no complicated installation required, bridge between each Sonos device and LMS...
As I said, I'd be very interested to see how you get on - please keep us posted!

philippe_44
2014-09-30, 00:04
As I said, I'd be very interested to see how you get on - please keep us posted!

I will, binary and source code as soon as I have something not too ugly. This evening, I was fighting with Squeezelite to make it multi-threaded inisde one single app (one thread per discovered uPNP MediaControler). There are a few globals that need to be put back in thread context. I also skimmed all the code that is linked to real audio HW, as it does not make sense for what I'm doing ... becoming squeezetiny :-)

aubuti
2014-09-30, 10:50
I listen almost exclusively to classical music, which tends to have a much wider dynamic range than other styles of music. I find it best if I choose the volume I want rather than relying on software to do it for me :)
That would argue against using track replaygain, agreed. But if you use album replaygain it doesn't affect the dynamic range of tracks within a given album. (With "album" defined however you wish. I prefer to tag so that album=work, whether or not that corresponds to what is on a particular disc.)

PasTim
2014-09-30, 13:20
... with "album" defined however you wish. I prefer to tag so that album=work, whether or not that corresponds to what is on a particular disc
I like to preserve the 'Album' concept (I have many recital type Albums containing excerpts of many Works), so have custom tags for 'Work', 'Movement' and 'WorkArtist', and use Erland's excellent plugins to provide menus for them. Some other servers also support such custom tags, but generally not as well.

philippe_44
2014-10-01, 00:02
I've done some progress and moved to http://forums.slimdevices.com/showthread.php?102203-uPNP-control-point. It will take me probably a lot of time to have a first decent version and then continue and polishing. I'd like to have opinions here. I can focus on a few things, not in order

1- Synchronisation (very challenging) or at least simultaneous playback start
2- Perfect gateway: most of the command on SB are on SO, including when volume is changed on SO, it is forwarded to SB/LMS. That would also include metadata exchanges
3- Audio quality : more transcoders on the fly (I don't like that), or use or replaygain and cross fade
4- configurability : how to setup the system and decide which uPNP machine can have a SB "buddy" and possibility to have parameters different for each pair
5- Stability

A PoC version is available - cross finger it will not do bad on your PC :-)

PasTim
2014-11-14, 06:59
I'd just like to put in a plug for a linux UPnP Control Point I found recently, called upplay. When used with a good UPnP server such as minimserver it's almost as good as LMS on my UPnP-compliant amplifiers. The same author also has a way of running a UPnP renderer on a linux PC, called upmpdcli.

See http://www.lesbonscomptes.com/upplay/ .

LMS has all sorts of spohistication I don't use, and some I still need such as being able to develop tools such as random play of classical 'works' at or above a specified rating range. I'm still hoping to get philipp_44's solution to work for me.

PasTim
2014-12-12, 15:18
... I'm still hoping to get philipp_44's solution to work for me.
And now it does! squeeze2upnp is the business.