Re: [SlimDevices: Plugins] Using LMS with network connected amplifiers without SB devices

2014-12-12 Thread PasTim

This method of using UPnP renderers has now been superceded by
squeeze2upnp by philippe_44, which does the job properly.  See
http://forums.slimdevices.com/showthread.php?102496-announce-squeeze2upnp-a-bridge-between-LMS-and-uPNP-devices
(and history at
http://forums.slimdevices.com/showthread.php?102203-uPNP-control-point).
It can be obtained at
https://github.com/philippe44/LMS-to-uPnP/tree/master/stable



LMS 7.9 on VortexBox Midi, Xubuntu 14.04, FLACs 16-24 bit,
44.1-192kbps. LMS  Squeeze2upnp (Beta - derived from squeezelite) to
Musical Fidelity M1 CLiC and Marantz CR603 UPnP renderers.  Squeezelite
to PC sound.  Minimserver (server) and upplay (control point) to same
amps  to upmpdcli/mpd PC renderers.  Meridian USB Explorer DAC from PCs
to speakers/headphones.  Wireless Xubuntu 14.04 laptop controls
LMS/upplay via Firefox.   Have a Touch with EDO, and a spare, but don't
use.

PasTim's Profile: http://forums.slimdevices.com/member.php?userid=41642
View this thread: http://forums.slimdevices.com/showthread.php?t=101721

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using LMS with network connected amplifiers without SB devices

2014-06-23 Thread PasTim

get.amped wrote: 
 That's quite a dissertation! You definitely brought this a long way from
 your initial inquiries into how it might be possible to accomplish this.
 Kudos!
Thanks. I've been listening a lot on the FLAC version and it seems fine
to me.



LMS 7.9 on VortexBox Midi running Xubuntu 14.04, FLACs 16-24 bit,
44.1-192kbps. Wired Touch + EDO, coax to Musical Fidelity M1 CLiC.
Wireless Xubuntu 14.04 laptop controls LMS via Chromium.   Meridian
Explorer USB DAC to listen via Squeezelite on Vortexbox  other PCs as
required.  Spare Touch in loft.

PasTim's Profile: http://forums.slimdevices.com/member.php?userid=41642
View this thread: http://forums.slimdevices.com/showthread.php?t=101721

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using LMS with network connected amplifiers without SB devices

2014-06-19 Thread cparker

And then I thought, what if my Touch fails?

It looks like a nice project you've got yourself :)  

I think I would make life simple and get something like this; 
http://www.amazon.co.uk/Lilliput-UM1010T-Monitor-USB-powered-Screen/dp/B003DPOMAS/ref=pd_sxp_f_pt

Connect it to a Intel NUC (silent mini pc) which has dual HDMI outputs,
plug one into the amp and just run a Squeezeplay client on it, this
would enable device sync and you get all the plugins, benefits and
features of LMS.

Note: I've not done this though so it might not work :)



www.spicefly.com - ** Spicefly SugarCube ** - A hassle free acoustic
journey through your music library using MusicIP.  Plus the finest
MusicIP installation guides, enhanced MIP Interface and SpyGlass MIP the
Windows Automated MusicIP Headless Installer.

cparker's Profile: http://forums.slimdevices.com/member.php?userid=2083
View this thread: http://forums.slimdevices.com/showthread.php?t=101721

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using LMS with network connected amplifiers without SB devices

2014-06-19 Thread get.amped

That's quite a dissertation! You definitely brought this a long way from
your initial inquiries into how it might be possible to accomplish this.
Kudos!



Win7Pro(x64)[3.3Ghz i5, 8GB RAM, 120GB SSD system, 15TB storage], LMS
7.9.0 - Logitech Squeezebox Classic V.3 - Cambridge Audio DacMagic -
NAD C160 - 2 x NAD C272 - Quad 22L2

get.amped's Profile: http://forums.slimdevices.com/member.php?userid=10022
View this thread: http://forums.slimdevices.com/showthread.php?t=101721

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


[SlimDevices: Plugins] Using LMS with network connected amplifiers without SB devices

2014-06-15 Thread PasTim

I have spent many hundreds of hours getting all my music, mainly
classical, sorted out and playable in various ways using LMS.  And then
I thought, what if my Touch fails?  No other system gives me the
flexibility of LMS and associated plugins, such as:

- many of my own menus, the way I want them, such as Works by Composer,
Albums by Conductor, and so on
- random play of sequential sets of tracks (i.e. classical works)
- track play statistics
- and so on.

So how can I replace my Touch?

I could try to put a hardware solution together, using a Raspberry Pi,
Wandboard or whatever and run the brilliant squeezelite on it .  But do
I want to worry again about async USB vs coax, vs optical, power
supplies, a whole new operating system to learn and manage and so on? 
No I don't.

I have 2 network connected amplifiers ('players', or 'renderers') that
accept flac and wav format audio streams over http (this is not unusual
with players that claim to be 'DLNA/UPnP compliant', although it may not
be universal). Why don't I just send the data over my wired ethernet
network direct to them?  The LMS DLNA plugin is very limited in
capability.  What I want to achieve is the full flexibility of LMS and
the web GUI control system, without an SB device.

Briefly, my solution is to:

- use a UpnP DLNA server to declare a playlist consisting of an http
adddress and port on my music server (that is the only job the server
needs to perform once the player is playing)
- run squeezelite on my server, behaving just like any other LMS device,
and pipe the output to an http stream in a form my players understand
- on my player, select the playlist item broadcast by my DLNA server
- use the LMS web page in the normal way (on a laptop/tablet/mobile) to
control what I am listening to (the player does not show any information
about what is playing).

If this is of interest, your server is on on linux, and you don't care
about multi-room synchronisation, see my next 2 posts.  The solution
isn't perfect yet, and it may even be impossible to make it so, but it
does work with some limitations, and I'm hoping some other people might
be able to think of ways of improving it.

Many of you will think I'm mad even trying to do this without hardware,
but I'm convinced a solution along these lines should be possible,
without no loss in sound quality, whilst retaining the same flexibility
and ease of use.



LMS 7.9 on VortexBox Midi running Xubuntu 14.04, FLACs 16-24 bit,
44.1-192kbps. Wired Touch + EDO, coax to Musical Fidelity M1 CLiC.
Wireless Xubuntu 14.04 laptop controls LMS via Chromium.   Meridian
Explorer USB DAC to listen via Squeezelite on Vortexbox  other PCs as
required.  Spare Touch in loft.

PasTim's Profile: http://forums.slimdevices.com/member.php?userid=41642
View this thread: http://forums.slimdevices.com/showthread.php?t=101721

___
plugins mailing list
plugins@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/plugins


Re: [SlimDevices: Plugins] Using LMS with network connected amplifiers without SB devices

2014-06-15 Thread PasTim

How to Play LMS without SB Hardware on a Headless Linux system.  Note
that some familiarity with Linux is required.

1. Install LMS, music etc. as normal.

2. Install DLNA server of your choice, I use the excellent minimserver
from http://minimserver.com/ , autostarted at boot time (a choice when
installed in /opt/minimserver).  Point it at your music library, or
an empty library for just this purpose if you wish.  Minimserver is very
flexible, just not as good as LMS.  If your server is headless, install
minimwatch on some other PC so you can monitor what minimserver is doing
on the server and change parameters if needs be. 

