Go Down

Topic: MIDI Xilophone (over serial) to Ableton (Read 12 times) previous topic - next topic

boguz

well, i think you are right. Maybe it is smarter to have a way to send also value 0.
I played around with the ClickButton library and manage to make to buttons work so that 1 click sends 127 and Click+Hold sends value 0.
i didn't manage to make it into an array yet, but i'll still give it another go.
putting the "ClickButton button1(buttonPin1, LOW, CLICK_PULLUP);" from the beginning into the arrays is confusing me, but there is no hurry, the "firmware" can always be updated when i know enough coding to do it!   ;)

So, let me recall what is working so far:
the 8 piezos,
the 4 assignable buttons (with click and click+hold),
the 4 potenciometers;

But now i have one other question for a 5th button.
There is a defined array of notes for the piezos
Quote
unsigned char PadMajor[8] = {60,62,64,65,67,69,71,72};


what i would like to do, would be to have 3 Scales (or modes) that i can chose with a button.
To have a major scale, a minor scale, and maybe a Pentatonic Scale or a Prhygian Mode.
It would start with Scale1 (major). Each button click would make it to the next scale. Each button Hold would change it into the previous scale.

Finding the midi note numbers is no problem. (maybe not so easy to decide which mode i want to have!!!   8)  )

i imagine it could work like this:
i make a new button than can control a "mode" variable.
when mode is equal to 1 the scale to be played is PadMajor. mode 2 = PadMinor and mode 3 = PadPentatonic.

But now imagining it and doing it are very different things...
Is an array "loopable"?
Let's say
for (int mode=0; mode<3; mode++)   -  when mode is equal to 3 if i would use something like "mode++) would it go back to 1 or would it continue to 4?

How can i connect two separate parts of the code, the one with the button defining the "mode" with the one that is telling which notes to play?

Ahhhh...    :~   i think i am at a stage now where i can understand some of the concepts involved with programing, but i cannot use them yet. i can understand for instance that with variables we can connect things, but then when i try to use them everything get's mixed up along the way...
well, i guess i cannot ask to learn it all in two weeks! With time i'll get there.
Until then, i am lucky to have this form to push me in the right directions!  Thanks!
=)

Let's get this last button working...  then it's time to start building everything!  =)
And PLAY!!!  =)

Grumpy_Mike

Quote
would it go back to 1 or would it continue to 4?

It would be 4.

Quote
Is an array "loopable"?

No idea what you mean. I like to think of an array as being a variable with a name that is a variable. That is it allows the same code to operate on different variables.

Getting to know what you want to do is half the battle. You have done very well so far, you should be very pleased with yourself. There is always more to learn, that's the fun.  :)

boguz

by "loopable" i meant if if will continue to four or if after the last value in the array it will "loop" back to the first. So if we add always (++) it would "loop" through the values inside the array.
But i made a couple of experiments and it seems it's not like that.

Well, anyway, i have good news!!!
I think now EVERYTHING is working!  8)

Surely it is not the most elegant nor the most genial code, but hey, it is getting the job done!
This will be the V1.0 of (maybe) several to come...   ;)

Now the piezos are working, the buttons and the pots also and the button is also enabling us to choose from Ionian (major), Aeolian (minor) and Major Pentatonic Modes.

Now it is time to try to plug it to some music software and get some sound from it!!!
Also time to start thinking about building a nice "real music instrument" (maybe out of wood).


== = = = == === ==== == = = =
i have still one more question that just came to my mind.
i thought a couple of times that it could be useful to have a little led somewhere blinking whenever there is some "communication", like the TX led in the Arduino Board.
How could i do this?
I noticed that there is a pin in the board (digital pin 1) where it also reads TX. Could i use it?


Thank you!
=)

Grumpy_Mike

Quote
a pin in the board (digital pin 1) where it also reads TX. Could i use it?

Yes you could but as it has to drive the USB to serial converter chip then don't load it too much. An LED with a 1K would be best.

Quote
So if we add always (++) it would "loop" through the values inside the array.

Still not sure but:-
Code: [Select]

index = 0;
while(conditionIsTrue){
array[index++] = // something
if(index > indexLimit) index = 0;
// do something else
}

Would work. The index++ is called post incrementing, that is the operation is performed and then the value index is incremented. The inverse is pre indexing
Code: [Select]
array[++index] = // something
Here the value index is incremented before doing the operation with array.

boguz

hmmm, i have been looking on information on how to make the "external TX indicator" work (i mean, an LED that blink as the onboard TX LED), but i don't seem to find it...

When i connect an LED with a 1k resistor to the pin1 on the Arduino, the LED is ALWAYS on (but not the onboard TX one). i didn't even add it to the sketch, i just connected it and it came on.

Any ideas where i can find information on how to do this?

= = = = = =

Another question...

Every time i have built something with the Arduino i have used breadboards.
Now that the MIDI Xylophone is getting ready i start to think on the "building it" side of things to make a more defenitive version that i can actually play, take with me to rehearsals,....
The design, what wood to use and what kind of "enclosure" i want to make, ...
But then it came to my mind: do i need to solder things to the ARDUINO?
If i am using some kind of protoboard where i solder/connect all the components in the project, how do i then connect them to the Arduino's pins?
Should i use the same kind of jumper wires that plug in the pins and then solder the other end to the protoboard?

Thank you
=)

Go Up