Keyboard generation for piano and drum
We created a layout of piano and drum notes on a green chart paper. For piano we used 16 notes and for drum we used 5 notes. We created modules inside the detect_control module to detect this paper and plot the keyboard on the VGA screen. This module looks for only green colour. The corners of the chart paper were detected by using linear equations concept. Once the corners were detected, the distance between them was divided into 16 equal parts for the piano and 5 equal parts for the drum. This would thus be in sync to the keys layout on the paperfor the piano and the drum. The green_keyboard module generates the two corner for the keyboard by detecting the green chart paper edges. The gen_keys module generates the keyboard on the screen. In this module we create another signal called is_inside_key[i], where i denotes the key number, that determines if the current pixel is inside the keyboard or not. We use a wire from the previous skin detection module called is_finger that would be set if finger (skin) is detected on the screen. Using this signal and is_inside_key[i] we can find out if there is a finger inside the keyboard and thus create another wire called is_key_pressed[i] where i denotes the key number. This signal is given out of the detect_control module and is then used by the piano synthesis module or the drum synthesis module to play sound whenever key is pressed.
General Block Diagram