Melodías brownianas

.

Hoy hice un ejercicio de melodías brownianas para piano y violín. La idea básica del movimiento browniano es la de movimiento aleatorio pero que sigue una línea contínua, sin saltos, en este caso, me parece que suena interesante.

Aquí les comparto el código de SuperCollider también. Saludos! =)

Melodías brownianas


/*
Melodias Bronianas
Copyright (C) 2015 Cristian Bañuelos

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU General Public License for more details.
*/

MIDIClient.init;
~mid = MIDIOut(2);

(
// Violin
~notasV = Pbrown(60,72,1,inf).asStream.nextN(1000);
~dursV = [0.5].stutter(3000);
~ampV =Pbrown(0.6, 1.0, 0.1, inf).asStream.nextN(10000);

// Piano
~notasP = Pbrown(60-(2*12),60+(2*12),1,inf).asStream.nextN(1000);
~dursP = ([0.25]/2).stutter(3000);
~ampP = Pbrown(0.3, 1.0, 0.1, inf).asStream.nextN(10000);

//Esto que sea la entrada de una funcion
~notasTotales=[~notasP,~notasV];
~dursTotales=[~dursP,~dursV];
~ampsTotales=[~ampP,~ampV];

// Play Score


//=================================================

~partituraEventos= Array.new(20000);
~vocesEventos = Array.fill(~notasTotales.size,{Array.new(20000)});
~vocesNotas = ~notasTotales;
~vocesDurs = ~dursTotales;
~vocesAmps = ~ampsTotales;
~tiempo = 0;

//=============================================================
//=============================================================
// Exportar eventos
~notasTotales.size.do({arg voz;
 "Voz ".postln;
 voz.postln;
 ~vocesNotas[voz].collect({|nota, item|
 var dur;
 dur = ~vocesDurs[voz][item];
 ~vocesEventos[voz] =~vocesEventos[voz].add((
 \type: \midi,
 \midicmd: \noteOn,
 \midiout: ~mid, // MIDI target
 \chan: voz,
 'midinote': nota,
 'time': ~tiempo,
 'dur': dur,
 \amp: ~vocesAmps[voz][item],
 'voice':(voz+1)
 )).flatten;
 ~tiempo=~tiempo+dur;
 });
 ~tiempo = 0;
 ~partituraEventos.add(~vocesEventos[voz]);
});

~partituraEventos=~partituraEventos.flatten;

~rutinas = Array.new(2);
~notasTotales.size.do({arg i;
 ~rutinas.add(
 Routine({
 ~vocesEventos[i][0].time.wait;
 ~vocesEventos[i].collect({|val|
 // val.postln;
 val.play;
 (val.dur).wait;
// 0.5.wait;

});
 };);
 );
});

~notasTotales.size.do({arg i;
 ~rutinas[i].play;
});

)


(
f = Fomus();
f.put(~partituraEventos);
f.xml;
)


Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s