So,
I found some code, you'll find in the attached zip 3 files:
- json-ui2.pl: a simple test program that runs in a loop and queries
SBS from the CLI (using JSON) for the status of one player, cooks a
status string, sends it to the speech daemon, slides the volume down,
then up, then goes to sleep and start again. It's in perl and your
system may lack some required modules. You should find them in CPAN in
any case. It uses a hardcoded value for the MAC address of the player
you want to speak about, and expects to run from the same machine as the
SBS server. If you know perl you'll find your way around but in any case
I also attach a log, this along with looking at the code (esp. CLI
queries) may be enough to get you started.
- cata_speak: a sysV init script that uses the debian (?)
start-stop-daemon facility to daemonize the speech program. It is not
necessary, but without it the program runs in blocking mode
- cata_speak.pl: the speech program intended to run as a daemon. You
will have to configure the script to define the sound device to use
(alsa), make sure directories for pipes and flags do exist, and binaries
are present on your system. This program uses pico2wave to generate an
audio file and aplay to send it to the sound device. Last time I
checked, pico2wave wasn't able to pipe its output to aplay, but insisted
on a file for output. It's slower but sounds nicer than my previous TTS
chain (still commented in the file) which used "espeak | mbrola |
aplay".
Some comments. Cata_speak.pl was initially designed to speak system
status on a headless computer. So it had to sit and wait in the system,
speak when activated (reading from a pipe) and then go quiet. I reused
it with json-ui.pl: the program sends strings into the pipe and ends the
sequence with a line that reads "SPEAK". When Cata_speak.pl sees the
SPEAK sentence, it dumps all the previous contents of the pipe to the
audio device. This takes some time, so to allow clients to manage I use
some flags which show the speech program is already active. E.g. the
json-ui.pl script only slides the volume down when pico2wave has
finished generating the wav file, and waits until aplay has finished
speaking to raise volume again.
This is a bit complicated and certainly more fragile and less capable
that I'd like it to be. An SBS plugin would certainly not work this way,
but I don't know my way around plugins so I let this part to you.
Hope this helps, and good luck.
Code:
--------------------
max:/home/max# ./json-ui2.pl
[./json-ui2.pl] Starting. Status updates every 120 secs or so. Press Ctrl-c
to break.
[1401916318] Sending [You're listening to: "Love Will Tear Us Apart", from
"The Complete BBC Recordings", by "Joy Division". Next up: "Novelty", from
"Live at The Factory, Manchester, 13 July 1979 \(Unknown Pleasures Collector\'s
Edition\)", same artist.]
[1401916321] Sliding vol: 100 -> 70 (step:-5): [100..95..90..85..80..75..70]
[1401916341] Sliding vol: 70 -> 100 (step:5): [70..75..80..85..90..95..100]
[1401916343] Sleeping 66 more seconds (28 secs randomly subtracted)
[1401916409] Sending [You're listening to: "Novelty", from "Live at The
Factory, Manchester, 13 July 1979 \(Unknown Pleasures Collector\'s Edition\)",
by "Joy Division". Next in about 3 minutes: "Mercy Seat", from "Ultra Vivid
Scene", by "Ultra Vivid Scene".]
[1401916417] Sliding vol: 100 -> 70 (step:-5): [100..95..90..85..80..75..70]
[1401916436] Sliding vol: 70 -> 100 (step:5): [70..75..80..85..90..95..100]
[1401916437] Sleeping 30 more seconds (62 secs randomly subtracted)
[1401916467] Sending [You're listening to: "Novelty", from "Live at The
Factory, Manchester, 13 July 1979 \(Unknown Pleasures Collector\'s Edition\)",
by "Joy Division". Next in about 2 minutes: "Mercy Seat", from "Ultra Vivid
Scene", by "Ultra Vivid Scene".]
[1401916475] Sliding vol: 100 -> 70 (step:-5): [100..95..90..85..80..75..70]
[1401916495] Sliding vol: 70 -> 100 (step:5): [70..75..80..85..90..95..100]
[1401916496] Sleeping 90 more seconds (1 secs randomly subtracted)
[1401916586] Sending [You're listening to: "Novelty", from "Live at The
Factory, Manchester, 13 July 1979 \(Unknown Pleasures Collector\'s Edition\)",
by "Joy Division". Next up: "Mercy Seat", from "Ultra Vivid Scene", by "Ultra
Vivid Scene".]
[1401916594] Sliding vol: 100 -> 70 (step:-5): [100..95..90..85..80..75..70]
[1401916613] Sliding vol: 70 -> 100 (step:5): [70..75..80..85..90..95..100]
[1401916614] Sleeping 83 more seconds (9 secs randomly subtracted)
[1401916697] Sending [You're listening to: "Mercy Seat", from "Ultra Vivid
Scene", by "Ultra Vivid Scene". Next in about 2 minutes: "Uncertain Smile",
from "Soul Mining", by "The The".]
[1401916702] Sliding vol: 100 -> 70 (step:-5): [100..95..90..85..80..75..70]
[1401916713] Sliding vol: 70 -> 100 (step:5): [70..75..80..85..90..95..100]
[1401916715] Sleeping 69 more seconds (33 secs randomly subtracted)
^C
Exiting after 4 runs.
--------------------
+-------------------------------------------------------------------+
|Filename: perlcode.zip |
|Download: http://forums.slimdevices.com/attachment.php?attachmentid=16003|
+-------------------------------------------------------------------+
4 SB 3 iPeng (iPhone + iPad) SqueezeLite Squeezebox Server 7.8.1
(Debian 7.5) with plugins: CD Player, WaveInput by bpa IRBlaster by
Gwendesign (Felix) Server Power Control by Gordon Harris Smart Mix
by Michael Herger PowerSave by Jason Holtzapple Song Info, Song
Lyrics by Erland Isaksson WeatherTime by Martin Rehfeld ShairTunes
by StuartUSA Local Player, BBC iPlayer, SwitchPlayer by Triode Auto
Dim Display, SaverSwitcher, ContextMenu by Peter Watkins.
------------------------------------------------------------------------
epoch1970's Profile: http://forums.slimdevices.com/member.php?userid=16711
View this thread: http://forums.slimdevices.com/showthread.php?t=101635
_______________________________________________
discuss mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/discuss