3. In the music library scanned by the DLNA server create a folder
containing http playlists of the form xyz.m3u, containing:


Code:


  http:/192.168.1.10:808n/abc.flac
  



or if you want wav format:


Code:


  http:/192.168.1.10:808n/abc.wav
  



one per network player (renderer), with an appropriate name (abc) for
each renderer, and a different port (8081, 8082 etc) for each player. 
Rescan your library so the DLNA server knows they exist.  The name (abc
in the above example) can be anything you want, but should be .flac or
.wav to tell the player what format to expect.  When, on the player, you
select the item from the playlist, you will see abc.flac (or wav), not
the xyz.m3u filename.

4. Get a copy of squeezelite somewhere it can be run easily.  Ensure
flac (for FLAC format) and/or sox (for WAV format) is installed
somewhere it can be run (check by typing 'flac' or 'sox' in a terminal).
If not natively installed there should be versions in the squeezelite
directories (/usr/share/squeezeboxserver/Bin/x86-64-linux on a 64 bit
ubuntu system). 

5. Create 2 scripts for each player/renderer.  One to run squeezelite,
one to run that script and send (pipe) the output to a python program
which puts it in a flac or wav format and sends it out via http.  Each
script should be executable.

5a) squeezelite script for version 1.6.2 or better (called
squeezelite-streamMF.sh in this case):


