codGmer wrote: ↑
Sat Feb 24, 2018 2:15 pm
First of all, i dont need a loop if it is possible otherwise. I would like to get some help setting up the python script for sending midi because it is a lot more complex ofcourse. I dont get why you would call me 'they', you could answer me directly because it now feels like im being left out here. and i know what ctrl Z does but its just a finding that after doing that a couple of times every time that it really makes the script run like its supposed to. So please can we move on creating sending midi with python, a loop isnt nessecary. Or making a loop and then only send midi when the potmeter has changed. I really am thankfull for the help but im just learning it all. Im only familiar with c#.
Appologies for "they" but I was responding to another poster's comments, not directly to you so it seemed apropriate.
As for ctr-Z, the gif you posted above suggests otherwise. Or at least that while you understand ctr-Z, you don't understand how to resume the suspended process.
Consider this pseudo code:
Code: Select all
read and store pot
send MIDI message
if pot value significantly different to stored value:
send MIDI message
store poit value
pause for some amount of time
The time you pause for needs to be short enough that you get the response you want but not so short that it eats all the available cpu time.
Nothing above here is python specific.
You'll have to use a loop as the library you're using doesn't have a callback on change function.
To get the magnitude of the change between the two pot readings try this python snippet:
You can then test as follows:
The downside of this approach is that instead of having a continous range of values sent to MIDI, you'll only see changes in steps. If your minimu change is 10, your MIDI device will only see values of 10, 20, 30, etc
Give me some time and I'll post a possible approach that avoids this.