← All projects

Genuary 2023 Day 10 - Generative Music

by carson

Minted
28 / 32
Published
2023-01-11

Playback not started.

-- genuary #10 2023
-- generative music
-- by carson kompon

-- fxhash snippet
w=stat(6)s=1
for i=1,#w do
ch=ord(sub(w,i,i))s+=s*31+ch
end
srand(s)

-- init variables & palette
balls={}
size=8+rnd(20)
bounds={size,size,128-size,128-size}
pal({[0]=0,2,3,129,132,136,139,1,4,8,11,140,137,7},1)

-- create note
function make_note(inst,vol,pitch,effect)
b1=pitch+64*(inst%4)
b2=16effect+2vol+flr(inst/4)
return b1,b2
end

-- perc notes
function get_perc(p)
p=p%3
if p==0 then
-- kick
return make_note(0,7,0,3)
elseif p==1 then
-- snare
return make_note(6,7,0,3)
else
--hat
return make_note(6,7,0,5)
end
end

-- create all sfx procedurally
inst=rnd(6)\1
vol=6
effect=rnd({0,0,0,5,5,5,4,4,3})
rootnote=(rnd(12)\1)*(1+rnd(2)\1)
scale={0,2,4,5,7,9,11}
drumdens=2+rnd(8)
drum=0
for i=0,11 do
sfxa=0x3200+(8+i)*68
pitch=rootnote+rnd(scale)
b1,b2=make_note(inst,vol,pitch,effect)
if i%drumdens==0 then
b1,b2=get_perc(drum)
drum+=1
end
poke(sfxa,b1)
poke(sfxa+1,b2)
end

-- ball object
function spawn_ball(x,y,note)
add(balls,{
x=x,y=y,note=note,r=3,
col=9+rnd(4)\1,
hs=rnd(2)-1,
vs=rnd(2)-1,
update=function(self)
xto=self.x+self.hs
yto=self.y+self.vs
if xto<=bounds[1]+self.r then
self.hs=abs(self.hs)
xto+=self.hs
self:play()
elseif xto>=bounds[3]-self.r then
self.hs=-abs(self.hs)
xto+=self.hs
self:play()
end
if yto<=bounds[2]+self.r then
self.vs=abs(self.vs)
yto+=self.vs
self:play()
elseif yto>=bounds[4]-self.r then
self.vs=-abs(self.vs)
yto+=self.vs
self:play()
end
self.x=xto
self.y=yto
circfill(self.x,self.y,self.r,self.col)
end,
play=function(self)
sfx(8+self.note)
end
})
end

-- spawn balls
for i=1,8 do
spawn_ball(
63+rnd(32)-16,
63+rnd(32)-16,
i-1
)
end

cls()

::_::

-- burn the screen >:)
for i=1,200 do
	x=rnd(128)
	y=rnd(128)
	c=pget(x,y)
	if(c~=13)c=max(c-4)
	circfill(x,y,1,c)
end

-- update balls
for ball in all(balls) do
	ball:update()
end

-- draw box
color(13)
line(bounds[1],bounds[2],bounds[3],bounds[2])
line(bounds[3],bounds[2],bounds[3],bounds[4])
line(bounds[1],bounds[4],bounds[3],bounds[4])
line(bounds[1],bounds[2],bounds[1],bounds[4])

flip()

goto _

Project information
fxhash project ID
23517
Runtime
fxhash snippet · params: no
Network
Tezos
Token contract
KT1U6EHmNxJTkvaWJ4ThczG4FSDaHC21ssvi
Issuer (mint) contract
KT1BJC12dG17CVvPKJ1VYaNnaT5mzfnUTwXv
Artist addresses
tz1XqJ9e6NdouxdGvm2V3aknwFnGL6Kinu6A
Generator URI
ipfs://QmZtbj32kZxDfaGmvkPDu8hkWNAKKqLLmYiFtpbzcM4n7z
Tags
opensourcepico8pico-8CC0creativecodinggenuarygenuary10generativepixelartmusicaudio
View project on objkt ↗

NFTs 28

Ownership snapshot 2026-11-24

Release

Current mint status and pricing are unavailable. Reload to retry.

Primary minting creates a new NFT. This site replays existing NFTs.

Mint history

Supply
32
Indexed NFTs
28
Mint scheduled
2023-01-11T00:35:44.000Z
Primary mints recorded
28
Prices paid at mint
1 tez · 28 priced mints

Market history

Secondary trades
0
Recorded volume
0 tez / wXTZ
Last completed sales index sync
fx(params) mint tickets
Block 15946495
fxhash issuer v1 (first)
Block 15946495
fxhash issuer v1
Block 15946495
fxhash issuer v2
Block 15946495
fxhash issuer fx(params)
Block 15946495
fxhash marketplace v2
Block 15946495
fxhash marketplace v1
Block 15946495
objkt.com marketplace v1
Block 15946495
objkt.com English auctions v2
Block 15946495
objkt.com marketplace v2
Block 15946495
objkt.com English auctions v1
Block 15946495
objkt.com marketplace v3.2
Block 15946495
objkt.com collection offers
Block 15946495
objkt.com English auctions v3
Block 15946495
objkt.com marketplace v3.1
Block 15946495
objkt.com Dutch auctions v1
Block 15946495