Machine Learning - Creative Coding
———————————————————————————————————————————————————————
Link: https://editor.p5js.org/Kevin-Lewis-13/sketches/dYTZu8Yos
———————————————————————————————————————————————————————
-------------------------—————————————————————
Instructions:
Speak 1, 2, 3, 4, 5 or 6 to change chess pieces.
Speak Up, Down, Left or Right to move chess pieces.
-------------------------—————————————————————
Description:
Out of the ml5.js resources, I thought that sound classifier was the coolest, but instead of just printing out what was heard by the sound recognizer, I wanted to do something with that input.
So I decided to use a chess board in order to utilize the spoken inputs. Saying the numbers would change the chess piece, while saying directions would move the pieces.
I first started with a double for loop to create the chess board and alternate the colors of the chess board.
Then, I added the number changing.
After, I added the movement, and also added some checking so that the pieces stay within the board.
Finally, I added some sfx to make it feel a little better. One thing that I didn't do that would have been cool was to make it move like the pieces actually do. For example, for a bishop saying "up" followed by "right" moving it like how a bishop actually would, or even saying how many spaces, but it would take a lot more time than I currently have to spare to do so many different choices.
Credits:
sfx: https://freesound.org/people/el_boss/sounds/546119/
chess pieces: https://commons.wikimedia.org/wiki/Category:PNG_chess_pieces/Standard_tran sparent