Преглед на файлове

implement scales and basic harmonies into library

master
Dom SP преди 2 години
родител
ревизия
08c4dc5693
променени са 2 файла, в които са добавени 46 реда и са изтрити 11 реда
  1. +21
    -10
      AVR_code/harmonisk_improvisasjon/harmonisk_improvisasjon.ino
  2. +25
    -1
      AVR_code/harmonisk_improvisasjon/jokermusikk.h

+ 21
- 10
AVR_code/harmonisk_improvisasjon/harmonisk_improvisasjon.ino Целия файл

@@ -1,9 +1,14 @@
#include "jokermusikk.h"

int hastighet;
uint8_t *skala;


int *c;
int *f;
int *g;


int cm[] = {0,3,7};
int fm[] = {0,5,8};
int g[] = {11,7,2,5,8};
int member = 3;
int note_length = 50;
int n = 0;
@@ -14,6 +19,13 @@ unsigned long prev = 0;

void setup() {
// put your setup code here, to run once:

skala = SKALA[1];
c = treklang[0];
f = treklang[3];
g = treklang[4];
}

void loop() {
@@ -24,22 +36,21 @@ void loop() {
seconds = millis();
seconds = seconds/1000;
if (prev != seconds)
akkord = random(0,3);
prev = seconds;

member = random(3);
switch (akkord) {
case 0: // cm
member = random(3);
n = cm[member];
n = skala[c[member]];
break;
case 1: // fm
member = random(3);
n = fm[member];
case 1: // f
n = skala[f[member]];
break;
case 2: // g
member = random(5);
n = g[member];
n = skala[g[member]];
break;
}


+ 25
- 1
AVR_code/harmonisk_improvisasjon/jokermusikk.h Целия файл

@@ -3,11 +3,35 @@
#include <Arduino.h>

const int Output = 1; // Can be 1 or 4


// Cater for 16MHz, 8MHz, or 1MHz clock:
const int Clock = ((F_CPU/1000000UL) == 16) ? 4 : ((F_CPU/1000000UL) == 8) ? 3 : 0;

const uint8_t scale[] PROGMEM = {239,226,213,201,190,179,169,160,151,142,134,127};

const uint8_t SKALA[][7] = {
{0,2,4,5,7,9,11},
{0,2,3,5,7,9,10},
{0,1,3,5,7,8,10},
{0,2,4,6,7,9,11},
{0,2,4,5,7,9,10},
{0,2,3,5,7,8,10},
{0,1,3,5,6,8,10}};

const int treklang[][3] = {
{0,2,4},
{1,3,5},
{2,4,6},
{0,3,5},
{1,4,6},
{0,2,5},
{1,3,6}};




void note (int n, int octave);



#endif

Loading…
Отказ
Запис