Skip to content

Commit 4b2dc50

Browse files
committed
Fixed libraries "Fluxamasynth" and "HpDecVfd" to work with Arduino 1.0
1 parent 129e75e commit 4b2dc50

File tree

16 files changed

+2145
-0
lines changed

16 files changed

+2145
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/* FluxamasynthBendingNotes.pde
2+
* Demonstrates note bending on the Modern Device Fluxamasynth Shield
3+
* ModernDevice.com
4+
*/
5+
6+
#include "Fluxamasynth.h"
7+
8+
Fluxamasynth synth;
9+
10+
int i = 512; // middle of pitch bend range
11+
12+
void setup()
13+
{
14+
Serial.begin(31250);
15+
16+
synth.programChange(127, 0, 91);
17+
synth.pitchBendRange(0, 4); //double the pitch bend sensitivity (4 semitones)
18+
19+
synth.noteOn(0, 62, 127);
20+
}
21+
22+
void loop()
23+
{
24+
while (i < 1023) // loop to upper bound of pitch bend range
25+
{
26+
synth.pitchBend(0, i);
27+
i+= 16;
28+
delay(10);
29+
}
30+
31+
while (i > 0) // loop to lower bound of pitch bend range
32+
{
33+
synth.pitchBend(0, i);
34+
i-= 16;
35+
delay(10);
36+
}
37+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/* FluxamasynthCrossFading.pde
2+
* Demonstrates cross fading on the Modern Device Fluxamasynth Shield
3+
* ModernDevice.com
4+
*/
5+
6+
#include "Fluxamasynth.h"
7+
Fluxamasynth synth;
8+
9+
int tone1 = 53;
10+
int tone2 = 61;
11+
12+
int vol1 = 64; // volumes must be inverses of eachother
13+
int vol2 = 127 - vol1; // or they'll get out of sync
14+
15+
int i = 1; // step size
16+
int dir = 1; // direction to step in: 1 = up, -1 = down
17+
18+
void setup() {
19+
20+
synth.programChange(0, 0, 90); // give our two channels different voices
21+
synth.programChange(0, 1, 89);
22+
23+
synth.setChannelVolume(0, vol1); // set their volumes
24+
synth.setChannelVolume(1, vol2);
25+
26+
synth.noteOn(0, tone1, 127); // turn on a note for each channel
27+
synth.noteOn(1, tone2, 127);
28+
}
29+
30+
void loop() {
31+
while (vol1 > i && vol1 < (127 - i)) // loops while in valid volume range
32+
{
33+
delay(20);
34+
vol1+= i * dir; // vol1 increments by i in direction dir
35+
vol2 = 127 - vol1; // vol2 is always the inverse
36+
synth.setChannelVolume(0, vol1); // update volumes
37+
synth.setChannelVolume(1, vol2);
38+
}
39+
dir*= -1; // once volumes reach bounds, reverse dir
40+
vol1+= i * dir; // increment once in new direction
41+
int vol2 = 127 - vol1; // to ensure volumes are back in range
42+
}
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/* FluxamasynthDrumPatternPlayer.pde
2+
* A drum machine for the Modern Device Fluxamasynth Shield
3+
* ModernDevice.com
4+
*
5+
* By Michel Gutlich 26-2-2011
6+
* A sensor signal on analog input 0 gives some tempo dynamics
7+
* Contact at [email protected]
8+
*/
9+
10+
#include "Fluxamasynth.h"
11+
12+
# define bass 36 // Define midi note numbers for several GM drum sounds
13+
# define snare 38
14+
# define hihatC 42
15+
# define hihatP 44
16+
# define hihatO 46
17+
18+
Fluxamasynth synth; // create a synth object
19+
20+
/* **** Our drum pattern ***/
21+
int patternSize = 16; // A pattern of max 16 ticks ( actualy 15, because we loop and 16 is tick no. 1....you dig it ? )
22+
23+
// Every array cell is the velocity of the note played
24+
// Tick 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
25+
int bd [] = {127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 90, 0}; //Bassdrum
26+
int sn [] = { 0, 0, 0, 0,127, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; //Snare
27+
int hho [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,127, 0}; //Hihat Open
28+
int hhc [] = {127, 40, 80, 40,127, 40, 80, 40,127, 40, 80, 40,127, 0, 0}; //Hihat Close
29+
int hhp [] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,127}; //Hihat Pedal
30+
31+
32+
33+
// * Some basic settings */
34+
int channel = 9; // MIDI channel number
35+
int tempo = 120; // Start tempo
36+
37+
/* */
38+
int tickNo; // Our tick number variable
39+
40+
void setup() {
41+
Serial.begin(31250); // Set MIDI baud rate:
42+
43+
synth.midiReset(); // Do a complete MIDI reset
44+
45+
//setReverb( channel , program , level , feedback , delayFeedback )
46+
// Program
47+
// 0: Room1 1: Room2 2: Room3
48+
// 3: Hall1 4: Hall2 5: Plate
49+
// 6: Delay 7: Pan delay
50+
synth.setReverb(channel,5,255,100); // A Plate Reverb with maximum effect level
51+
52+
synth.setChannelVolume(channel, 127); // max. channel volume
53+
synth.setMasterVolume(255); // max. master volume
54+
}
55+
56+
void loop() {
57+
for(int tickNo; tickNo < patternSize; tickNo++)
58+
{
59+
tempo = tempo + (random(5) - 2); // random walk
60+
tempo = constrain(tempo, 40, 250);
61+
bassDrm(bd[tickNo]);
62+
snareDrm(sn[tickNo]);
63+
hihatClose(hhc[tickNo]);
64+
hihatOpen(hho[tickNo]);
65+
hihatPedal(hhp[tickNo]);
66+
tick();
67+
}
68+
}
69+
70+
// Maybe it looks a bit overdone to send both velocity 0 note On and note Off information
71+
// It saves some memory NOT to check for double note Off information...ah well..
72+
73+
void bassDrm (int vel )
74+
{
75+
synth.noteOn(channel, bass, vel); // play a note
76+
synth.noteOff(channel, bass); // send note off
77+
}
78+
79+
void snareDrm (int vel)
80+
{
81+
synth.noteOn(channel, snare, vel); // play a note
82+
synth.noteOff(channel, snare); // send note off
83+
84+
}
85+
86+
void hihatClose (int vel )
87+
{
88+
synth.noteOn(channel, hihatC, vel); // play a note
89+
synth.noteOff(channel, hihatC); // send note off
90+
}
91+
92+
void hihatPedal (int vel)
93+
{
94+
synth.noteOn(channel, hihatP, vel); // play a note
95+
synth.noteOff(channel, hihatP); // send note off
96+
}
97+
98+
void hihatOpen (int vel )
99+
{
100+
synth.noteOn(channel, hihatO, vel); // play a note
101+
synth.noteOff(channel, hihatO); // send note off
102+
}
103+
104+
void tick ()
105+
{
106+
delay(tempo);
107+
}
108+
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/* FluxamasynthPlayAllVoices
2+
* Plays all voices with a random algorithmic tune
3+
* on the Modern Device Fluxamasynth Shield
4+
* ModernDevice.com
5+
*/
6+
7+
#include <Fluxamasynth.h>
8+
#include <PgmChange.h>
9+
10+
11+
Fluxamasynth synth = Fluxamasynth();
12+
13+
int counter = 0;
14+
int channel = 0;
15+
int voice = 0;
16+
int j = 0;
17+
18+
void setup() {
19+
Serial.begin(31250);
20+
synth.programChange(0, 9, 40);
21+
synth.programChange(0, 1, 0);
22+
}
23+
24+
void loop()
25+
{
26+
27+
while(counter < 128)
28+
{
29+
if(voice >128)
30+
{
31+
voice = 0;
32+
}
33+
34+
synth.programChange(channel, 0, voice);
35+
36+
37+
38+
for(int i=0; i<10; i++)
39+
{
40+
41+
int note = int(random(36,100));
42+
43+
synth.noteOn(channel, note, 127);
44+
45+
int coinflip = int(random(0,20));
46+
47+
if(coinflip == 5)
48+
{
49+
while(j < 200)
50+
{
51+
synth.pitchBend(channel, j);
52+
j+= 16;
53+
delay(10);
54+
}
55+
j = 0;
56+
}
57+
58+
delay(100);
59+
synth.noteOff(channel, note);
60+
}
61+
62+
voice++;
63+
64+
}
65+
channel++;
66+
counter++;
67+
}
68+

0 commit comments

Comments
 (0)