Tried integer durations -it's worse!
parent
b5b4c3bdd3
commit
0468c427d8
|
@ -9,9 +9,9 @@ float tuning[16];
|
||||||
// 0 = A, 8 = F (tonic)
|
// 0 = A, 8 = F (tonic)
|
||||||
|
|
||||||
int m1[] = { 3, 8, 8, 10, 8, 7, 5, 5, 5, 10, 10, 12, 10, 8, 7, 3, 7, 12, 12, 13, 12, 10, 8, 5, 3, 3, 5, 10, 7, 8, 3, 8, 8, 8, 7, 7, 8, 7, 5, 3, 10, 12, 10, 10, 8, 8, 15, 3, 3, 3, 5, 10, 7, 8 };
|
int m1[] = { 3, 8, 8, 10, 8, 7, 5, 5, 5, 10, 10, 12, 10, 8, 7, 3, 7, 12, 12, 13, 12, 10, 8, 5, 3, 3, 5, 10, 7, 8, 3, 8, 8, 8, 7, 7, 8, 7, 5, 3, 10, 12, 10, 10, 8, 8, 15, 3, 3, 3, 5, 10, 7, 8 };
|
||||||
float d1[] = { 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 4, 2, 2, 2, 2, 4, 2, 2, 2, 2, 4, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 4 };
|
int d1[] = { 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 4, 2, 2, 2, 2, 4, 2, 2, 2, 2, 4, 2, 2, 1, 1, 1, 1, 2, 2, 1, 1, 2, 2, 2, 4 };
|
||||||
int m2[] = { -1, 8, 1, 2, 3, 4, 5, 0, 1, 3, 8, 8, 3, 5, 7, 8, 7, 0, 1, 3, 8 };
|
int m2[] = { -1, 8, 1, 2, 3, 4, 5, 0, 1, 3, 8, 8, 3, 5, 7, 8, 7, 0, 1, 3, 8 };
|
||||||
float d2[] = { 2, 6, 6, 6, 6, 6, 4, 2, 4, 2, 6, 6, 6, 6, 6, 6, 4, 2, 4, 2, 4 };
|
int d2[] = { 2, 6, 6, 6, 6, 6, 4, 2, 4, 2, 6, 6, 6, 6, 6, 6, 4, 2, 4, 2, 4 };
|
||||||
float gate = 0.5;
|
float gate = 0.5;
|
||||||
int bpm = 240;
|
int bpm = 240;
|
||||||
float beat_s = 60.0 / (float)bpm;
|
float beat_s = 60.0 / (float)bpm;
|
||||||
|
@ -28,7 +28,7 @@ typedef struct {
|
||||||
long last = 0;
|
long last = 0;
|
||||||
long init = 0;
|
long init = 0;
|
||||||
int *melody;
|
int *melody;
|
||||||
float *duration;
|
int *duration;
|
||||||
int len = 0;
|
int len = 0;
|
||||||
MCP4728_channel_t pitch;
|
MCP4728_channel_t pitch;
|
||||||
MCP4728_channel_t gate;
|
MCP4728_channel_t gate;
|
||||||
|
@ -85,7 +85,7 @@ void runSequencer(sequencer& seq, long now) {
|
||||||
if( now - seq.last > seq.rel ) {
|
if( now - seq.last > seq.rel ) {
|
||||||
noteOff(seq);
|
noteOff(seq);
|
||||||
seq.last = now;
|
seq.last = now;
|
||||||
seq.play = round(beat_m * seq.duration[seq.s] * (1.0 - gate));
|
seq.play = 0; // no gate for now
|
||||||
seq.noteOn = false;
|
seq.noteOn = false;
|
||||||
seq.s += 1;
|
seq.s += 1;
|
||||||
if( seq.s > seq.len ) {
|
if( seq.s > seq.len ) {
|
||||||
|
@ -96,8 +96,7 @@ void runSequencer(sequencer& seq, long now) {
|
||||||
if( now - seq.last > seq.play ) {
|
if( now - seq.last > seq.play ) {
|
||||||
noteOn(seq, seq.melody[seq.s]);
|
noteOn(seq, seq.melody[seq.s]);
|
||||||
seq.last = now;
|
seq.last = now;
|
||||||
seq.rel = round(beat_m * seq.duration[seq.s] * gate);
|
seq.rel = beat_m * seq.duration[seq.s];
|
||||||
Serial.println(seq.rel);
|
|
||||||
seq.noteOn = true;
|
seq.noteOn = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue