Nimbin[12]?SDL & Graphics / mapcreator / commits / 64311cc

mapcreator git · master

SDL3 2.5D game and engine using assets, with map editor

sdl3 c++ game engine map-editor cmake · first commit 2025-10-31 · last commit 2026-09-07 (1 month ago) · synced 3 days ago · upstream: git.ide3.de/hsnr/sdl-spieleentwicklung/map_creator

C++ 99.3%
git clone https://git.christianimmanuel.de/sdl-graphics/mapcreator.gitwget https://git.christianimmanuel.de/sdl-graphics/mapcreator/archive/mapcreator.tar.gz

Fix make record breakable

Christian Immanuel · 2026-02-18 15:14 · 64311ccf5292cd38cc5b105b055a816e45606ea9

 scripts/audio/record.sh | 50 ++++++++++++++++++++++++++++++-------------------
 1 file changed, 31 insertions(+), 19 deletions(-)

diff --git a/scripts/audio/record.sh b/scripts/audio/record.sh
index 5f19a61..5be1348 100755
--- a/scripts/audio/record.sh
+++ b/scripts/audio/record.sh
@@ -13,6 +13,31 @@ show_help() {
     echo "Outputs WAV to <output_name>.wav and plays it back."
 }
 
+stop_recording() {
+    echo
+    echo "Stopping recording..."
+    # 2. Process the recorded audio with sox
+    sox "$tmp0" "$tmp1" highpass 120 remix 1,2 gain -n
+
+    # 2. Remove mic crack (first 50ms)
+    ffmpeg -hide_banner -loglevel error -i "$tmp1" -ss 0.05 -c copy "$tmp2"
+
+    # 3. Loudness normalize (LUFS) and back to 44100 Hz
+    ffmpeg -hide_banner -loglevel error -i "$tmp2" \
+    -af "loudnorm=I=-18:TP=-1.5:LRA=7, aresample=44100, pan=mono|c0=0.5*c0+0.5*c1" \
+    "${name}.wav"
+
+    # Cleanup temporary files
+    rm -f "$tmp0" "$tmp1" "$tmp2"
+
+    # 4. Playback
+    echo "Done. Playing back..."
+    aplay "${name}.wav"
+
+    echo "Recording saved as ${name}.wav"
+}
+trap stop_recording SIGINT
+
 if [[ $# -eq 0 || "$1" == "--help" || "$1" == "-h" ]]; then
     show_help
     exit 0
@@ -28,29 +53,16 @@ name="$1"
 duration="$2"
 
 # Temporary files
-tmp1="${name}_raw.wav"
+tmp0="${name}_raw.wav"
+tmp1="${name}_ra1w.wav"
 tmp2="${name}_trim.wav"
 
 echo "Recording $duration seconds into $name.wav..."
 
 # 1. Record → high-pass → mono → peak normalize
-arecord --duration="$duration" --format=cd | \
-sox -t wav -r 44100 -e signed-integer -b 16 -c 2 - \
-    "$tmp1" highpass 120 remix 1,2 gain -n
-
-# 2. Remove mic crack (first 50ms)
-ffmpeg -hide_banner -loglevel error -i "$tmp1" -ss 0.05 -c copy "$tmp2"
-
-# 3. Loudness normalize (LUFS) and back to 44100 Hz
-ffmpeg -hide_banner -loglevel error -i "$tmp2" \
--af "loudnorm=I=-18:TP=-1.5:LRA=7, aresample=44100, pan=mono|c0=0.5*c0+0.5*c1" \
-"${name}.wav"
-
-# Cleanup temporary files
-rm -f "$tmp1" "$tmp2"
+arecord --duration="$duration" --format=cd "$tmp0"
 
-# 4. Playback
-echo "Done. Playing back..."
-aplay "${name}.wav"
+# Remove trap
+trap - SIGINT
 
-echo "Recording saved as ${name}.wav"
+stop_recording