<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Execute script (GPIO Relay) based on if sound is being played]]></title><description><![CDATA[<p dir="auto">Hi guys, I want to monitor if audio is being played, e.g:</p>
<pre><code>cat /proc/asound/card*/pcm*/sub*/status
</code></pre>
<p dir="auto">And if any status contains <code>running</code> I want to execute a script (in my case turn on the amplifier). I want a simple solution and initially I thought it might be possible with udev or python or bash. Does any of you have a great and easy idea?</p>
<p dir="auto">Thanks</p>
]]></description><link>https://forum.magicmirror.builders/topic/8914/execute-script-gpio-relay-based-on-if-sound-is-being-played</link><generator>RSS for Node</generator><lastBuildDate>Wed, 17 Jun 2026 12:50:48 GMT</lastBuildDate><atom:link href="https://forum.magicmirror.builders/topic/8914.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 14 Oct 2018 12:47:12 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Execute script (GPIO Relay) based on if sound is being played on Sun, 14 Oct 2018 13:37:31 GMT]]></title><description><![CDATA[<pre><code>while sleep 1; do
  if grep -q 'RUNNING' '/proc/asound/card0/pcm0p/sub0/status';
  then
    echo "Running!"
  else
    echo "Not Running!"
  fi
done
</code></pre>
<p dir="auto">this seems to work but the amplifier produces a too loud cracking sound when switching on, I have two spare relais und my MagicMirror, I will hook up the speakers to those and try again.</p>
]]></description><link>https://forum.magicmirror.builders/post/45389</link><guid isPermaLink="true">https://forum.magicmirror.builders/post/45389</guid><dc:creator><![CDATA[yep_DD]]></dc:creator><pubDate>Sun, 14 Oct 2018 13:37:31 GMT</pubDate></item></channel></rss>