Nimbin[12]?SDL & Graphics / mapcreator / commits / 51e520c

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

Add Music scripts

Christian Immanuel · 2026-02-13 07:08 · 51e520c9ac8ae386d5a9254fe060a2fd95c09035

 scripts/audio/audio_normalize.sh                   | 30 ++++++++++++
 scripts/audio/audio_to_44100hz.sh                  | 16 +++++++
 scripts/audio/record.sh                            | 56 ++++++++++++++++++++++
 scripts/{ => sprites}/image_fix_4x_32_to_64.sh     |  0
 scripts/{ => sprites}/image_fix_96x64_to_64x64.sh  |  0
 .../image_fix_remove_16_from_top_add_to_bottom.sh  |  0
 .../image_fix_scale_down_and_add_transparent.sh    |  0
 7 files changed, 102 insertions(+)

diff --git a/scripts/audio/audio_normalize.sh b/scripts/audio/audio_normalize.sh
new file mode 100644
index 0000000..3e369e2
--- /dev/null
+++ b/scripts/audio/audio_normalize.sh
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+set -euo pipefail
+
+SRC_DIR="music"
+DST_DIR="music_cleaned"
+
+mkdir -p "$DST_DIR"
+
+for f in "$SRC_DIR"/*.wav; do
+    [ -e "$f" ] || continue
+    name=$(basename "$f")
+
+    ffmpeg -hide_banner -loglevel error \
+        -i "$f" \
+        -af "
+            highpass=f=120,
+            afftdn=nf=-20,
+            agate=threshold=-40dB:ratio=2:attack=5:release=50,
+            loudnorm=I=-18:TP=-1.5:LRA=7
+        " \
+        -ar 44100 \
+        -ac 1 \
+        -c:a pcm_s16le \
+        "$DST_DIR/$name"
+
+    echo "Processed: $name"
+done
+
+echo "Done."
diff --git a/scripts/audio/audio_to_44100hz.sh b/scripts/audio/audio_to_44100hz.sh
new file mode 100644
index 0000000..aaac696
--- /dev/null
+++ b/scripts/audio/audio_to_44100hz.sh
@@ -0,0 +1,16 @@
+#!/bin/bash
+set -euo pipefail
+
+SRC_DIR="ORIG_music"
+DST_DIR="music"
+
+mkdir -p "$DST_DIR"
+
+for f in "$SRC_DIR"/*.wav; do
+    [ -e "$f" ] || continue
+    name=$(basename "$f")
+    ffmpeg -hide_banner -loglevel error -i "$f" -ar 44100 -ac 1 "$DST_DIR/$name"
+    echo "Resampled: $name"
+done
+
+echo "All files processed into $DST_DIR"
diff --git a/scripts/audio/record.sh b/scripts/audio/record.sh
new file mode 100755
index 0000000..5f19a61
--- /dev/null
+++ b/scripts/audio/record.sh
@@ -0,0 +1,56 @@
+#!/bin/bash
+set -euo pipefail
+
+show_help() {
+    echo "Usage: $0 <output_name> <duration_seconds>"
+    echo
+    echo "Records audio from the default microphone, applies:"
+    echo "  - high-pass filter (remove low-frequency rumble)"
+    echo "  - mono conversion"
+    echo "  - peak normalization"
+    echo "  - trims first 50ms (remove mic crack)"
+    echo "  - loudness normalization (LUFS)"
+    echo "Outputs WAV to <output_name>.wav and plays it back."
+}
+
+if [[ $# -eq 0 || "$1" == "--help" || "$1" == "-h" ]]; then
+    show_help
+    exit 0
+fi
+
+if [[ $# -lt 2 ]]; then
+    echo "Error: Missing arguments."
+    show_help
+    exit 1
+fi
+
+name="$1"
+duration="$2"
+
+# Temporary files
+tmp1="${name}_raw.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"
+
+# 4. Playback
+echo "Done. Playing back..."
+aplay "${name}.wav"
+
+echo "Recording saved as ${name}.wav"
diff --git a/scripts/image_fix_4x_32_to_64.sh b/scripts/sprites/image_fix_4x_32_to_64.sh
similarity index 100%
rename from scripts/image_fix_4x_32_to_64.sh
rename to scripts/sprites/image_fix_4x_32_to_64.sh
diff --git a/scripts/image_fix_96x64_to_64x64.sh b/scripts/sprites/image_fix_96x64_to_64x64.sh
similarity index 100%
rename from scripts/image_fix_96x64_to_64x64.sh
rename to scripts/sprites/image_fix_96x64_to_64x64.sh
diff --git a/scripts/image_fix_remove_16_from_top_add_to_bottom.sh b/scripts/sprites/image_fix_remove_16_from_top_add_to_bottom.sh
similarity index 100%
rename from scripts/image_fix_remove_16_from_top_add_to_bottom.sh
rename to scripts/sprites/image_fix_remove_16_from_top_add_to_bottom.sh
diff --git a/scripts/image_fix_scale_down_and_add_transparent.sh b/scripts/sprites/image_fix_scale_down_and_add_transparent.sh
similarity index 100%
rename from scripts/image_fix_scale_down_and_add_transparent.sh
rename to scripts/sprites/image_fix_scale_down_and_add_transparent.sh