This week, we have made some changes to what we expect our final program to do. Our biggest issue was playing back a midi file and simultaneously calling a drawShape() function. The MIDI library has a function: ( *midi device*).onNoteOn( *function*) which calls a function whenever a note is played on a midi controller. The issue is that we intended our program to do this but with a midi file. The main issue surrounding this is dealing with rests in the midi file (we didn’t want our program to ignore rests). The one possibly feasible solution to this is to find a way to have a Digital Audio Workstation set up to output to our program as if it was a midi controller. I’m not entirely sure this is possible. I have reached out to the Apple Logic Pro X to determine if this is doable. In the meantime, we are changing the goal of this program to be more of an aid to live performance. It will create the displays in real time as someone plays on a midi keyboard.
One of the main functions I worked on this week is an animated color gradient. This will be the background of our display.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def updateColor(shape): | |
| while b: | |
| for count in range(0,3): | |
| #From red (255,0,0) to blue (0,0,255) | |
| for i in range(0,255): | |
| red = 255 – i | |
| green = 0 | |
| blue = i | |
| color = Color(red,green,blue) | |
| shape.setColor(color) | |
| time.sleep(0.01) | |
| if color == Color(1,0,254): | |
| #From blue (0,0,255) to red (255,0,0) | |
| for i in range(0,255): | |
| red = i | |
| green = 0 | |
| blue = 255 – i | |
| color = Color(red,green,blue) | |
| shape.setColor(color) | |
| time.sleep(0.01) |
A stretch goal for this function would be to have it update from side to side so that it has a more dynamic look.
Additionally, I have been working on putting together our setUp() function.
At this point, I feel like the completion of this program is realistic and within our ability. From here on we need to devise the main function that will modify and add our graphics to the display.