From 8434fc0b33fc469c7d65d3559a306ecc09473318 Mon Sep 17 00:00:00 2001 From: St33v Date: Wed, 26 Jan 2022 14:26:17 +1100 Subject: Update speakerWatchdog.sh --- speakerWatchdog.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/speakerWatchdog.sh b/speakerWatchdog.sh index 344955f..3d8f9a7 100644 --- a/speakerWatchdog.sh +++ b/speakerWatchdog.sh @@ -10,3 +10,9 @@ # st33v@cr4y:~$ grep RUNNING /proc/asound/card*/pcm*/sub*/status # /proc/asound/card2/pcm0p/sub0/status:state: RUNNING +# That is fine, but the status remains as 'RUNNING' even after the speakers have turned themselves off... +# So I'm going down the track of periodically sending a 'sound' to a loopback device +# sudo modprobe snd-aloop +# Now aply -l shows a new 'card' called Loopback. + + -- cgit v1.3 From 204886bc79d468748b9af9dca00b5dce94f0ee42 Mon Sep 17 00:00:00 2001 From: St33v Date: Wed, 26 Jan 2022 14:29:54 +1100 Subject: sox can do it too --- wav2mp3.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wav2mp3.txt b/wav2mp3.txt index 6a99e8d..25c87f0 100644 --- a/wav2mp3.txt +++ b/wav2mp3.txt @@ -8,3 +8,8 @@ ffmpeg -i openShedSlidingDoor.wav -codec:a libmp3lame -q:a 4 openShedSlidingDoor see https://trac.ffmpeg.org/wiki/Encode/MP3 S + +# 26 Jan 2022 +sox can also do it + +sox file.wav file.mp3 -- cgit v1.3 From af3b9e05aeada16b438c723f77101e5e557c8ce6 Mon Sep 17 00:00:00 2001 From: St33v Date: Wed, 26 Jan 2022 16:01:10 +1100 Subject: Update wav2mp3.txt --- wav2mp3.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/wav2mp3.txt b/wav2mp3.txt index 25c87f0..4fbb638 100644 --- a/wav2mp3.txt +++ b/wav2mp3.txt @@ -13,3 +13,7 @@ S sox can also do it sox file.wav file.mp3 + + + + -- cgit v1.3 From b236ba24b168db0720dcf5a2f75c95302ef95a8d Mon Sep 17 00:00:00 2001 From: St33v Date: Wed, 26 Jan 2022 16:02:01 +1100 Subject: text dump of notes for manual solution --- speakerWatchdog.sh | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/speakerWatchdog.sh b/speakerWatchdog.sh index 3d8f9a7..d78c40a 100644 --- a/speakerWatchdog.sh +++ b/speakerWatchdog.sh @@ -16,3 +16,50 @@ # Now aply -l shows a new 'card' called Loopback. +record one second of default stream: + +$ rec -d -n trim 0 1 stat + + rec sox in record mode + -d default input + -n direct output to /dev/null + trim 0 1 duration 1 second + stat + +Output: + +Input File : 'default' (pulseaudio) +Channels : 2 +Sample Rate : 48000 +Precision : 16-bit +Sample Encoding: 16-bit Signed Integer PCM + +In:0.00% 00:00:01.02 [00:00:00.00] Out:48.0k [ | ] Clip:0 +Samples read: 96000 +Length (seconds): 1.000000 +Scaled by: 2147483647.0 +Maximum amplitude: 0.000000 +Minimum amplitude: 0.000000 +Midline amplitude: 0.000000 +Mean norm: 0.000000 +Mean amplitude: 0.000000 +RMS amplitude: 0.000000 +Maximum delta: 0.000000 +Minimum delta: 0.000000 +Mean delta: 0.000000 +RMS delta: 0.000000 +Rough frequency: -2147483648 +Done. + +So if Max amplitude = 0 then we have silence! + +to generate a tone that is not audible: +play -n synth 1 sine 40 fade .2 0 + + play sox alias + -n dummy input file + synth synthesise a sound + sine sine wave [the default, so not strictly necessary] + 40 Hz + fade fade in from zero volume to max volume over 200 msec. + '0' says fade out at end over same period. -- cgit v1.3