Skip to content

teadrinker/party-acceleration

Repository files navigation

Party Acceleration

Party Acceleration is a 256 byte intro released at Deadline 2024

You can watch it online here

How it works

The main idea is just to reuse the sound function as data for the visuals, and doing so should also give some nice sync. A waveform display basically. The sound is a kick alternating with a 8th bass note, with a fake filter. The time is warped (like this), initially the speed is increasing, then linear for a while, resembling normal music, and then finally the speed increases exponentially. The loss of float32 precision as the numbers get high creates some nice visual patterns at the end. However relying on this is a bit brittle, on my machine the sound stops when the visuals end, however on other systems the sound continue it seems...

I made 13 versions of this, the hardest part was trying to make the sound not too agressive as it's passing the ears sensitive range when pitching up. The noisy ending is still very harsh though...

Interactive Programming

As usual when I prototype sound and visuals for size coding, I used Mad Tea Lab to iterate faster.

Play with a monochrome version of the intro in Mad Tea Lab

Click here to start playing/generating the music:

mad tea lab screenshot

In the end I move back and forth between MicroW8 and Mad Tea Lab, this is not ideal workflow, there is also the issue with float precision which makes this hard to test in js...

CurlyWas Source

include "include/microw8-api.cwa"

export fn upd() {

	cls(0x10);
	let inline t = time();
	let inline it = (t*88200_f) as i32; // time in samples

	let i = 12800;
	loop screen {

		let inline s = t + ((((i*512) & (3711*2 - ((3711_f * cos(max(6_f,t/2_f))) as i32)))) as f32)/64_f;  

		let inline x = snd((i>>1) + it + 1408                      )*s;
		let inline y = snd((i>>1) + it - 6336 - ((t*256_f) as i32) )*s;

		let inline rx = (x - y + 160_f) as i32;
		let inline ry = (y + x + 120_f) as i32;

		setPixel(rx, ry, (getPixel(rx, ry) + 3)|8);

		branch_if (i := i - 1) : screen
	}
	
}

export fn snd(sampleIndex: i32) -> f32 {

	let inline xx = sampleIndex as f32 / 88200_f;
	let warpedTime = select(xx > 16_f, xx - 8_f + pow(2_f, xx-34_f), 8_f * (xx/16_f)*(xx/16_f));  // xx * xx / 32_f 
	let x = warpedTime;
	x = fmod(x, 0.5); // loop half a second
	x = select(x<0.25, pow(x, 0.08349609375), x); // kick or bass? if kick, warp time
	x = x * 128_f;
	x = fmod(x, 2_f) - 1_f;
	let inline f = (1_f - cos(warpedTime/8_f)) * fmod(warpedTime, 1_f);  // f=0 filtered, f=1 unfiltered  
	let inline div=(f*x*x - 1_f);
	max(-1_f, min(1_f,   (x*x*x-x)/(select(i32.reinterpret_f32(div), div, 1_f))*(2_f-f)  )) // apply fake filter and distortion
	
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published