Skip to content

Commit

Permalink
🚸 πŸ”Š normalize and tune volume of all sound files (#239)
Browse files Browse the repository at this point in the history
* πŸ”¨ add script to list sound files LUFS (loudness measurement)

* πŸ”¨ add `yarn start stats` script to output and track sfx LUFS

* πŸ”¨ update formatting of loudness stats script output

* πŸ”¨ update loudness stats script to include full stats

* 🚸 adjust loudness of all sound files
- wont break people's ears now

* ♻️ refactor list-sounds script

* πŸ”¨ add channels to sound stats

* 🚚 rename `lufs.txt` to `stats.txt`

* ♻️ refactor list-sounds script again

* πŸ”¨ add channel volume diff db to sound stats

* βͺ revert volume changes to music
- sounded very low quality in-game, we'll just use the volume property in sounds.json instead

* 🍱 split some sfx that are fake stereo into the single mono they actually are
- amplify them to keep LUFS close

* βš”οΈ tune dentata-snakes sounds
- fix bounce sound source location bug

* βš”οΈ tune bomb sounds

* βš”οΈ tune finger-guns sounds

* βš”οΈ tune friendliness-pellets sounds

* βš”οΈ tune homing-vines sounds

* βš”οΈ tune x-bullets sounds

* ⚑️ add cleanup check to homing-vines bullets

* 🚸 tune player hurt sound

* πŸ’„ tune static noise sounds

* πŸ› βš”οΈ fix bomb sound stuff
- apparently stereo sounds ARE increased by volume in the playsound command. great.

* πŸ› βš”οΈ fix dentata-snakes sound stuff

* πŸ› fix music/other stereo sounds so they don't play super loud

* 🚸 increase volume of quiet sounds

* πŸ”Š decrease volume of bossfight static

* 🍱 increase volume of dentata-snakes `impact`
  • Loading branch information
TheAfroOfDoom authored Oct 24, 2024
1 parent 2fad8a6 commit 6b2ee9a
Show file tree
Hide file tree
Showing 41 changed files with 487 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ function omegaflowey.entity:directorial/boss_fight/shared/stop/as_active_player/

function omegaflowey.entity:directorial/boss_fight/shared/stop/as_active_player/log_reason

execute if score #omegaflowey.bossfight.stop_reason omegaflowey.global.flag matches 3 run \
playsound omega-flowey:player.escaped player @s ~ ~ ~ 3
execute if score #omegaflowey.bossfight.stop_reason omegaflowey.global.flag matches 3 at @s run \
playsound omega-flowey:player.escaped player @s ~ ~ ~ 1

# Stop reason (5) is the player survived
execute if score #omegaflowey.bossfight.stop_reason omegaflowey.global.flag matches 5 at @s run \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ scoreboard players set @s omegaflowey.boss-fight.attack.clock.total 463

# Play music
function omegaflowey.entity:shared/run_as_active_player_or_spectator { command: \
'playsound omega-flowey:music.phase.0 record @s ~ ~ ~ 10 1' \
'execute at @s run playsound omega-flowey:music.phase.0 record @s ~ ~ ~ 1 1' \
}

## Add tags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ scoreboard players set @s omegaflowey.boss-fight.attack.clock.total 414

# Play music
function omegaflowey.entity:shared/run_as_active_player_or_spectator { command: \
'playsound omega-flowey:music.phase.1 record @s ~ ~ ~ 10 1' \
'execute at @s run playsound omega-flowey:music.phase.1 record @s ~ ~ ~ 1 1' \
}

## Add tags
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function omegaflowey.entity:directorial/boss_fight/summit/origin/at/y { \
# Play animation if we just stopped falling
execute unless entity @s[tag=is_done_falling] run function animated_java:omegaflowey_bomb/animations/omegaflowey_explode/play
execute unless entity @s[tag=is_done_falling] run function omegaflowey.entity:shared/run_as_active_player_or_spectator { command: \
'function omegaflowey.entity:hostile/omega-flowey/attack/bomb/bullet/loop/stop_falling/as_player_once' \
'execute at @s run function omegaflowey.entity:hostile/omega-flowey/attack/bomb/bullet/loop/stop_falling/as_player_once' \
}

# Add tags
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
stopsound @s hostile omega-flowey:attack.bomb.explode
playsound omega-flowey:attack.bomb.explode hostile @s ~ ~ ~ 5 1
playsound omega-flowey:attack.bomb.explode hostile @s ~ ~ ~ 1 1
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ scoreboard players operation @s omegaflowey.math.0 += #omegaflowey.bossfight.sum
execute store result storage omegaflowey:attack.dentata-snakes.bounce y float 0.01 run scoreboard players get @s omegaflowey.math.0
data modify storage omegaflowey:attack.dentata-snakes.bounce dy set value 10

data modify storage omegaflowey:attack.dentata-snakes.bounce command_after_bouncing set value 'execute if entity @s[tag=attack-bullet-head] run function omegaflowey.entity:hostile/omega-flowey/attack/dentata-snakes/bullet/loop/after_bounce_as_bullet_head'
data modify storage omegaflowey:attack.dentata-snakes.bounce command_after_bouncing set value 'execute if entity @s[tag=attack-bullet-head] at @s run function omegaflowey.entity:hostile/omega-flowey/attack/dentata-snakes/bullet/loop/after_bounce_as_bullet_head'

function omegaflowey.entity:directorial/boss_fight/summit/origin/at/position { \
command: "function omegaflowey.entity:utils/bounce with storage omegaflowey:attack.dentata-snakes.bounce" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ execute if score @s omegaflowey.attack.clock.i = @s omegaflowey.attack.indicator
# Play blinking sound before we summon bullets
execute if score @s omegaflowey.attack.clock.i matches ..-1 run \
function omegaflowey.entity:shared/run_as_active_player_or_spectator { command: \
'playsound omega-flowey:attack.friendliness-pellets.blinking hostile @s ~ ~ ~ 3 1 1' \
'playsound omega-flowey:attack.friendliness-pellets.blinking hostile @s ~ ~ ~ 5 1 1' \
}

# Ignore bullet summoning logic while `omegaflowey.attack.clock.i` is negative
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ $tag $(corresponding_bullet_9_uuid) remove stationary

# Play activate sound
function omegaflowey.entity:shared/run_as_active_player_or_spectator { command: \
'playsound omega-flowey:attack.friendliness-pellets.activate hostile @s ~ ~ ~ 3 1 1' \
'playsound omega-flowey:attack.friendliness-pellets.activate hostile @s ~ ~ ~ 5 1 1' \
}

kill @s
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# runs every tick on the bullet AJ model, terminating if it's outside the arena bounds
function omegaflowey.entity:shared/run_if_outside_arena_volume { command: \
"function omegaflowey.entity:hostile/omega-flowey/attack/homing-vines/bullet/terminate" \
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ $execute as $(blinking_lane_uuid) on passengers if entity @s[tag=aj.omegaflowey_

# Play blinking sound once
function omegaflowey.entity:shared/run_as_active_player_or_spectator { command: \
'playsound omega-flowey:attack.homing-vines.blinking hostile @s ~ ~ ~ 3 1 1' \
'playsound omega-flowey:attack.homing-vines.blinking hostile @s ~ ~ ~ 5 1 1' \
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
particle minecraft:explosion ~ ~ ~ 0 0 0 10 1 force

function omegaflowey.entity:shared/run_as_active_player_or_spectator { command: \
'playsound omega-flowey:attack.x-bullets.start hostile @s ~ ~ ~ 3 1 1' \
'playsound omega-flowey:attack.x-bullets.start hostile @s ~ ~ ~ 5 1 1' \
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
particle minecraft:explosion ~ ~ ~ 0 0 0 10 1 force

function omegaflowey.entity:shared/run_as_active_player_or_spectator { command: \
'playsound omega-flowey:attack.x-bullets.start hostile @s ~ ~ ~ 3 1 1' \
'playsound omega-flowey:attack.x-bullets.start hostile @s ~ ~ ~ 5 1 1' \
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
scoreboard players set #omegaflowey.soul.5.saved omegaflowey.soul.flag 1

function omegaflowey.entity:shared/run_as_active_player_or_spectator { command: \
'function omegaflowey.entity:soul/soul_5/executor/initialize/saved/as_player' \
'execute at @s run function omegaflowey.entity:soul/soul_5/executor/initialize/saved/as_player' \
}

# Flash each player's screen
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
stopsound @s record omega-flowey:music.soul.5

# Play saved music + sound effect
playsound omega-flowey:soul.saved record @s ~ ~ ~ 10 1
playsound omega-flowey:soul.transition record @s ~ ~ ~ 10 1
playsound omega-flowey:soul.saved record @s ~ ~ ~ 1 1
playsound omega-flowey:soul.transition record @s ~ ~ ~ 1 1
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
function omegaflowey.entity:shared/run_as_active_player_or_spectator { command: \
'playsound omega-flowey:music.soul.5 record @s ~ ~ ~ 10 1' \
'execute at @s run playsound omega-flowey:music.soul.5 record @s ~ ~ ~ 1 1' \
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
stopsound @s player minecraft:entity.player.hurt
playsound omega-flowey:player.hurt player @s ~ ~ ~ 3
playsound omega-flowey:player.hurt player @s ~ ~ ~ 5
4 changes: 4 additions & 0 deletions package-scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ module.exports = {
},
},
log: `code -r "${minecraftPath}/logs/latest.log"`,
stats: {
default: 'nps stats.sounds',
sounds: `yarn exec pwsh -Command "./package-scripts/list-sound-stats.ps1" -Path "resourcepack/assets/omega-flowey/sounds" -Out "resourcepack/assets/omega-flowey/sounds/stats.txt"`,
},
sync: {
default: 'nps sync.summit',
world: {
Expand Down
41 changes: 41 additions & 0 deletions package-scripts/list-sound-stats.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[CmdletBinding()]
param(
[string]$Path=".",
[Parameter(mandatory=$false)]
[string]$Out
)

# use `-path ./resourcepack/assets/omega-flowey/sounds` for this repo's omegaflowey sound files
# use `-path ./tmp/vanilla-sounds-normalization` for some vanilla sound references

$script:files = get-childitem -path $Path -filter "*.ogg" -recurse -file
if($out -ne '') {
out-file -filePath $out
}

foreach ($script:file in $files) {
$relativePath = $file | resolve-path -relative -relativeBasePath $path

$script:channels = ffprobe -i $file -show_entries stream=channels -select_streams a:0 -of compact=p=0:nk=1 -v 0
$script:channelsFormatted = "channels: ${channels}"

$script:channelsVolumeDiffMax = "N/A"
if($channels -eq 2) {
$channelsVolumeDiffMax = `
(
ffmpeg -i $file -filter_complex "stereotools=phasel=1[tmp];[tmp]pan=1c|c0=0.5*c0+0.5*c1,volumedetect" -f null - 2>&1
| grep max_volume
).split('max_volume: ')[1]
}
$script:channelsVolumeDiffMaxFormatted = "channelsVolumeDiffMax: ${channelsVolumeDiffMax}"

$script:lufs = ffmpeg -i $file -af ebur128=framelog=verbose -f null - 2>&1 | grep -e "Integrated loudness:" -A 8
$script:lufsFormatted = ((($lufs.split('\n').where{$_ -ne ''}) | foreach-object -membername trim) -join [environment]::newline)

$script:statsLine = "# ${relativePath}$([environment]::newline)${channelsVolumeDiffMaxFormatted}$([environment]::newline)${channelsFormatted}$([environment]::newline)${lufsFormatted}$([environment]::newline)"
if ($out -ne '') {
$statsLine | out-file -filepath $out -append
} else {
echo $statsLine
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"enable_advanced_data_pack_settings": false,
"data_pack": "G:/Coding/omegaflowey-minecraft-remastered/datapacks/animated_java",
"summon_commands": "function omegaflowey.entity:hostile/omega-flowey/attack/homing-vines/bullet/preinitialize",
"ticking_commands": "",
"ticking_commands": "function omegaflowey.entity:hostile/omega-flowey/attack/homing-vines/bullet/cleanup",
"interpolation_duration": 1,
"teleportation_duration": 1,
"use_storage_for_animation": false,
Expand Down
Loading

0 comments on commit 6b2ee9a

Please sign in to comment.