bassline for Numerology
parent
0bff8f0db0
commit
43b41bde8f
|
@ -15,10 +15,9 @@ unsigned int phase;
|
||||||
unsigned int length;
|
unsigned int length;
|
||||||
unsigned int repeats;
|
unsigned int repeats;
|
||||||
int note = 0;
|
int note = 0;
|
||||||
//int freqs[] = { 256, 228, 205, 192, 171, 154, 137, 128, 114, 102, 96, 85, 77, 68, 64 };
|
|
||||||
//int freqs[] = { 128, 114, 102, 96, 85, 77, 68, 64, 56, 51, 48, 42, 38, 34, 32 };
|
|
||||||
int freqs[] = { 64, 56, 51, 48, 42, 38, 34, 32, 28, 25, 24, 21, 19, 17, 16 };
|
int freqs[] = { 64, 56, 51, 48, 42, 38, 34, 32, 28, 25, 24, 21, 19, 17, 16 };
|
||||||
int tune[] = { 0, 4, 3, 5, -1, -1, -1, -1 };
|
int tune2[] = { 2, -1, -1, 2, -1, -1, 3, -1, 2, -1, -1, -1, 0, -1, -1, -1 };
|
||||||
|
//int tune2[] = { 2, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, 4, -1, -1, -1 };
|
||||||
|
|
||||||
byte waveform[nsamp];
|
byte waveform[nsamp];
|
||||||
|
|
||||||
|
@ -35,10 +34,10 @@ void setup() {
|
||||||
// set compare match register for 1hz increments
|
// set compare match register for 1hz increments
|
||||||
//OCR1A = 15624;// = (16*10^6) / (1*1024) - 1 (must be <65536)
|
//OCR1A = 15624;// = (16*10^6) / (1*1024) - 1 (must be <65536)
|
||||||
//OCR1A = 7812;// = (16*10^6) / (1*1024) - 1 (must be <65536)
|
//OCR1A = 7812;// = (16*10^6) / (1*1024) - 1 (must be <65536)
|
||||||
OCR1A = 10000;
|
OCR1A = 2000;
|
||||||
// turn on CTC mode
|
// turn on CTC mode
|
||||||
TCCR1B |= (1 << WGM12);
|
TCCR1B |= (1 << WGM12);
|
||||||
// Set CS10 and CS12 bits for 1024 prescaler
|
// Set CS10 and CS12 bits for 1024 escaler
|
||||||
TCCR1B |= (1 << CS12) | (1 << CS10);
|
TCCR1B |= (1 << CS12) | (1 << CS10);
|
||||||
// enable timer compare interrupt
|
// enable timer compare interrupt
|
||||||
TIMSK1 |= (1 << OCIE1A);
|
TIMSK1 |= (1 << OCIE1A);
|
||||||
|
@ -46,7 +45,6 @@ void setup() {
|
||||||
sei();
|
sei();
|
||||||
|
|
||||||
|
|
||||||
Serial.begin(115200);
|
|
||||||
|
|
||||||
if (!mcp.begin(0x64)) {
|
if (!mcp.begin(0x64)) {
|
||||||
while (1) {
|
while (1) {
|
||||||
|
@ -62,18 +60,17 @@ void setup() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ISR(TIMER1_COMPA_vect){//timer1
|
ISR(TIMER1_COMPA_vect){//timer1
|
||||||
if( tune[note] > -1 ) {
|
if( tune2[note] > -1 ) {
|
||||||
length=freqs[tune[note]];
|
length=freqs[tune2[note]];
|
||||||
for (int i=0; i<nsamp; ++i){
|
for (int i=0; i<nsamp; ++i){
|
||||||
waveform[i]=random(256);
|
waveform[i]=random(256);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
note++;
|
note++;
|
||||||
if( note > 7 ) {
|
if( note > 15 ) {
|
||||||
note = 0;
|
note = 0;
|
||||||
}
|
}
|
||||||
pd = analogRead(A0) >> 4;
|
pd = analogRead(A0) >> 4;
|
||||||
Serial.println(pd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue