Generate raw WAV output by hooking malloc and read
github.com
github.com
void* read( int fd, void * data, size_t count)
{
...
gen_square_wave( 44100 , CLAMP(count, 20, 20000 ), CLAMP( sizeof(data), 100 , 1700), 0.7 );
I don't get it, isn't sizeof(data) always the same, and usually either 4 or 8?We often think about pointers as being 4 bytes but that isn't necessarily the case. How would a 32 bit pointer map to the addressable memory of 64 bit hardware?
https://soundcloud.com/glowdon/the-sounds-of-malloc#t=7:18
It was like demos; I would be stunned at the emergent complexity and compactness, and it would only elicit shrugs from friends.
main(t){
for(t=0;;t++)
putchar(t*(((t>>12)|(t>>8))&(63&(t>>4))));
//putchar(t>>7|t%45)&(t>>8|t%35)&(t>>11|t%20); // try this too!
}
.. there's a whole world of 1-liners for synthesis out there, and some of them, frankly, are astounding. Sound is such a beautiful way to understand math ..See viznut's (seminal) intro to the genre.
http://countercomplex.blogspot.fi/2011/10/algorithmic-sympho...
Great stuff, eh?
Hello malloc() my old friend,
I've come for mem'ry once again,
Because a pointer silently creeping,
Filled buffer that I was keeping,
And the signal that I trapped was a bus error.
Didn't care.
Because I still... have malloc()
There were pages that I missed.
My OS had sent them to disk.
Try my best to not hit swap,
Looking for data I could safely drop,
I compressed some bits that I kept stored in place
Freed some space.
But then I still... used malloc().