We are about to switch to a new forum software. Until then we have removed the registration on this forum.
V proud to share this first project for my masters. I wrote a piece of code that motion tracks webcam movement, converts it to MIDI data and then sends it out to Ableton to create a soundscape.
I present to you, Night:Code
Comments
Let me know if you want to see the code!
Code plase
;-)
Ffs, Why does the code button never work for me?!
Go back
Edit your post with the gear
Ctrl-a and ctrl-o
Make sure there is an empty line above and below your code block. It makes a big difference.
Kf
Ayyye, done. Thank you. The empty line was the trick that worked for me :)
Congratulations on completing the project. Looks / sounds great!
One suggestion for making the code more readable and easier for you to work with in the future: consider compressing your code by using a for loop over repeating bits and feeding in different values.
For example, lines 71-227 are really the same five lines over and over again looping over an array of numbers, so you could that into ~7 lines plus separate rectangle data. Ditto lines 243-338.
Cool, thank you @jeremydouglass I did wonder if a for loop might be easier but it was getting close to the end of my deadline and I needed to get my work in. Also, this is my first piece of code ever written so I'm still a noob to all this!
For example (this is a simple way, without classes), you can create an arraylist in the header to store all your rectangles:
like this:
..and then, in setup, you can save a list of four numbers for each rectangle:
...and then, in draw, replace all of your code that looks like this:
...with just one loop that draws a rectangle for each item in your list:
Now say you want to bind note values to that. Update your data in setup so that it adds the values at the end of each rectangle data line:
Now in draw replace all your code that looks like this:
...with just one loop that sends the listed note variables for each item, e.g. (untested):
Holy sh*t, that's great! It would have made it so much more compact. I would have liked to make it so that the movement only turned red when it moved into one of my rectangles but was time bound. I'd like to keep it up and carry on programming. Not just learn it once for the course and then leave it.
@jeremydouglass