Skip to content

Instantly share code, notes, and snippets.

@furenku
Created October 5, 2018 23:12
Show Gist options
  • Select an option

  • Save furenku/bf0d47f7cac0cc46773f71823e6e54c3 to your computer and use it in GitHub Desktop.

Select an option

Save furenku/bf0d47f7cac0cc46773f71823e6e54c3 to your computer and use it in GitHub Desktop.
algunas Estructuras de Datos en SuperCollider
// Arreglos
a = [1,2,3]
a[0] = "algo"
// no puede crecer màs allá de los 3 elementos iniciales
a[4] = "algo"
// Listas: Mejor que arreglos, pues
//presentna memoria dinámica: siempre pueden crecer
a = List.new;
a.add(Synth(\bass_test));
a.add(Synth(\bass_test));
a.add(Synth(\bass_test));
a.add(Synth(\bass_test));
a.add(Synth(\bass_test));
a.add(Synth(\bass_test));
a.add(Synth(\bass_test));
a.add(Synth(\bass_test));
a[0].set(\freq,1*100);
a[1].set(\freq,2*120);
a[2].set(\freq,3*130);
a[3].set(\freq,4*140);
a[4].set(\freq,5*150);
a[5].set(\freq,6*1000);
a[6].set(\freq,7*1000);
a[7].set(\freq,8*1800);
a.collect({| elSinte, indice |
elSinte.set(\freq,111 * (indice/3) );
});
// Diccionarios
d = Dictionary.new
d[\unaClave] = 'un valor'
d[\otraClave] = 'otro valor'
d[\sinte_uno] = Synth(\bass_test);
d[\sinte_dos] = Synth(\bass_test);
d[\sinte_uno].set(\freq,222)
d[\sinte_dos].set(\freq,422)
// Eventos
e = ();
e.sinte_uno = Synth(\bass_test);
e.sinte_dos = Synth(\bass_test);
e.sinte_uno.set(\freq,111)
e.sinte_dos.set(\freq,221)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment