All-purpose auto-record. Made this project using a Raspberry Pi (or a similar device) and a usb-mic to record an acoustic piano.
This is a Python script that can be run as a Unix service on any linux-based platform. The script connects to a usb-microphone and keeps listening to it's input. If the input goes above a certain loudness level, it starts recording. Once it encounters a silence (audio signal below the threshold) for 5 seconds, it stops recording and saves the file — either locally or on Google Drive.
I made this script to run on a Raspberry Pi 4, using a Zoom H1N USB Recorder — which is placed inside my Kawai Upright Piano. Whenever the piano is played, the script saves the audio clip to a Google Drive folder automatically.
As a result, I never have to worry about pressing record while playing.
You are going to need Python 3 on your system. See how to install python on your machine.
Clone the repository to your local machine and navigate to the cloned repository.
git clone { repo URL }
cd auto-record
Install the required python packages.
python3 -m pip install -r requirements.txt
To configure the parameters for the app, open config.yml
in an editor.
- threshold: 100
- lol: something
Try running the script now.
python3 record.py
You will see the following output —
Listening...
Run this on the Terminal:
chmod +x install_service.sh
./install_service.sh
To remove the service,
chmod +x remove_service.sh
./remove_service.sh
To check if the service is running,
sudo service status autorecord
sudo journalctl -u autorecord -f