Code:


  #!/bin/bash
  # Run squeezelite.  If version below 1.6.2, remove the -d and -f options.
  /home/crusty/Programs/squeezelite-x86-64 -o - -a $DEPTH -n Play-Stream-MF -m 
00:00:00:00:00:01 -r $BITRATE -p 25 -u VLX -s localhost:3483 -f 
/storage/Scripts/squeezeliteMF.log -d output=info
  



Note the rate (-r)  and depth (-a) must match that in the python
program, so is set by the caller, and the (-m) MAC and (-n) Name must be
different for each player.  Set the path for your squeezelite program to
wherever it is on your system.  If you don't have it, get it from
https://code.google.com/p/squeezelite/.  The squeezelite debug log will
be in squeezeliteMF.log.  Errors will be in  squeezeliteMF.err (see
later).

5b) Script to join and execute the above, in my case called streamMF.sh
(note that all my scripts are in /storage/Scripts – put them where you
like). 


Code:


  #!/bin/bash
  
  # Kill off squeezelite, then python program
  pkill -SIGKILL -f Play-Stream-MF
  pkill -SIGKILL -f playstreamMF
  
  # Note all of the following must be specified even if you don't intend to use 
one of the options
  
  export BITRATE=192000   # Set the bitrate to a valid rate (44100, 48000, 
96000, 192000)
  export DEPTH=24 # Depth to 16,24 or 32
  export VBPORT=8082  # The http port to be used
  export COMPRESSION=4# Flac compression 0 to 8
  export HOST=192.168.1.10  # Host IP address
  export FORMAT=WAV# FLAC or WAV (the default)
  
  # Executable program for flacs - can be flac or sox.  If using WAVs, set this 
to sox. 
  # If flac (or sox) is not in your normal path, specify the location fully, eg:
  # /usr/share/squeezeboxserver/Bin/x86_64-linux/flac
  # If it is in your normal path, just enter flac or sox
  export FLACPROG=flac  
  
  # Executable sox program for WAVs
  export WAVPROG=sox
  
  # Now run squeezelite, piping the stdout into the python program (using the | 
symbol)
  # The 1st 2 provides an error log for squeezelite, which should be empty
  # The 2nd 2 provides a cumulative error and information log for the python 
program
  
  /storage/Scripts/squeezelite-streamMF.sh 2 
/storage/Scripts/squeezeliteMF.err | /storage/Scripts/playstreamMF 2 
/storage/Scripts/playstreamMF.err 
  
  



This script kills any existing squeezelite for this player, and the
associated python program, then restarts them, piping the output from
squeezelite to python, and hence flac or sox.

