Go Down

Topic: MIDI Theremin Controller Project Advice (Read 10000 times) previous topic - next topic

Grumpy_Mike

Quote
you're remarks are kind of like looking at a person in a wheelchair going up a ramp and commenting 'hey you know it would be faster to just use the stairs'.

No they are not.

They are like seeing a person in a wheelchair going up a ramp and commenting 'hey did you not read that big notice that says there is a lift ( elevator for the U.S. inclined ) '
It is intended to help both you and others.

The code you posted is unreadable, the forum mangled it, that is why we have code tags and that is why we explain them in the post I directed you to!

bildakid

Thanks for all your help mike much appreciated.

If anyone has some code showing how to control midi mod wheel with arduino would be much appreciated. Once I have the unit fully working I'll post my code so others may benefit from what I have learned.




Grumpy_Mike

Quote
code showing how to control midi mod wheel with arduino

It is just like the other messages:-

Code: [Select]

void sendPB(int pb){ // send pitch bend message
  Serial.write( (byte)0xE0 | channel);
  Serial.write( pb & (byte)0x7f);
  Serial.write( (pb>>7) & (byte)0x7f);
}

bildakid

Thanks for the sample code I will try it tonight.  Here is where I am so far. Dealing with max and min values of the ir sensors has been the biggest challenge, it's most likely from touching the sensors and causing an abnormal spike in the voltage from the wires moving in the bread board, I'm sure once I solder it to a circuit board the sensors should be a little more predictable. (I've got all the code to handle max and min but every now and then I touch the sensor and makes the min or max way above what is the norm)

bildakid

Thanks again mike, I was able to implement your code. Thanks for that.

I'm still having issues with max and min values coming in from the ir sensors,

As the values come in I then compare them to a max and min value if the incoming value is greater then the max I rewrite the max value to the new one, and then the same for the min value.

I then use the distance between the two to map it to 0-127 on my cc midi value.

But every now and again a greatly abnormal value comes in and redefines the max or min leaving me with the ability to turn the cc value say between 40-90% and never going back to zero, unless I get an abnormal value again?

I'm trying to implement a second level of logic to count the number of times a value comes in, if I get the same value too often I then consider the value as a realistic max or min and rewrite the max or min again.
Am I going about it the right way or does anyone have better way to self correct an ir input?

Grumpy_Mike

Quote
But every now and again a greatly abnormal value comes in and redefines the max or min leaving me with the ability to turn the cc value say between 40-90% and never going back to zero, unless I get an abnormal value again?

You can tackle this in two ways:-
1) Do some tests and fix the max and min values in code.
2) Use averaging rather than a single value to set your extremes.

bildakid

Thanks Mike, I'm sure it has to do with my finger touching the sensor and making the connections in the breadboard cause a small spike. I'm sure once I get them soldiered in they should be more consistent. But on the whole as a user input these sensors need alot more attention then say a regulated input like a joy stick. I'm looking into averaging and mean. In the end it will mean collecting data into an array and constantly comparing it, which I'd rather not due seeing how c has so little array operators such as push and pop. But the syth is working great, just need to get the sensor code nailed down, thanks Mike. I'll post a video once it's a bit further along.

vanakaru


Go Up