audio2influx - sox info about 1s of audio
authorDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 18 Feb 2020 19:56:17 +0000 (20:56 +0100)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Tue, 18 Feb 2020 19:57:09 +0000 (20:57 +0100)
README
alsamixer-left-53-70.png [new file with mode: 0644]
audio2influx.sh [new file with mode: 0755]
audio2mqtt.sh [deleted file]
system/audio2influx.service [new file with mode: 0644]
system/audio2mqtt.service [deleted file]

diff --git a/README b/README
index d8b6ab1..65b31d5 100644 (file)
--- a/README
+++ b/README
@@ -25,3 +25,11 @@ which uses https://github.com/dpavlin/mq7-co-monitor/
 on Arduino to produce output which is then fed to dsm501.pl.
 
 
+Another strage one is audio2influx.sh which doesn't require
+any external hardware but instead report sox info about 1s
+or audio to influxdb. I'm using this to passivly monitor
+fan rotation by connecting it directly to microphone input
+on netbook and adjusting input gain to prevent clipping
+using alsamixer.
+
+To make alsamixer work, I had to remove pulseaudio.
diff --git a/alsamixer-left-53-70.png b/alsamixer-left-53-70.png
new file mode 100644 (file)
index 0000000..af574ff
Binary files /dev/null and b/alsamixer-left-53-70.png differ
diff --git a/audio2influx.sh b/audio2influx.sh
new file mode 100755 (executable)
index 0000000..ee76625
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+while true ; do
+
+arecord -d 1 -r 96000 /dev/shm/tmp.wav 2>/dev/null
+time=`date +'%s%N'`
+info=`sox /dev/shm/tmp.wav -n stat 2>&1 | grep '[0-9][0-9][0-9]*$' | sed -e 's/[()]//g' -e 's/: */=/' -e 's/  */_/g' | tee /dev/shm/audio | tr '\n' ',' | sed 's/[, ]*$//'`
+curl --silent -XPOST http://10.60.0.92:8086/write?db=rot13 --data-binary "fan,dc=trnjanska $info $time"
+
+done
diff --git a/audio2mqtt.sh b/audio2mqtt.sh
deleted file mode 100755 (executable)
index ee76625..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-while true ; do
-
-arecord -d 1 -r 96000 /dev/shm/tmp.wav 2>/dev/null
-time=`date +'%s%N'`
-info=`sox /dev/shm/tmp.wav -n stat 2>&1 | grep '[0-9][0-9][0-9]*$' | sed -e 's/[()]//g' -e 's/: */=/' -e 's/  */_/g' | tee /dev/shm/audio | tr '\n' ',' | sed 's/[, ]*$//'`
-curl --silent -XPOST http://10.60.0.92:8086/write?db=rot13 --data-binary "fan,dc=trnjanska $info $time"
-
-done
diff --git a/system/audio2influx.service b/system/audio2influx.service
new file mode 100644 (file)
index 0000000..670f9d4
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=audio to influx
+
+[Service]
+User=dpavlin
+ExecStart=/home/dpavlin/air-quality/audio2influx.sh
+Restart=on-failure
+
+[Install]
+WantedBy=multi-user.target
diff --git a/system/audio2mqtt.service b/system/audio2mqtt.service
deleted file mode 100644 (file)
index b4f0096..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-[Unit]
-Description=audio to mqtt
-
-[Service]
-User=dpavlin
-ExecStart=/home/dpavlin/air-quality/audio2mqtt.sh
-Restart=on-failure
-
-[Install]
-WantedBy=multi-user.target