Procedural Ambient

category: general [glöplog]

Several years ago, I studied computer music as an applied computer science subject. There I learned the mathematical history and theory of harmonicities, amongst other things, we did audio programming with PureData and Faust under linux, it's been fun, blabla. :)

Recently I've had the idea to create a realtime procedural ambient music generator. The main concept behind the idea is to use the disharmonicity function of Clarence Barlow. It's a function that takes an interval of two notes, and outputs how dissonant they are.

Now with a bit of random timers and more random magic, I pick a note that "sounds good" to the current sounding notes, start its playback, and periodically I remove notes that are getting too dissonant.

You can listen to this experiment here.

I'm curious, are there intros/demos out there that completely build up their music procedurally?
added on the 2009-12-09 20:27:55 by xTr1m xTr1m
i guess debris
yes, ronny is a robot
frank sinistra
added on the 2009-12-09 20:36:47 by havoc havoc
xTr1m, by the way, have a look at:
- https://kb.osu.edu/dspace/bitstream/1811/24080/1/EMR000008a-Cook-Fujisawa.pdf
- https://kb.osu.edu/dspace/bitstream/1811/24475/1/EMR000008d-Cook-etal.pdf

They expand the consonnance formulas to work on triads rather than just diads
added on the 2009-12-09 20:43:28 by _-_-__ _-_-__
Hmm, I do not get any sound output here. Strange. I'd very much like to hear it though.
No output here aswell
added on the 2009-12-09 20:51:15 by Puryx Puryx
I'm using XAudio2, maybe you should update your DirectX. Might also only work on Vista/Win7, can't test it on XP atm, sorry.

_-_-__: will take a look, thanks!
added on the 2009-12-09 20:54:01 by xTr1m xTr1m
works here under xp sp3. I'd like to know more xtr1m, have you got any urls you can point me at. 2.3k? Does this mean the technique is unsuitable for 4k or is it just early days?
added on the 2009-12-09 21:11:36 by auld auld
youtube or it didnt happen!
auld: It's early days, I'm using 3 threads: one to fill the small audio buffer of 64k floats, one for adding notes after waiting 200ms, and one for removing notes after waiting for a random amount of time. I didn't really optimize for size yet.

If you want to read more, I reccoment the text about Harmonicity here.

I suppose I can get this down to ~1.5-1.8k (audio only) after optimization and using one audio buffer of constant size with the waveOut API.
added on the 2009-12-09 21:25:51 by xTr1m xTr1m
Works here but was a bit clicky for the first 4 seconds.

Sounds kind of soothing except for the harshness from higher pitched notes that sounds like aliasing. try using lowpassfiltered minblep saws.
added on the 2009-12-09 21:30:13 by ector ector
sounds a bit rough. Needs more filters, I guess :)
added on the 2009-12-09 21:32:09 by imbusy imbusy
I'm using sines for the bass, triangles for the low mids, lowpass filtered saws for the high mids, and lowpass filtered pulses for the highs. I know, sound quality isn't top notch, and I don't want to debug the aliasing effects right now, this was just a proof of concept.
added on the 2009-12-09 21:35:34 by xTr1m xTr1m

has procedural music

and if i remember correct, some of the tpolm musicians used a "pattern generator" for making drum pathes and import them to ft2
oh and i get no sound on the exe
there was this russian scener guy who coded some ambience-sound-generator in 2002 or so, what's his name. it sounded like horny insects singing mostly.
rowley: no, frank sinistra uses voice recognition stuff developed by microsoft :P
I would like to hear this experiment, because usually, procedurally generated music is rather.. well.
added on the 2009-12-09 22:20:10 by gloom gloom
no sound here either. Win 7 x64
added on the 2009-12-09 22:30:49 by Jcl Jcl
Try this:

I used there fractal notes generator - it sounds crap, but it is only 256bytes. This notes generator work like this.

A,B,C,D - notes

1. I hard coded patterns ex.:
Now take random note, and denotes it using pattenrs. And so on:


It is possible to set up these patterns in smart way, to make quite good melody.
added on the 2009-12-09 22:41:21 by krzyzan krzyzan
For those poor souls who don't get audio from the EXE, I apologize, won't be submitting to youtube anytime soon.

And since I'm too lazy to fetch another software or code a wav-writer, here you are: 2 Minutes of procedural ambient recorded with Windows Sound Recorder.
added on the 2009-12-09 22:47:40 by xTr1m xTr1m
didnt Spore have procedural ambient music made by Brain Eno? At least they made a big fuzz about it back then.
I also did something like that 10 years ago in 256b... Here's the source, you can play around with it in dosbox. One sequence of 16 notes is stored, the rest is predictively procedural, it repeats after 256 notes. It's not like Mozart wrote it, but back then this was enough to win the compo... Naive approaches (like random notes, or modulated by random etc.) can sound terrible... what worked for me is to store a short sequence and use simple 'composer' functions to expand it to a full song.

This disharmonicity function looks interesting and the result sounds nice, though these functions seem to be suitable for the >256b range only :) But I guess as soon as you set up an in-mem wav writer you'll be under 1.5k. Btw. I wonder what these functions say about some early 20th century or contemporary classical music with distorted harmonies... which actually sound interesting.
added on the 2009-12-10 00:23:35 by Ger Ger