Log In  


Cart #eightsages-1 | 2025-05-05 | Code ▽ | Embed ▽ | No License

check out the music video here!
https://churchbasement.org/#music/eight-mages/

Used Pico8 as the visuals for a music video. Getting TIME() to be actually accurate was the main problem i ran into. Had to sampling beeps from Pico8 using TIME() to trigger them every second, record that into Reaper, ratio the sampled time with the time it should have been, averaging all the ratios, multiplying TIME() with the ratio we found, witch happened to be 1.0007962696777

-- 0x1.0034 is as close as Pico8
-- can get to the fration
-- 1.0007962696777
local ratio = 0x1.0034
local oldt = 0
local t = 0
function _update()
    t = (time()*ratio)%1
    if t < oldt then
        sfx(0)
    end
    oldt = t
end
function _draw()
    cls()
    circfill(64,64,t*10,7)
end

this was the lua code used to calculate the ratio. we used love2d to run it to get more bit accuracy.

--[[
Samples from Reaper's recording of Pico8
Time		Pico8 beep
8:00.00		8:00.422
8:30.00		8:30.424
7:30.00     7:30.370
7:45.00     7:45.376
8:15.00     8:15.419

3:30.00 	3:30.146
4:00.00 	4:00.190
6:00.00 	6:00.281
8:00.00 	8:00.381
10:00.00 	10:00.472
12:00.00 	12:00.563
14:00.00 	14:00.654
16:00.00 	16:00.754
18:00.00 	18:00.845
20:00.00 	20:00.936
]]

--[[
calculating times in minutes
print(30.146 / 60)
print(.190 / 60)
print(.281 / 60)
print(.381 / 60)
print(.472 / 60)
print(.563 / 60)
print(.654 / 60)
print(.754 / 60)
print(.845 / 60)
print(.936 / 60)
]]

local samples = {
	8.0070333333333333,
	8.50706666666667,
	7.50616666666667,
	7.75626666666667,
	8.25698333333333,

	3.50243333333333,
	4.0031666666666667,
	6.0046833333333333,
	8.00635,
	10.0078666666666667,
	12.0093833333333333,
	14.0109,
	16.012566666666667,
	18.014083333333333,
	20.0156,
}

local targets = {
	8,
	8.50,
	7.50,
	7.75,
	8.25,

	3.5,
	4,
	6,
	8,
	10,
	12,
	14,
	16,
	18,
	20,
}

local average = 0
for i,sample in ipairs(samples) do
	local ratio = sample / targets[i]
	print('sample '..i,ratio)
	average = average + ratio
end
print('average',average/#samples)

--[[
This program prints out...
sample 1	1.0008791666667
sample 2	1.000831372549
sample 3	1.0008222222222
sample 4	1.0008086021505
sample 5	1.0008464646465
sample 6	1.0006952380952
sample 7	1.0007916666667
sample 8	1.0007805555556
sample 9	1.00079375
sample 10	1.0007866666667
sample 11	1.0007819444444
sample 12	1.0007785714286
sample 13	1.0007854166667
sample 14	1.0007824074074
sample 15	1.00078
average	1.0007962696777
]]

mabye i'll edit this post once all the stuffs uploaded :)




[Please log in to post a comment]