MATHEMATICAL QUESTION turning variables into arrays...looks simple but can't get my head around it
in
Programming Questions
•
2 years ago
Hi guys,
Does anyone have an idea about the following issue please?
I'm using list of numbers coming from a variable (which are notes from a midi file but it can be any variable in that matter) It is for example:
10, 20, 35, 45, 60, 75, 100, 40
I get this list each time I click the mouse:
when I press once I get the values 10, 20, 35, 45
when I press again it stops
when I press again it starts from where it stopped so 60, 75, 100, 40
that's what I want for now it's all good.
But what I really need is to turn this list 10, 20, 35, 45 with a new list starting with 0 and then continuing using the same incremental process.
In other words what I want to turn the 1st list 10, 20, 35, 45 into (10-10), (20-10), (35-10), (45-10)
in the same way when I press again and get the 2nd list 60, 75, 100, 40 I want to turn it into (60-60), (75-60), (100-60), (40-60)
What seems to be a solution is to turn these lists into arrays.
If this array is called NoteList[ ] I could use it this way:
1st list (10- NoteList[0]), (20- NoteList[0]), (35- NoteList[0]), (45- NoteList[0]),
in this case NoteList[0] = 10
2nd list (60- NoteList[0]), (75- NoteList[0]), (100- NoteList[0]), (40- NoteList[0]),
in this case NoteList[0] = 60
but didn't have any luck into turning a list of variables into an array....
does that make sense?
I need to be able to call back the very first variable of a list of variables (which changes over time)
I had a look at the ArrayList but it seems to be calling a class (add.class) which I don't need, what I need seems to be much simpler.....
Any help would be very much appreciated!
Does anyone have an idea about the following issue please?
I'm using list of numbers coming from a variable (which are notes from a midi file but it can be any variable in that matter) It is for example:
10, 20, 35, 45, 60, 75, 100, 40
I get this list each time I click the mouse:
when I press once I get the values 10, 20, 35, 45
when I press again it stops
when I press again it starts from where it stopped so 60, 75, 100, 40
that's what I want for now it's all good.
But what I really need is to turn this list 10, 20, 35, 45 with a new list starting with 0 and then continuing using the same incremental process.
In other words what I want to turn the 1st list 10, 20, 35, 45 into (10-10), (20-10), (35-10), (45-10)
in the same way when I press again and get the 2nd list 60, 75, 100, 40 I want to turn it into (60-60), (75-60), (100-60), (40-60)
What seems to be a solution is to turn these lists into arrays.
If this array is called NoteList[ ] I could use it this way:
1st list (10- NoteList[0]), (20- NoteList[0]), (35- NoteList[0]), (45- NoteList[0]),
in this case NoteList[0] = 10
2nd list (60- NoteList[0]), (75- NoteList[0]), (100- NoteList[0]), (40- NoteList[0]),
in this case NoteList[0] = 60
but didn't have any luck into turning a list of variables into an array....
does that make sense?
I need to be able to call back the very first variable of a list of variables (which changes over time)
I had a look at the ArrayList but it seems to be calling a class (add.class) which I don't need, what I need seems to be much simpler.....
Any help would be very much appreciated!
1