Hopefully the use of BITRATE, DEPTH and VBPORT is obvious.  The
COMPRESSION is the flac parameter 0 to 8 (with no preceding hypen).  The
HOST is your server (not 'localhost').  FORMAT must be FLAC or WAV.  WAV
seems more stable, but limits the length of playing time (see 12 below).
Set the name (or 

Re: [SlimDevices: Plugins] Using LMS with network connected amplifiers without SB devices

2014-06-15 Thread PasTim

The python program referred to in 5(c) above is as follows:


Code:


  #!/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
  import errno
  import socket
  
  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 0 to 8 
(least compression to most) for flac
  FORMAT = os.environ.get('FORMAT') # Format must be FLAC 
or WAV
  FLACPROG = os.environ.get('FLACPROG') # FLAC program - flac 
or sox
  WAVPROG = os.environ.get('WAVPROG')   # WAV program - sox
  
  FLACMIMETYPE = 'audio/flac'
  WAVMIMETYPE = 'audio/x-wav'
  BUFFER = 65536
  
  
  class Handler(BaseHTTPServer.BaseHTTPRequestHandler):
  
  
##
  # These next two functions, finish and handle_one_request, are cribbed 
directly from the /usr/lib/python libraries, 
  # overriding the originals to suppress the broken pipe trace.
  
  # If I'm finishing, an I/O error is of no interest.
  
  def finish(self,*args,**kw):
  if not self.wfile.closed:
  try:
  self.wfile.flush()
  self.wfile.close()
  self.rfile.close()
  except socket.error:
  pass
  return
  
  # At the end of the request a broken pipe error is not abnormal
  
  def handle_one_request(self):
  Handle a single HTTP request.
  
  You normally don't need to override this method; see the class
  __doc__ string for information on how to handle specific HTTP
  commands such as GET and POST.
  
  
  try:
  self.raw_requestline = self.rfile.readline(65537)
  if len(self.raw_requestline)  65536:
  self.requestline = ''
  self.request_version = ''
  self.command = ''
  self.send_error(414)
  return
  if not self.raw_requestline:
  self.close_connection = 1
  return
  if not self.parse_request():
  # An error code has been sent, just exit
  return
  mname = 'do_' + self.command
  if not hasattr(self, mname):
  self.send_error(501, Unsupported method (%r) % self.command)
  return
  method = getattr(self, mname)
  method()
  self.wfile.flush() #actually send the response if not already done.
  except socket.timeout, e:
  #a read or a write timed out.  Discard this connection
  self.log_error(Request timed out: %r, e)
  self.close_connection = 1
  return
  
  except socket.error, e: # For a broken pipe error 
(32), ignore it.
  #socket error
  if e[0] != errno.EPIPE:
  self.log_error(I/O Error: %r, e)
  self.close_connection = 1
  return
  
##
  
  # Function to create and send the headers.
  
  def do_HEAD(s):
  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, so sending a Content-Length header 
won't work.
  # I've used 'chunked' instead, which seems to work (as does no content lenth 
and not chunked)
  
  s.send_header('Transfer-Encoding', 'chunked')   # Chunked
  s.end_headers()
  return
  
  # Function to get data from stdin (squeezelite) and send it out to the 
renderer.
  
  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 in flac.  No info/error messages from either.
  # I've left (commented out) an option to use sox for flac instead of the flac 
program should that be of interest.
  
  if FORMAT == FLAC:
  if FLACPROG == WAVPROG:
  engine = str(WAVPROG) + ' -V0 -t raw -r ' + str(BITRATE) + ' -b ' +  
str(DEPTH) + ' -L -e signed -c 2 - -t flac -C ' + str(COMPRESSION) + ' - '  
  
  else:
  engine = str(FLACPROG) + ' - -w --totally-silent --force-raw-format 
--channels 2 --bps ' +  str(DEPTH) + ' --sample-rate ' + str(BITRATE) + ' 
--endian little --sign signed -F -' + str(COMPRESSION)
  else:
  engine = str(WAVPROG) + ' -V0 -t raw -r ' + str(BITRATE) + ' -b ' +  
str(DEPTH) + ' -L -e signed -c 2 - -t wav - '
  
  pa = subprocess.Popen