bidule wrote: 
> 
> To answer your specific question:
> I'm trying to use the Samplerate information in order to switch a DAC
> hardware clock on the fly.
> For the time being the way I want to test it is this way:
> Getting the sample rate each time a new track is starting and from that
> select the right hardware clock with a GPIO flag.
> However, you are right that it will probably be too late that way.
> 

This is somewhat similar to 'this thread'
(https://forums.slimdevices.com/showthread.php?111859-Determine-samplerate-LMS-squeezelite-or-like)
Anything involving the server will be too slow.
Options:
1) modify squeezelite to execute an external command when a track
changes, passing the sample rate as an argument
2) configure squeezelite to output the sample rate (see #16) and either
-    a) redirect to a FIFO socket, write e.g. a python script to read
from FIFO socket and do something 
-    b) redirect to a file, wait for "resample" (or "track start sample
rate" if you don't resample) in file, execute

2b is fairly simple if  you use 'sexpect'
(https://github.com/clarkwang/sexpect).
Here's an example:


Code:
--------------------
    $ export SEXPECT_SOCKFILE=/tmp/sexpect-se.sock
  $ sexpect sp "/usr/bin/tail" "-1f" 
"/var/log/logitechmediaserver/squeezelite.log"
  $ sexpect x -re '.*resampling from ([0-9]*) -> ([0-9]*)' > /dev/null
  $ while true; do sexpect x -re '.*resampling from ([0-9]*) -> ([0-9]*)' > 
/dev/null; echo "input rate: $(sexpect expect_out -i 1) output: $(sexpect 
expect_out -i 2)"; done
  input rate: 44100 output: 48000
  input rate: 44100 output: 48000
  ...
--------------------



'Various SW' (https://www.nexus0.net/pub/sw/): Web Interface | TUI |
Playlist Editor / Generator | Music Classification | Similar Music |
Announce | EventTrigger | Chiptunes | LMSlib2go | ...
'Various HowTos' (https://www.nexus0.net/pub/documents/LMS/): build a
self-contained LMS | Bluetooth/ALSA | Control LMS with any device | ...
------------------------------------------------------------------------
Roland0's Profile: http://forums.slimdevices.com/member.php?userid=56808
View this thread: http://forums.slimdevices.com/showthread.php?t=113499

_______________________________________________
plugins mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/plugins

Reply via email to