Open mats-ng opened 4 years ago
Good suggestion
To add to this, it would be good to have the timemachine option atuomatically enabled with a buffer of a few seconds or so, and when the begin-threshold is reached, it includes the few seconds before the threshold was reached. This would stop the very beginning of the audio being cut off, just before it's loud enough to start recording.
just for the record, I have a setup using silentjack to detect the activity, the extra complication of the shell script is to debounce the activity because jack_capture issues a new session every time start/stop are sent instead of ignoring when there's a current one active
#!/bin/env sh
stateFile=/tmp/.recordingstate
windowTime=5
let prebufferTime=${windowTime}+1
debounceCode() {
command="$1"
echo "if grep -F -q -v ${command} ${stateFile}; then oscsend localhost 8875 /jack_capture/tm/${command};fi;echo "${command}" > ${stateFile}"
}
echo stop > "${stateFile}"
silentjack -q -p "${windowTime}" -- sh -c "$(debounceCode stop)" &
silentjack -r -q -p "${windowTime}" -- sh -c "$(debounceCode start)" &
jack_capture --timemachine --timemachine-prebuffer "${prebufferTime}" --daemon --osc 8875 &
Hi, could the timemachine option in jack_capture be extended to start and end a recording automatically, based on the incoming signal passing a threshold value?
This would need four additional options to jack_capture - similar to the autorecord function in jack_timemachine[1]:
--autorecord -> enable autorecord --begin-threshold -> dB level above which automatic recording will start --end-threshold -> dB level below which automatic recording will stop --end-time -> silence length before automatich recording ends
My use case would be building a headless multitrack recorder with a RaspberryPi, and with this additional new functionality jack_capture would fit the bill perfectly, ie. start "listening" on boot and (pre-)record whenever something is coming in through the system:capture* ports.
[1] https://github.com/swh/timemachine/commit/0bddb47e2a1d6585a5b80f6775007e3808cb142c?diff=split