question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Exiting arecord in shell script?

See original GitHub issue

So I’m utilizing dancyPi in sync with Raspotify / Librespot. Librespot has hooks so I’m using the follow script:

#!/bin/bash
if [ "$PLAYER_EVENT" = "start" ]; then
  sudo python3 home/pi/dancyPi-audio-reactive-led/python/visualization.py scroll
elif [ "$PLAYER_EVENT" = "stop" ]; then
  sudo python3 home/pi/dancyPi-audio-reactive-led/python/off.py
else
  :
fi

However, I did not realize that the “off.py” script did not kill the mic recording. What would be the best way of freeing up the mic after Spotify stops?

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:72 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
JasonLG1979commented, Dec 14, 2020

@naztronaut They introduced pulseaudio as default on the desktop version of Raspberry Pi OS so that’s going to throw a wrench in anything you do audio wise from now on. Pulseaudio is great 99.9% of the time for normal use cases but for stuff like this it complicates things.

I’m not bad at python. One of these days money permitting I’d like to get some of the LED’s and other necessary hardware and combine them with a couple 3 or 4 inch full range drivers a Raspberry Pi 4 and a HIFIBERRY AMP2 hat and maybe a small screen and build a small-ish semi-smart boombox for my son. He’s 12 and is starting to show an interest in actually listening to real music. If/when that happens I’m sure we can iron out a few kinks and probably create a few,lol!!!

1reaction
naztronautcommented, Nov 13, 2020

@JasonLG1979 - awesome! Thanks for the modifications to asound.conf - definitely will try it out and probably merge it into a branch for others to use.

Loving the collaboration in this thread! I learned a lot just reading through the conversation.

Read more comments on GitHub >

github_iconTop Results From Across the Web

stopping arecord recording without stopping rest of script
Show activity on this post. This command will record until the user exits with ctrl-c and the wav recorded format should be piped...
Read more >
arecord command in Linux with examples - GeeksforGeeks
arecord is a command-line sound recorder for ALSA(Advanced Linux Sound ... -h, –help : It is used to show the help messages and...
Read more >
How to Abort or Come out of ksh script?
I want to abort script if input variable matched first field in any line of a file. #!/bin/sh read INPUTVAR1 awk "{if(\$INPUTVAR1 ==...
Read more >
How to Record and Replay Linux Terminal Sessions using ...
To stop script, type exit and press [Enter]. If the script can not write to the named log file then it shows an...
Read more >
Using the script command on Linux to record command line ...
The easiest way to use the script command is simply to type "script" in the terminal window and press ^d when you want...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found