2023-01-15 13:39:58 +00:00
|
|
|
local love = love
|
|
|
|
local passChimes = {}
|
|
|
|
local failChimes = {}
|
2023-01-16 02:38:15 +00:00
|
|
|
local wineChimes = {}
|
2023-01-15 13:39:58 +00:00
|
|
|
local drones = {}
|
2023-01-16 02:38:15 +00:00
|
|
|
local N = 12
|
2023-01-15 13:39:58 +00:00
|
|
|
|
2023-01-15 20:46:32 +00:00
|
|
|
love.audio.setDistanceModel( "exponentclamped" )
|
|
|
|
|
2023-01-15 13:39:58 +00:00
|
|
|
local function StartDrones()
|
|
|
|
love.audio.setEffect( "droneReverb", {
|
|
|
|
type = "reverb",
|
2023-01-15 20:46:32 +00:00
|
|
|
volume = 1.0,
|
|
|
|
decaytime = 20}
|
2023-01-15 13:39:58 +00:00
|
|
|
|
2023-01-16 04:38:47 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
drones.wail = love.audio.newSource("sounds/drone3.flac", "stream")
|
2023-01-16 02:38:15 +00:00
|
|
|
drones.fuck = love.audio.newSource("sounds/noiseloop.flac", "static" )
|
2023-01-16 04:38:47 +00:00
|
|
|
drones.subs = love.audio.newSource("sounds/27Hz.flac", "static" )
|
2023-01-15 13:39:58 +00:00
|
|
|
drones.bass = love.audio.newSource("sounds/drone.flac", "stream")
|
|
|
|
drones.alto = love.audio.newSource("sounds/drone.flac", "stream")
|
2023-01-16 04:38:47 +00:00
|
|
|
|
|
|
|
drones.subs:setLooping( true )
|
|
|
|
drones.subs:setVolume( 0 )
|
|
|
|
drones.subs:setPitch( 2.0 )
|
|
|
|
--drones.subs:setEffect( "droneReverb", true )
|
|
|
|
drones.subs:stop()
|
2023-01-16 02:38:15 +00:00
|
|
|
|
2023-01-16 04:38:47 +00:00
|
|
|
drones.bass:setLooping( true )
|
2023-01-15 13:39:58 +00:00
|
|
|
drones.bass:setVolume( 0 )
|
2023-01-15 20:46:32 +00:00
|
|
|
drones.bass:setPitch( 0.25 )
|
2023-01-15 13:39:58 +00:00
|
|
|
drones.bass:setEffect( "droneReverb", true )
|
2023-01-15 20:46:32 +00:00
|
|
|
drones.bass:stop()
|
2023-01-16 02:38:15 +00:00
|
|
|
|
2023-01-16 04:38:47 +00:00
|
|
|
drones.alto:setLooping( true )
|
2023-01-16 02:38:15 +00:00
|
|
|
drones.alto:setVolume( 0 )
|
|
|
|
drones.alto:setPitch( 2 )
|
|
|
|
drones.alto:setEffect( "droneReverb", true )
|
2023-01-15 20:46:32 +00:00
|
|
|
drones.alto:stop()
|
2023-01-16 02:38:15 +00:00
|
|
|
|
2023-01-16 04:38:47 +00:00
|
|
|
drones.fuck:setLooping( true )
|
2023-01-16 02:38:15 +00:00
|
|
|
drones.fuck:setVolume( 0 )
|
2023-01-16 04:38:47 +00:00
|
|
|
drones.fuck:setPitch( 1.0 )
|
2023-01-16 02:38:15 +00:00
|
|
|
drones.fuck:setEffect( "droneReverb", true )
|
|
|
|
drones.fuck:stop()
|
|
|
|
|
2023-01-16 04:38:47 +00:00
|
|
|
drones.wail:setLooping( true )
|
|
|
|
drones.wail:setVolume( 0 )
|
|
|
|
drones.wail:setPitch( 1.0 )
|
|
|
|
drones.wail:setEffect( "droneReverb", true )
|
|
|
|
drones.wail:stop()
|
|
|
|
|
2023-01-15 13:39:58 +00:00
|
|
|
love.audio.play( drones.bass )
|
|
|
|
love.audio.play( drones.alto )
|
2023-01-16 02:38:15 +00:00
|
|
|
love.audio.play( drones.fuck )
|
2023-01-16 04:38:47 +00:00
|
|
|
love.audio.play( drones.subs )
|
|
|
|
love.audio.play( drones.wail )
|
2023-01-15 13:39:58 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
love.audio.setEffect( "passChimeReverb", {
|
|
|
|
type = "reverb",
|
2023-01-16 02:38:15 +00:00
|
|
|
volume = 1.0,
|
|
|
|
gain = 1.0,} )
|
2023-01-15 13:39:58 +00:00
|
|
|
|
2023-01-16 02:38:15 +00:00
|
|
|
local wineChime = love.audio.newSource("sounds/chimewinedolce.flac", "static")
|
|
|
|
wineChime:setEffect( "passChimeReverb", true )
|
2023-01-15 13:39:58 +00:00
|
|
|
local passChime = love.audio.newSource("sounds/chimeb.flac", "static")
|
|
|
|
passChime:setEffect( "passChimeReverb", true )
|
|
|
|
local failChime = love.audio.newSource("sounds/chime.flac", "static")
|
|
|
|
failChime:setEffect( "passChimeReverb", true )
|
|
|
|
|
|
|
|
for i = 1, N do
|
2023-01-16 02:38:15 +00:00
|
|
|
wineChimes[i] = wineChime:clone()
|
2023-01-15 13:39:58 +00:00
|
|
|
passChimes[i] = passChime:clone()
|
|
|
|
failChimes[i] = failChime:clone()
|
|
|
|
end
|
|
|
|
|
|
|
|
local idxNextPassChime = 1
|
|
|
|
local idxNextFailChime = 1
|
2023-01-16 02:38:15 +00:00
|
|
|
local idxNextWineChime = 1
|
|
|
|
local function GetNextPassChime( )
|
2023-01-15 13:39:58 +00:00
|
|
|
idxNextPassChime = idxNextPassChime % N + 1
|
|
|
|
return passChimes[ idxNextPassChime ]
|
|
|
|
end
|
|
|
|
|
2023-01-16 02:38:15 +00:00
|
|
|
local function GetNextFailChime( )
|
2023-01-15 13:39:58 +00:00
|
|
|
idxNextFailChime = idxNextFailChime % N + 1
|
|
|
|
return failChimes[ idxNextFailChime ]
|
|
|
|
end
|
|
|
|
|
2023-01-16 02:38:15 +00:00
|
|
|
local function GetNextWineChime( )
|
|
|
|
idxNextWineChime = idxNextWineChime % N + 1
|
|
|
|
return wineChimes[ idxNextWineChime ]
|
|
|
|
end
|
|
|
|
|
2023-01-15 13:39:58 +00:00
|
|
|
local pitches =
|
|
|
|
{
|
2023-01-16 02:38:15 +00:00
|
|
|
1/2,
|
|
|
|
3/4,
|
2023-01-15 13:39:58 +00:00
|
|
|
1,
|
|
|
|
2/3,
|
|
|
|
3/2,
|
|
|
|
9/8,
|
|
|
|
27/16,
|
|
|
|
81/64,
|
|
|
|
243/128,
|
|
|
|
2 --Safety
|
|
|
|
}
|
|
|
|
|
|
|
|
local function GetPitch( th )
|
|
|
|
th = 0.5 + 0.5 * th / math.pi
|
2023-01-16 02:38:15 +00:00
|
|
|
return pitches[ 1 + math.floor( th * 9 )]
|
2023-01-15 13:39:58 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
local function OnImpact( impact, score, pass, level )
|
|
|
|
|
|
|
|
--
|
|
|
|
if not pass then
|
|
|
|
--drones.bass:seek( level )
|
|
|
|
-- drones.alto:seek( level )
|
2023-01-15 20:46:32 +00:00
|
|
|
else
|
|
|
|
|
|
|
|
love.audio.setEffect( "passChimeReverb", {
|
|
|
|
type = "reverb",
|
|
|
|
volume = 1.0,
|
2023-01-16 02:38:15 +00:00
|
|
|
gain = 0.1 + 0.9 * level / 120,
|
|
|
|
highgain = 0.3,} )
|
2023-01-15 20:46:32 +00:00
|
|
|
|
2023-01-15 13:39:58 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
local th = impact.th
|
|
|
|
local r = impact.r
|
|
|
|
|
|
|
|
-- Chimes
|
|
|
|
local chime = pass and GetNextPassChime() or GetNextFailChime()
|
|
|
|
chime:setPitch( GetPitch( th ) )
|
2023-01-16 04:38:47 +00:00
|
|
|
chime:setPosition( 2.0 * r * math.cos( th ), 2.0 * r * math.sin( th ) )
|
2023-01-16 02:38:15 +00:00
|
|
|
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))
|
2023-01-15 13:39:58 +00:00
|
|
|
chime:setFilter{
|
|
|
|
type = "lowpass",
|
|
|
|
volume = 0.5 * impact.speed,
|
|
|
|
highgain = highgain,
|
|
|
|
}
|
|
|
|
love.audio.stop( chime )
|
|
|
|
love.audio.play( chime )
|
2023-01-16 02:38:15 +00:00
|
|
|
|
|
|
|
local wineChime = GetNextWineChime()
|
|
|
|
wineChime:setPitch( GetPitch( th ) )
|
|
|
|
wineChime:setPosition( love.math.random(), love.math.random() )
|
2023-01-16 04:38:47 +00:00
|
|
|
wineChime:setVolume( 0.2 * impact.speed * math.max( 0.0, level / 60.0 - 0.5 ) )
|
2023-01-16 02:38:15 +00:00
|
|
|
|
|
|
|
love.audio.stop( wineChime )
|
|
|
|
love.audio.play( wineChime )
|
2023-01-15 13:39:58 +00:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2023-01-15 20:46:32 +00:00
|
|
|
local function OnVictory( )
|
|
|
|
love.audio.setEffect( "passChimeReverb", {
|
|
|
|
type = "reverb",
|
|
|
|
volume = 1.0,
|
2023-01-16 02:38:15 +00:00
|
|
|
decaytime = 20,
|
|
|
|
lategain = 9.5,
|
|
|
|
gain = 1.0,
|
|
|
|
} )
|
2023-01-16 01:47:14 +00:00
|
|
|
|
|
|
|
love.audio.setEffect( "droneReverb", {
|
|
|
|
type = "reverb",
|
|
|
|
volume = 1.0,
|
2023-01-16 02:38:15 +00:00
|
|
|
decaytime = 20,
|
|
|
|
lategain = 10,
|
|
|
|
gain = 1.0,} )
|
2023-01-15 20:46:32 +00:00
|
|
|
end
|
|
|
|
|
2023-01-15 13:39:58 +00:00
|
|
|
--score is the hypothetical "beat score" that would be attained
|
|
|
|
--if an impact took place at this instant.
|
2023-01-15 20:46:32 +00:00
|
|
|
local function Update( score, level )
|
|
|
|
|
|
|
|
if level > 2 then
|
2023-01-16 02:38:15 +00:00
|
|
|
level = level / 120.0
|
2023-01-20 22:38:06 +00:00
|
|
|
drones.bass:setVolume( 0.7 * (0.0 + score) * level )
|
|
|
|
drones.alto:setVolume( 0.3 * (0.3 + score) * level * level)
|
|
|
|
drones.fuck:setVolume( 3.0 * (0.2 + score) * math.max( 0, level - 0.75 ))
|
|
|
|
drones.subs:setVolume( 0.5 * (0.2 + score) * math.max( 0, level - 0.50 ))
|
|
|
|
drones.wail:setVolume( 1.5 * (0.5 + score) * math.max( 0, level - 0.66 ))
|
2023-01-15 20:46:32 +00:00
|
|
|
end
|
|
|
|
|
2023-01-15 13:39:58 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
local function Reset( )
|
|
|
|
for i = 1, N do
|
|
|
|
love.audio.stop( passChimes[i] )
|
|
|
|
love.audio.stop( failChimes[i] )
|
2023-01-16 04:38:47 +00:00
|
|
|
love.audio.stop( wineChimes[i] )
|
|
|
|
end
|
|
|
|
|
|
|
|
for _, drone in pairs(drones) do
|
|
|
|
love.audio.stop( drone )
|
2023-01-15 13:39:58 +00:00
|
|
|
end
|
|
|
|
StartDrones()
|
|
|
|
end
|
|
|
|
|
|
|
|
Reset()
|
2023-01-15 20:46:32 +00:00
|
|
|
return { OnImpact = OnImpact, Update = Update, Reset = Reset, OnVictory = OnVictory}
|