55 lines
4.3 KiB
Bash
55 lines
4.3 KiB
Bash
#!/usr/bin/env bash
|
||
# R4 RPG《剑与声》SA3 音效批量生成(29 件,SYN 的 5 件不在此列)。
|
||
# 用法: bash tools/gen_rpg_sfx.sh (内部 flock 串行 GPU;输出 tools/gen_rpg_sfx_wav/)
|
||
set -u
|
||
source /home/xsl/SoundGame/env.d/sfx.sh
|
||
cd /home/xsl/SoundGame/tools/stable-audio-3
|
||
OUT=/home/xsl/SoundGame/tools/gen_rpg_sfx_wav
|
||
mkdir -p "$OUT"
|
||
|
||
declare -A P D
|
||
# ---- 敌方前摇(1.5s 生成,后裁 1.0s 格挡窗口) ----
|
||
P[tel_wolf]="wolf growl then lunge, short, dry, close mic"; D[tel_wolf]=1.5
|
||
P[tel_bandit]="footsteps on dirt then sword unsheathing shing, short, dry"; D[tel_bandit]=1.5
|
||
P[tel_spider]="insect legs skittering, high frequency chitin clicks, eerie, short"; D[tel_spider]=1.5
|
||
P[tel_elite]="heavy armor plates clanking, menacing, short"; D[tel_elite]=1.5
|
||
P[tel_boss1]="two metal blades striking each other twice, dramatic ring, short"; D[tel_boss1]=1.5
|
||
P[tel_croc]="water splash with low reptile growl, short"; D[tel_croc]=1.5
|
||
P[tel_shaman]="low guttural chant humming, ritualistic, dark, short"; D[tel_shaman]=1.5
|
||
P[tel_puppet]="wooden mechanism clicks and winding gears, short"; D[tel_puppet]=1.5
|
||
P[tel_boss2]="low human voice humming a dark ritual melody, ominous, short"; D[tel_boss2]=1.5
|
||
# ---- 战斗 ----
|
||
P[atk_swing]="sword whoosh through air, fast, clean, single swing"; D[atk_swing]=0.8
|
||
P[atk_hit]="sword hitting flesh, dull impact, not gory, single hit"; D[atk_hit]=0.8
|
||
P[parry]="metal parry clang, bright ring, short, single hit"; D[parry]=0.8
|
||
P[skill_slash]="powerful sword slash with air rip, dramatic, single strike"; D[skill_slash]=1.0
|
||
P[enemy_die]="body falling to ground with weapon clatter, short"; D[enemy_die]=1.2
|
||
P[potion]="drinking liquid gulps from glass bottle, short"; D[potion]=1.5
|
||
# ---- 探索/系统 ----
|
||
P[chest]="old wooden chest creaking open, short"; D[chest]=1.5
|
||
P[drink_water]="scooping and drinking stream water, gentle, short"; D[drink_water]=1.5
|
||
P[rest]="settling down by campfire, fabric rustle, calm, short"; D[rest]=2.0
|
||
P[door_heavy]="heavy wooden gate slowly opening, deep creak"; D[door_heavy]=3.0
|
||
# ---- 环境(6s 循环素材) ----
|
||
P[amb_village]="night village ambience, campfire crackle, distant chatter, crickets, loopable"; D[amb_village]=6
|
||
P[amb_path]="forest path ambience, wind through leaves, distant birds, loopable"; D[amb_path]=6
|
||
P[amb_fork]="forest crossroads ambience, gusty wind, crows cawing, loopable"; D[amb_fork]=6
|
||
P[amb_chest]="hollow tree hole ambience, water drips, muffled wind, loopable"; D[amb_chest]=6
|
||
P[amb_stream]="flowing stream over rocks, gentle water babbling, loopable"; D[amb_stream]=6
|
||
P[amb_hunter]="wood cabin ambience, firewood crackle, occasional knife sharpening, loopable"; D[amb_hunter]=6
|
||
P[amb_deepwood]="deep forest ambience at night, urgent insects, distant wolf howl, ominous, loopable"; D[amb_deepwood]=6
|
||
P[amb_gate]="bandit camp outside wooden gate ambience, torches burning, rowdy distant voices, loopable"; D[amb_gate]=6
|
||
P[amb_hall]="large empty hall ambience, fire brazier crackle, echoing space, tense, loopable"; D[amb_hall]=6
|
||
P[amb_swamp]="swamp ambience, bubbling mud, frogs, insects, murky, loopable"; D[amb_swamp]=6
|
||
P[amb_peak]="mountain peak ambience, strong cold wind, thin air, howling gusts, loopable"; D[amb_peak]=6
|
||
|
||
ORDER="tel_wolf tel_bandit tel_spider tel_elite tel_boss1 tel_croc tel_shaman tel_puppet tel_boss2 atk_swing atk_hit parry skill_slash enemy_die potion chest drink_water rest door_heavy amb_village amb_path amb_fork amb_chest amb_stream amb_hunter amb_deepwood amb_gate amb_hall amb_swamp amb_peak"
|
||
|
||
flock /home/xsl/SoundGame/.gpu.lock bash -c '
|
||
'"$(declare -p P D OUT)"'
|
||
for k in '"$ORDER"'; do
|
||
if [ -s "$OUT/$k.wav" ]; then echo "skip $k"; continue; fi
|
||
uv run stable-audio --model small-sfx -p "${P[$k]}" --duration "${D[$k]}" -o "$OUT/$k.wav" 2>&1 | grep -i "saved\|error"
|
||
done'
|
||
echo "SA3 batch done: $(ls "$OUT" | wc -l) files"
|