Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
148 additions
and
91 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 34 additions & 49 deletions
83
Examples/FluxamasynthPlayAllVoices/FluxamasynthPlayAllVoices.ino
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,68 +1,53 @@ | ||
/* FluxamasynthPlayAllVoices | ||
* Plays all voices with a random algorithmic tune | ||
* on the Modern Device Fluxamasynth Shield | ||
/* | ||
* FluxamasynthPlayAllVoices | ||
* Cycles through all of the instruments | ||
* ModernDevice.com | ||
*/ | ||
|
||
#include <Fluxamasynth.h> | ||
#include <PgmChange.h> | ||
|
||
Fluxamasynth synth = Fluxamasynth(); | ||
|
||
Fluxamasynth synth = Fluxamasynth(); | ||
int counter = 0; | ||
int channel = 0; | ||
int voice = 0; | ||
int j = 0; | ||
|
||
int counter = 0; | ||
int channel = 0; | ||
int voice = 0; | ||
int j = 0; | ||
|
||
void setup() { | ||
Serial.begin(31250); | ||
synth.programChange(0, 9, 40); | ||
void setup() { | ||
// Serial1.begin(31250); // Uncomment if using a Feather M0 board | ||
synth.midiReset(); | ||
synth.programChange(0, 9, 40); | ||
synth.programChange(0, 1, 0); | ||
} | ||
} | ||
|
||
void loop() | ||
{ | ||
void loop() { | ||
|
||
while(counter < 128) | ||
{ | ||
if(voice >128) | ||
{ | ||
while(counter < 128) { | ||
if (voice > 128) { | ||
voice = 0; | ||
} | ||
|
||
synth.programChange(channel, 0, voice); | ||
|
||
|
||
|
||
for(int i=0; i<10; i++) | ||
{ | ||
|
||
int note = int(random(36,100)); | ||
|
||
synth.noteOn(channel, note, 127); | ||
|
||
int coinflip = int(random(0,20)); | ||
|
||
if(coinflip == 5) | ||
{ | ||
while(j < 200) | ||
{ | ||
synth.pitchBend(channel, j); | ||
j+= 16; | ||
delay(10); | ||
synth.programChange(channel, 0, voice); | ||
|
||
for(int i=0; i<10; i++) { | ||
int note = int(random(36,100)); | ||
synth.noteOn(channel, note, 127); | ||
int coinflip = int(random(0,20)); | ||
if (coinflip == 5) { | ||
while(j < 200) { | ||
synth.pitchBend(channel, j); | ||
j+= 16; | ||
delay(10); | ||
} | ||
j = 0; | ||
} | ||
|
||
delay(100); | ||
synth.noteOff(channel, note); | ||
} | ||
|
||
voice++; | ||
|
||
} | ||
channel++; | ||
counter++; | ||
delay(100); | ||
synth.noteOff(channel, note); | ||
} | ||
voice++; | ||
} | ||
channel++; | ||
counter++; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Fluxamasynth out of sync tape loop example | ||
// Inspired by Eno's Music for Airports #2: F2 G#2 C3 C#3 D#3 F3 G#3 | ||
// Won't make sense without 10k poteniometers on pins A0-A5 | ||
// https://vimeo.com/252388252 | ||
|
||
#include "Fluxamasynth.h" | ||
Fluxamasynth synth; | ||
|
||
int tones[6] = { 29, 32, 36, 37, 39, 41 }; | ||
int instruments[6] = { 55, 55, 55, 55, 55, 55 }; | ||
int tapeLength[6] = { 30, 31, 32, 33, 34, 35 }; | ||
int startingPoint[6] = { 0, 1, 2, 3, 4, 5 }; | ||
int length[6] = { 100, 110, 120, 130, 140, 150 }; | ||
int lengthCount[6] = { 0, 0, 0, 0, 0, 0 }; | ||
int tempo[6] = { 1000, 2000, 3000, 4000, 5000, 6000 }; | ||
int tempoCount[6] = { 0, 0, 0, 0, 0, 0 }; | ||
long int startTime = 0; | ||
|
||
void setup() { | ||
// Serial1.begin(31250); // Uncomment if using a Feather M0 board | ||
Serial.begin(9600); | ||
int seed = 0; | ||
for (int i=0; i<6; i++) { | ||
seed += analogRead(i); | ||
} | ||
|
||
randomSeed(seed); | ||
delay(100); | ||
for (int i=0; i<6; i++) { | ||
synth.setChannelVolume(i, 255 ); | ||
synth.allNotesOff(i); | ||
synth.setReverb(i, 5, 64, 0); | ||
synth.pan(5-i,127/(6*(i+1))); | ||
} | ||
changeProgram(); | ||
startTime = 0; | ||
} | ||
|
||
void changeProgram() { | ||
for (int i=0; i<6; i++) { | ||
synth.programChange(0, i,random(127)); | ||
} | ||
} | ||
|
||
void loop() { | ||
if (millis() > (startTime + 20000)) { | ||
changeProgram(); | ||
startTime = millis(); | ||
Serial.println("changeProgram"); | ||
} | ||
int ledTempo = 0; | ||
for (int i=0; i<6; i++) { | ||
int val = analogRead(i); | ||
tempo[i] = 5100 - map(val, 0, 1023, 100, 5000); | ||
tempoCount[i]++; | ||
if (tempoCount[i] > tempo[i]) { | ||
if (lengthCount[i] == 0) { | ||
synth.noteOn(i, tones[i], 127); | ||
} | ||
lengthCount[i]++; | ||
if (lengthCount[i] > length[i]) { | ||
synth.noteOff(i, tones[i]); | ||
lengthCount[i] = 0; | ||
tempoCount[i] = 0; | ||
} | ||
} | ||
} | ||
delay(1); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters