Cron job for starting/stopping recorder

for me this works:

parec ~defaultuser/SoundRec/$(date +"%Y%m%d-%H%M%S").audio

The file is raw data and I can convert it to whatever using audacity on my pc (Import → Raw data). It creates huge files so watch out. I think I tried the on-the-fly mp3 conversion but the battery drainage was alot for long recordings. If you want a script that detects if parec runs and kills it but if it doesn’t run it start recording, and also changes the microphone sensitivity here it is:

   #!/bin/sh

   if [ -n "$(ps -e | grep parec)" ]; then
     killall parec;
     pacmd set-source-volume source.droid 65536;
     exit 0;
   fi

   pacmd set-source-volume source.droid 229376
   parec ~defaultuser/SoundRec/$(date +"%Y%m%d-%H%M%S").audio

Change the ~defaultuser / directory accordingly.

Reference source: Running shell script from *.desktop file - together.jolla.com

2 Likes