#!/bin/sh mkdir -p recordings while true do # get date in ISO 8601 format with nanoseconds OS=$(uname) if [ "$OS" = "Darwin" ]; then DATE=$(gdate --iso-8601=ns) elif [ "$OS" = "Linux" ]; then DATE=$(date --iso-8601=ns) else echo "Unsupported OS: $OS" exit 2 fi # record audio using ffmpeg ffmpeg \ -y \ -f pulse \ -i "alsa_input.usb-HANMUS_USB_AUDIO_24BIT_2I2O_1612310-00.analog-stereo" \ -ac 1 \ -ar 96000 \ -sample_fmt s32 \ -t "3600" \ -c:a flac \ -compression_level 12 \ "recordings/$DATE.flac" done