kolleksjon av dokumenter og kode som blir brukt på Jokerspace i Valdres for å formiddle elektronisk musikk til et skapende milljø
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

harmonisk_improvisasjon.ino 828B

пре 2 година
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #include "jokermusikk.h"
  2. int cm[] = {0,3,7};
  3. int fm[] = {0,5,8};
  4. int g[] = {11,7,2,5,8};
  5. int member = 3;
  6. int note_length = 50;
  7. int n = 0;
  8. int octave = 1;
  9. int akkord = 0;
  10. unsigned long seconds = 0;
  11. unsigned long prev = 0;
  12. void setup() {
  13. // put your setup code here, to run once:
  14. }
  15. void loop() {
  16. // put your main code here, to run repeatedly:
  17. note_length = random(30,70);
  18. octave = random(3,7);
  19. seconds = millis();
  20. seconds = seconds/1000;
  21. if (prev != seconds)
  22. akkord = random(0,3);
  23. prev = seconds;
  24. switch (akkord) {
  25. case 0: // cm
  26. member = random(3);
  27. n = cm[member];
  28. break;
  29. case 1: // fm
  30. member = random(3);
  31. n = fm[member];
  32. break;
  33. case 2: // g
  34. member = random(5);
  35. n = g[member];
  36. break;
  37. }
  38. note(n,octave);
  39. delay(note_length);
  40. }