toad.social is one of the many independent Mastodon servers you can use to participate in the fediverse.
Mastodon server operated by David Troy, a tech pioneer and investigative journalist addressing threats to democracy. Thoughtful participation and discussion welcome.

Administered by:

Server stats:

334
active users

#sox

1 post1 participant0 posts today
Replied in thread

@NOISEBOB #HowTo run #ShellScript when sound in mic

Here is a #bash function "getvol" which uses #SoX to listen for 0.1 second and then tells you peak volume, between 0 and 1:

function getvol {
rec -p trim 0 .1 stat 2>&1 >/dev/null | grep -Po "(?<=Maximum amplitude:).*" | grep -Po "\S+"
}

You can loop the function and do something if the volume is high enough.

Aus dem Leben eines Menschen, der seit langer Zeit auf all seinen Computern GNU/Linux laufen hat:

Eben wollte ich im Terminal ein Backup-Script starten. Ich wusste, dass es mit »back…« anfängt, also tippte ich nur back und dann die Tabulatortaste zur Vervollständigung. Eine der Optionen, die mir daraufhin angezeigt wurden, war background-noise-enterprise. Klingt interessant!

Um herauszufinden, worum es sich handelt, habe ich erst mal Folgendes gemacht:

$ type background-noise-enterprise 
background-noise-enterprise ist ein Alias von »play -n -c1 synth whitenoise lowpass -1 120 lowpass -1 120 lowpass -1 120«.

Da fiel mir ein, dass ich vor Jahren (als es Twitter noch gab) folgende Zeile in eine Datei namens ~/.bash_aliases eingefügt hatte:

alias background-noise-enterprise="play -n -c1 synth whitenoise lowpass -1 120 lowpass -1 120 lowpass -1 120"

Dadurch stand das Kommando auf meiner Shell zur Verfügung. Ich habe es ausprobiert, und es funktioniert wie am ersten Tag, als ich es vermutlich aus einem Tweet kopierte. Das Geräusch klingt täuschend echt und ergänzt das Lüftergeräusch vortrefflich.

Voraussetzung ist, dass das Programmpaket SoX installiert ist. Unter Debian heißt das Paket sox. Es wird beschrieben als »Das Schweizer Taschenmesser der Audiobearbeitung«. Oft benutzt man es zum Aufnehmen, Umwandeln oder Abspielen von Klängen. Dass da auch ein Synthesizer eingebaut ist, wissen nur wenige.

@alexisbushnell I had an evil time of it earlier this week. Spent a day chasing problems on what all the guides suggested would be simple.

Ended up with a single line of code!

on a raspberry pi with #sox installed and a USB sound card plugged in and identified as "card 3" by alsa, this bash command is everything you need:

sox -t alsa hw:3,0 --buffer 1024 -t alsa default pitch +500 echos 0.8 0.88 100 0.6 150 .5 band 1.2k 1.5k

Change values to taste!