FINAL commit before submission. More audio tweaks.

This commit is contained in:
yaw-man 2023-01-16 00:38:47 -04:00
parent 25a3047a10
commit c8136b01f4
8 changed files with 66 additions and 18 deletions

View File

@ -13,29 +13,49 @@ local function StartDrones()
volume = 1.0,
decaytime = 20}
)
)
drones.wail = love.audio.newSource("sounds/drone3.flac", "stream")
drones.fuck = love.audio.newSource("sounds/noiseloop.flac", "static" )
drones.subs = love.audio.newSource("sounds/27Hz.flac", "static" )
drones.bass = love.audio.newSource("sounds/drone.flac", "stream")
drones.alto = love.audio.newSource("sounds/drone.flac", "stream")
drones.subs:setLooping( true )
drones.subs:setVolume( 0 )
drones.subs:setPitch( 2.0 )
--drones.subs:setEffect( "droneReverb", true )
drones.subs:stop()
drones.bass:setLooping( true )
drones.bass:setVolume( 0 )
drones.bass:setPitch( 0.25 )
drones.bass:setEffect( "droneReverb", true )
drones.bass:stop()
drones.alto:setLooping( true )
drones.alto:setVolume( 0 )
drones.alto:setPitch( 2 )
drones.alto:setEffect( "droneReverb", true )
drones.alto:stop()
drones.fuck:setLooping( true )
drones.fuck:setVolume( 0 )
drones.fuck:setPitch( 0.125 )
drones.fuck:setPitch( 1.0 )
drones.fuck:setEffect( "droneReverb", true )
drones.fuck:stop()
drones.wail:setLooping( true )
drones.wail:setVolume( 0 )
drones.wail:setPitch( 1.0 )
drones.wail:setEffect( "droneReverb", true )
drones.wail:stop()
love.audio.play( drones.bass )
love.audio.play( drones.alto )
love.audio.play( drones.fuck )
love.audio.play( drones.subs )
love.audio.play( drones.wail )
end
love.audio.setEffect( "passChimeReverb", {
@ -115,7 +135,7 @@ local function OnImpact( impact, score, pass, level )
-- Chimes
local chime = pass and GetNextPassChime() or GetNextFailChime()
chime:setPitch( GetPitch( th ) )
chime:setPosition( r * math.cos( th ), r * math.sin( th ) )
chime:setPosition( 2.0 * r * math.cos( th ), 2.0 * r * math.sin( th ) )
chime:setVolume( 0.1 + 0.9 * level / 120.0 )
local highgain = math.max( 0, math.min( score, 1.0 ) - (pass and 0.5 or 0.9))
chime:setFilter{
@ -129,7 +149,7 @@ local function OnImpact( impact, score, pass, level )
local wineChime = GetNextWineChime()
wineChime:setPitch( GetPitch( th ) )
wineChime:setPosition( love.math.random(), love.math.random() )
wineChime:setVolume( impact.speed * math.max( 0.0, level / 60.0 - 0.5 ) )
wineChime:setVolume( 0.2 * impact.speed * math.max( 0.0, level / 60.0 - 0.5 ) )
love.audio.stop( wineChime )
love.audio.play( wineChime )
@ -156,13 +176,14 @@ end
--score is the hypothetical "beat score" that would be attained
--if an impact took place at this instant.
local function Update( score, level )
if level > 2 then
level = level / 120.0
drones.bass:setVolume( 0.5 * math.sqrt( score ) * level )
drones.alto:setVolume( 0.3 * score * level * level)
drones.bass:setVolume( 0.7 * (0.2 + math.pow( score, 0.25 )) * level )
drones.alto:setVolume( 0.3 * (0.3 + math.pow( score, 0.25 )) * level * level)
drones.fuck:setVolume( 4.0 * math.max( 0, level - 0.75 ))
drones.subs:setVolume( 0.5 * math.max( 0, level - 0.5 ))
drones.wail:setVolume( 2.0 * math.max( 0, level - 0.666 ))
end
end
@ -171,6 +192,11 @@ local function Reset( )
for i = 1, N do
love.audio.stop( passChimes[i] )
love.audio.stop( failChimes[i] )
love.audio.stop( wineChimes[i] )
end
for _, drone in pairs(drones) do
love.audio.stop( drone )
end
StartDrones()
end

View File

@ -1,4 +1,6 @@
function love.conf( t )
t.version = "11.4"
t.modules.joystick = false
t.modules.physics = false
t.modules.touch = false

View File

@ -24,6 +24,8 @@ state = {
state.startTime = love.timer.getTime()
state.currentBeat = 1
state.timeToSimulate = 0.0
state.longestStreak = 0
state.currentStreak = 0
end,
finishTime = 0.0,
@ -32,6 +34,8 @@ state = {
lastBeatScore = 0.0,
currentBeat = 1,
startTime = 0.0,
longestStreak = 0,
currentStreak = 0,
beat = {
t = nil,
@ -61,11 +65,19 @@ OnImpact = function( impact )
if score > 1.0 then
pass = true
state.currentStreak = state.currentStreak + 1
if state.currentStreak > state.longestStreak then
state.longestStreak = state.currentStreak
end
state.currentBeat = state.currentBeat + 1
if state.currentBeat >= 119 then
return OnVictory()
end
else
state.currentStreak = 0
end
@ -92,6 +104,7 @@ local function NewGame()
marble.Reset()
wave.Reset()
text.Reset()
audio.Reset()
end
function love.load()
@ -144,8 +157,9 @@ ExtrapolateBeatScore = function( )
if not beat.mu then return 2.0 end
if beat.mu < 0.001 then return 2.0 end
t = 1.1 * math.sin( 0.5 * math.pi * ( t - beat.t ) / beat.mu )
return t * t * t * t
local pow = 1 / math.max( beat.mu, 0.2 )
t = 1.05 * math.sin( 0.5 * math.pi * ( t - beat.t ) / beat.mu )
return math.pow( t * t, pow )
end
_ExtrapolateBeatScore = ExtrapolateBeatScore
@ -167,8 +181,9 @@ BeatScore = function( t )
return 2.0
end
local pow = 1 / math.max( beat.mu, 0.1 )
local score = 1.1 * math.sin( 0.5 * math.pi * dt / beat.mu )
score = score * score * score * score
score = math.pow( score * score, pow )
--General case: update average beat length.
@ -236,7 +251,7 @@ OnVictory = function()
love.graphics.setColor( 1, 1, 1, 1 )
love.graphics.printf(
"time:\n"..string.format( "%.3f", totalTime ):gsub( "%.", "," ),
string.format( "time:\t%.3f\nstreak:\t%d", totalTime, state.longestStreak ):gsub( "%.", "," ),
0, 0.5 * love.graphics.getHeight() - love.graphics.getFont():getHeight(),
love.graphics.getWidth(),
"center"
@ -300,7 +315,6 @@ _Update = Update
function love.keypressed( key, code, isRepeat )
if key == "escape" then return love.event.quit() end
if key == "return" then return OnVictory() end
if key == "space" then return NewGame() end
return marble.OnKey()
end

View File

@ -31,7 +31,7 @@ function marble.OnImpact( impact, level )
--Adjust current trajectory according to collision.
if not impact.dt then return end
INERTIA = 0.05 - 0.04 * ( level / 120.0 )
INERTIA = 0.03 - 0.02 * math.sqrt( level / 120.0 )
MAXSPEED = 2.0 + 4.0 * ( level / 120.0 )
local x, y = impact.r * math.cos( impact.th ), impact.r * math.sin( impact.th )

BIN
sounds/27Hz.flac Normal file

Binary file not shown.

BIN
sounds/drone3.flac Normal file

Binary file not shown.

View File

@ -60,10 +60,16 @@ local function Draw( beat )
if beat == 1 then
love.graphics.setColor(0.0, 0.0, 0.0, 1.0)
love.graphics.printf( "wasd.space",
love.graphics.printf( "your.own.drum",
0, 0,
love.graphics.getWidth(),
"center"
)
love.graphics.printf( "wasd.space",
0, 0.87 * love.graphics.getHeight(),
love.graphics.getWidth(),
"center"
)
return
end

View File

@ -47,7 +47,7 @@ local shader = love.graphics.newShader([[
p.y = -p.y;
float r = r( atan(p.y, p.x) ) - length( p );
float q = float( r < 0.05) * clamp( 1.0 - score, 0.0, 1.0 ) ;
float q = float( r < 0.05 ) * clamp( 0.5 - score, 0.0, 1.0 ) ;
return vec4( q + (1.0 + clamp( score, 0.0, 1.0 ) * r * r * 0.2) * color.xyz, float(r > 0.0) ) ;
}
@ -150,9 +150,9 @@ end
--Apply bandlimited impulse to wave, adjust free parameters according to game state.
local function OnImpact( impact, level )
IMPULSESIZE = 10.0 * math.sqrt( ( level - 2.0) / 120.0 )
IMPULSESIZE = 10.0 * ( level - 2.0) / 120.0
SOUNDSPEED = 25 - 10 * level / 120
DAMPING = 0.02 * ( 1.0 - 0.4 * level / 120 )
DAMPING = 0.01 * ( 1.0 - 0.4 * level / 120 )
--Apply bandlimited impulse.