-;; This is the main script for the pcm-dispatch tool
-;; last main-arg nominates the configuration file
-
+#!/usr/bin/newlisp
+
+;; This script implements dispacth of stdin via first available for
+;; ALSA pcm listed in $HOME/.alsa-dispatcher
+;;
+;; Debug testing, eg
+;; IN=/usr/share/sounds/alsa/Rear_Left.wav
+;; sox $IN -r48000 -esigned -es-b16 -c2 x.wav | ./alsa-dispatcher
+;; o.e. send audio in format [48000 Hz S16_LE stereo wav] to the program
+;;
+;; Installation requires ALSA configuration, e.g. in ~/.asoundrc, like
+;; (replace $PROGRAM with the program's full pathname)
+;; ----
+;; pcm.dispatch {
+;; type asym
+;; playback {
+;; pcm {
+;; type plug
+;; slave {
+;; pcm "file:|exec $PROGRAM"
+;; format S16_LE; channels 2; rate 48000
+;; }
+;; }
+;; }
+;; capture plughw
+;; }
+;; ----
+;; $ aplav -D dispatch /usr/share/sounds/alsa/Rear_Left.wav
+;;
+;; Maybe setup "dispatch" as default
+;; ----
+;; pcm.!default dispatch
+;; ----
+
+(constant 'DEBUG nil) ;; Set to true to get stdout/stderr while degugging