Re: [SlimDevices: Unix] A door chime system for Squeezebox players with PCP 3.22. Or something.

2017-10-07 Thread drmatt

Indeed. Lots of ways to extend an idea like this for all sorts of use
cases.


-Transcoded from Matt's brain by Tapatalk-



--
Hardware: 3x Touch, 1x Radio, 2x Receivers, 1 HP Microserver NAS with
Debian+LMS 7.9.0
Music: ~1300 CDs, as 450 GB of 16/44k FLACs. No less than 3x 24/44k
albums..

drmatt's Profile: http://forums.slimdevices.com/member.php?userid=59498
View this thread: http://forums.slimdevices.com/showthread.php?t=108107

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


Re: [SlimDevices: Unix] A door chime system for Squeezebox players with PCP 3.22. Or something.

2017-10-06 Thread epoch1970

drmatt wrote: 
> Nice. How about sending a URL to a web server with a audio jingle file
> on it..?
> 
> 
> -Transcoded from Matt's brain by Tapatalk-
Sure, why not. Latency would take a hit, though. And if the url points
to a huge file, if would fear issues with network bandwidth and local
storage. Plus the server needs to be up. 
I see 2 limitations with the system as shown here: 1) use of dmix; this
is really sad and, 2) local and awkward configuration through the script
for receivers; although while configuring the ramps and volumes is a
pain, I don’t think you need to change it very often once done.

In the real application this isn’t used as a door chime, it is
used for service calls in a public place, for use by employees or the
public. You can ring from windows PCs equipped with touchscreens or from
EnOcean wireless-battery less buttons. One of the receivers is a
firewall: it logs and dates each call. 
Multicast makes the thing both robust and flexible IMHO.



3 SB 3 • Libratone Loop, Zipp Mini • iPeng (iPhone + iPad) • LMS 7.9
(linux) with plugins: CD Player, WaveInput, Triode's BBC iPlayer by bpa
• IRBlaster by Gwendesign (Felix) • Server Power Control by Gordon
Harris • Smart Mix, Music Walk With Me, What Was That Tune? by Michael
Herger • PowerSave by Jason Holtzapple • Song Info, Song Lyrics by
Erland Isaksson • AirPlay Bridge by philippe_44 • WeatherTime by Martin
Rehfeld • 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=108107

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


Re: [SlimDevices: Unix] A door chime system for Squeezebox players with PCP 3.22. Or something.

2017-10-06 Thread drmatt

Nice. How about sending a URL to a web server with a audio jingle file
on it..?


-Transcoded from Matt's brain by Tapatalk-



--
Hardware: 3x Touch, 1x Radio, 2x Receivers, 1 HP Microserver NAS with
Debian+LMS 7.9.0
Music: ~1300 CDs, as 450 GB of 16/44k FLACs. No less than 3x 24/44k
albums..

drmatt's Profile: http://forums.slimdevices.com/member.php?userid=59498
View this thread: http://forums.slimdevices.com/showthread.php?t=108107

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


Re: [SlimDevices: Unix] A door chime system for Squeezebox players with PCP 3.22. Or something.

2017-10-06 Thread Julf

Great! Will be very useful for me, as I need the door bell (IP-enabled,
of course) to interrupt my music.



"To try to judge the real from the false will always be hard. In this
fast-growing art of 'high fidelity' the quackery will bear a solid gilt
edge that will fool many people" - Paul W Klipsch, 1953

Julf's Profile: http://forums.slimdevices.com/member.php?userid=42050
View this thread: http://forums.slimdevices.com/showthread.php?t=108107

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


[SlimDevices: Unix] A door chime system for Squeezebox players with PCP 3.22. Or something.

2017-10-06 Thread epoch1970

I thought I'd share my recipe for overlaying music playing on pCP
machines with audio jingles. This is a simplified version of a working
setup with multiple emitters, multiple sounds, multiple players.

