pouët.net

Go to bottom

Experimental music from very short C programs

category: code [glöplog]
Hmm hmm.
I like what you made, mister Suborg. (And also great to see another Dutch Bytebeater here :D)

But if you want a short code to play a much wider range than 2 octaves of semitones, simply use

Code:t*Math.pow(2, "[notes here]".charCodeAt((t>>[speed])%[notes length])/12-[octave offset])

where [notes here] is your pattern, which can consist of any of the ASCII symbols, [notes length] is the length of your pattern and [octave offset] is how low you want your range to start. (Depending on the sampling rate, you want to increase this.)

My older Für Elise pattern using this concept.

This is about 3 bytes longer for the same pattern than the overtone concept you described. But it enables a much bigger range, and also all tones are good-sounding ratios.
(Not going into a discussion about just intonation vs equal temperament and other tunings here :P)

I am almost finished writing my guide explaining how I made this Super Hexagon Cover. (Pouet topic here)
So, keep tuned to learn some more tricks about crazy pattern and synth generation. =D
added on the 2013-10-25 23:12:11 by Qqwy Qqwy
Thanx for this method, never thought of a straightforward pow usage :)

P.S. Not Dutch, Ukrainian. :)
added on the 2013-10-28 09:15:37 by Suborg Suborg
Qqwy: Dunno the original, but that cover is really, REALLY, good!

Suborg: Straight pow usage was the initial approach Dead Horse JS took in JavaScript is Jarig, but they managed to gain enough bytes to fit a nice title text in their 256b intro by "hard coding" the pow in the choice of ASCII codes for the notes.
added on the 2013-10-28 09:57:28 by p01 p01
Sorry Suborg, I wrongly assumed that you made that 'Rob is Jarig' demo for a moment back then. ;-).

Ukraine is a country I'd like to travel to, if I can, sometime.

And you're very welcome :) .

Also, I keep on talking about the guide being nearly finished. Unfortunately the chores I have to do every day get in the way. I still hope that I'll get it finished this week.
added on the 2013-10-28 20:27:13 by Qqwy Qqwy
Qqwy: awesome!
Hi, that's cool.
added on the 2013-10-29 06:32:13 by Suborg Suborg
mu6k :D
I heard that Nick Montfort had delivered a talk about this stuff last year, but the video recording kind of slipped off the radar. Lots of general discussion about demoscene as well. http://www.youtube.com/watch?v=lnEJ-wYLTHQ
I love how there's 90 minutes of talk about generative art etc and then they show Obsoleet :D
added on the 2013-10-30 17:51:33 by Gargaj Gargaj
He also delivered a talk about one-liners at @party 2013 and we'll have that online soon as well. Have you seen his C64 demo that resulted in a book?

And heh, Obsoleet is one of my favorites . . . ( ;
I'm trying to port mu6k's cool tracker to the arduino. There's something I'm definitely not understanding about the code:

instr[channel](t*Math.pow(2,track[row][channel][0]/12.0-5+pitch))*(track[row][channel][1]/99);

This part:

track[row][channel][0]/12.0-5+pitch

Unless I'm wrong, typical values for track[row][channel][0] are things like 17, 12 or 15. Divide those by 12 and subtract 5 and most of those values go negative. Perhaps I'm confused about where the variable 'pitch' gets set? I know it's set to 0 at the top of the code, but I don't see it updated anywhere.

Any help would be much appreciated!

Cheers,
- Bret
added on the 2013-11-02 05:45:49 by clone45 clone45
@mu6k: You are a crazy dude. I absolutely LOVE it :D!


@clone45: You are thinking about it in the wrong way. the 'pitch' variable is just an octave offset for the whole song.
Indeed, the values inside the Math.pow(2, ...) often end up negative, but that's because 0 is just a reference point. t*Math.pow(2, 0) is the same as t. Depending on your sampling rate, this is a certain pitch height. If you want to make tones lower than this, you'll have to use negative values for the pow(). It all still works fine.

Though I am not entirely sure how easy and fast signed floating point arithmetic is on the Arduino...
added on the 2013-11-12 21:58:04 by Qqwy Qqwy
Thanks for the insights, Qqwy! I didn't realize that mu6k's tracker was using "floatbeat" instead of "bytebeat" until recently. It all makes a lot more sense now.

I'm working on a eurorack synth module that uses bytebeat equations. One aspect of the module simulates a very simple drum sound player where the sounds are generated via bytebeat equations. For example, here are a few sounds:

case 0: // Gritty kick
w = (t>>(45|t)^(6153/t*88));
if(t > 20000) stop_playback();
break;

case 1: // Tech kick
w = (((1250&t-17)>>6%t)*40) * (t<2000); // t < 2000 is the duration
if(t > 2000) stop_playback();
break;

case 2: // Noise Hit 1
w = ((50&t-177)>>356%t)*20;
if(t > 2000) stop_playback();
break;

case 3: // White noise snare drum
w = (w+t+(w>>2))&874356;
if(t > 2000) stop_playback();
break;

case 4: // rolling hats
w = (t<<t/2);
if(!triggered) stop_playback();
break;

case 5: // zap kick
w = ((1200/t)*150);
if(t > 2000) stop_playback();
break;

case 6: // hihat
w = (3000-(3000%t))*(23/t)*(w+t);
if(t > 2000) stop_playback();
break;

These are meant to be played back at 44100. These are arguably pretty terrible. Has anyone created any better drum sounds that I might use?

Thanks,
Bret
added on the 2013-11-13 05:10:25 by clone45 clone45
clone45: Check some of the equations at SoundToy
added on the 2013-11-13 10:13:20 by p01 p01
@clone45: Here are a few tips:

Acid Base drum:
length=0x4000,
(t<length? sqrt(t%length)<<6 :0)

I did not come up with this idea. It seems to be used in some vintage drum synths as well, at least they have presets that sound very similar.

Hihat:
For the hihat I would use a noise sample with an envelope on top. This is what is used in many simple synthesizers as well.

To generate (deterministic) noise in floatbeat, I used cos(t*cos(t)), which is some kind of quick and dirty approximation of a mersenne twister, iirc. (It is used often to get pseudo-random values in graphical tests like GLSL shaders) But that is of course a Floatbeat algorithm. For Bytebeat there might exist a better, faster way.
Of course using a simple random() also works, but isn't deterministic. Not that it matters that much by the way....

This is how I would create a simple hihat:

d=0x1200,
(t<d?( (random())*25)*(1-(t%d/d)) :0)

This is of course not perfect, but it might help a little. Don't stop thinking! :)

~Qqwy
added on the 2013-11-14 00:45:01 by Qqwy Qqwy
BUMP
ok guys, I'm quite drunk right now but post some queries and I shall awnser it! I will proly awnser them with some logical statements ... oh yeah!!!!!!
added on the 2013-11-16 01:12:39 by musk musk
by the way, I'm developing an interpreted programming language mainly focused on rapid application development and ofcourse producing some amazing demos!!!!!!!!!!!!!!!
added on the 2013-11-16 01:14:08 by musk musk
and right now I'm quite embarrased by my last two posts but well I'm going to make it up to you with some really amazing demos, just stay tuned, it will run well on your 6 year hardware and still make you cry
added on the 2013-11-16 01:15:44 by musk musk
@p01: Thanks so much for the link to SoundToy. That's a great resource!
added on the 2013-11-16 04:30:25 by clone45 clone45
mus6K: use node trees.
added on the 2013-11-16 08:51:51 by Bartoshe Bartoshe
it's faster than lua or java.
added on the 2013-11-16 08:52:12 by Bartoshe Bartoshe

login

Go to top