Audio capture records exactly SUNRISE_TARGET_SECS centred on sunrise
Previously sunrise-audio-capture.sh recorded the entire capture window (70+ minutes) and daily_sunrise_video.sh sought to the right position with a complex offset calculation. Now: record floor(TARGET/2) seconds before sunrise and ceil(TARGET/2) after — odd second goes to post-sunrise. The file is exactly SUNRISE_TARGET_SECS long and already centred, so no offset is needed when mixing. AUDIO_PRE_BUFFER_MIN removed — it was part of the old whole-window scheme and is no longer meaningful. https://claude.ai/code/session_01C4jbd3waXG3eKZYbGUjLUQ
This commit is contained in:
@@ -171,10 +171,9 @@ audio_offset="0"
|
||||
cam_audio="$image_dir/sunrise-audio.m4a"
|
||||
if [ "${AUDIO_ENABLED:-false}" = "true" ]; then
|
||||
if [ -f "$cam_audio" ]; then
|
||||
buffer_sec=$(( ${AUDIO_PRE_BUFFER_MIN:-2} * 60 ))
|
||||
audio_offset=$(echo "scale=1; $SUNRISE_PRE_MIN * 60 + $buffer_sec - $SUNRISE_TARGET_SECS / 2" | bc)
|
||||
# Already exactly SUNRISE_TARGET_SECS, centred on sunrise — no offset needed
|
||||
audio_src="$cam_audio"
|
||||
echo "Audio: camera recording offset=${audio_offset}s"
|
||||
echo "Audio: camera recording (centred on sunrise)"
|
||||
else
|
||||
library_dir="$SCRIPT_DIR/sunrise-sounds"
|
||||
if [ -d "$library_dir" ]; then
|
||||
|
||||
Reference in New Issue
Block a user