It uses multicast over UDP to let many devices receive the order to do
something (generally: play a sound.) Each device can elect to execute or
discard the order, according to its local configuration. So you can
arbitrary link one event from one device to one receiver to one output.
What gets sent via multicast is a simple ASCII string, not audio itself.
In the case of pCP players they select a local wav file corresponding to
the string, but non-audio receivers are possible too. The payload is
extremely small so network load is minimal.
Local processing is fast enough to ensure the delay between sending
(pressing a button) and executing (hearing a sound) feels ok. I've
elected to let socat do the multicast magic, as it is ported to many
platforms.
When multiple audio receivers play a jingle, there is no sync mechanism
but in effect with pCP you get all receivers to play at the same
instant.

The system works as long as there is one emitter and one receiver active
on the network, so it's independent from LMS. To overlay an incoming
audio jingle over possibly playing music, I've determined a double ramp
works best: music volume goes down gradually while the jingle volume
goes up gradually, and back.
With the JustBoom amp HAT I've used -and all i2s devices?- there is no
hardware mixer so a software mixer is defined with ALSA with 2 sources
and 2 volume controls.
The script that manipulates volume controls is very basic, it works with
jingles that are 4 or 5 seconds long. YMMV.

This is how to play a jingle on pCP 3.22 (normal kernel version) with an
add-on amp on a Pi 3 wired via ethernet:
  
- *Setup pCP via the web interface*, at
  http://:

  -  -Install the socat extension.- Select Main Page, Beta (bottom of
page), then Extensions. On that new page, make sure you're using the
Official piCore repository (default), then in "Available extensions
in the Official piCore repository" select socat.tcz and press Load.
  -  -Select your add-on DAC or amp.- Select Squeezelite Settings,
then pick your add-on model under "Choose Audio output". Click Save.
Reboot if needed, come back here, click Audio card control, and
disable the onboard soundcard.
  -  -Setup Squeezelite to use an ALSA audio mixer.- Select
Squeezelite Settings, then in field "Output setting" enter the value
"music" (without quotes). Press Save. If you restart Squeezelite as
prompted it will now fail, that's ok.
  -  -Set pCP to run a script at boot.- Select Tweaks, then under
"User commands", enter user command "/home/tc/gong.sh" (no quotes)
and press Save.

- *Locate a wav jingle file* and copy it under the name "action1.wav"
  to pCP, e.g. "scp jingle.wav
  tc@:~/action1.wav". The setup is known to
  work with audio files ~ 4-5 secs. in duration, format "Signed 16 bit
  Little Endian, Rate 44100 Hz, Mono"
-  *Customize pCP via the shell*, at ssh
  tc@:

  -  -Replace the stock /etc/asound.conf- file with this:
Code:

## Onboard audio disabled in /boot/config.txt
  ## Otherwise volume sliders that use "control.card X"
  ## could attach to the wrong card at boot in pCP 3.2.0.
  ##
  ## Alsaequal removed from this file. Some issues controlling
  ## softvols with equal in pCP 3.2.0. Add it back if you want.  
  ##
  ## Make sure hardware volume control "Digital" is set to
  ## a safe value, you probably don't want a jingle to play
  ## at full power by accident
  ##
  
  ## A) Devices available to applications 
  ##
  # Squeezelite is set to use this device
  # This softvol allows to ramp down-up music when an application
  # plays another sound.
  # Nominal state is: 100%
  pcm.music {
type softvol
slave.pcm plug:dmixer
control.name musicvol
control.card 0
  }
  
  # Same story here: ramp up-down sounds sent by other applications
  # Nominal state is: 0%
  pcm.gong {
type softvol
slave.pcm plug:dmixer 
control.name gongvol
control.card 0
  }
  
  ## B) Audio output device. Here: Justboom amp HAT
  ##
  # Shared access to our audio card
  pcm.dmixer {
type dmix
ipc_key 1234
ipc_key_add_uid true # Needed ?
ipc_perm 0666
slave {
pcm "hw:CARD=sndrpijustboomd,DEV=0"
}
  }
  
  # Whatever ctl magic thing
  ctl.dmixer {
type hw
card 0
  }
  #EOF


E.g. from the shell session on pCP, run "cp /etc/asound.conf
~/asound.conf.orig", then copy the code above, run "cat >
/etc/asound.conf", paste clipboard contents in the window, and hit