Circuit Python project

Today, I’ve been working on creating a piano with circuit python. I have most of my C scale programmed on the board, and I’m planning to add more scales to it.

How does it work? If you touch a certain part of the board, it produces a pitched sound. One part of the board produces a different pitch than the other. How it does it is the frequency number. For example, a C note is 261.63 Hz.

from adafruit_circuitplayground import cp


while True:
    while cp.touch_A1 or cp.touch_A2 or cp.touch_A3 or cp.touch_A4 or cp.touch_A5 or cp.touch_A6 or cp.touch_A7:
        if cp.touch_A1:
            cp.start_tone(262)

        if cp.touch_A2:
            cp.start_tone(293)
        
        if cp.touch_A3:
            cp.start_tone(329)
    
        if cp.touch_A4:
            cp.start_tone(349)
            
        if cp.touch_A5:
            cp.start_tone(391)
            
        if cp.touch_A6:
            cp.start_tone(440)
            
        if cp.touch_A7:
            cp.start_tone(493)
    
    cp.stop_tone()

https://learn.adafruit.com/sensor-plotting-with-mu-and-circuitpython/capacitive-touch

https://learn.adafruit.com/circuitpython-made-easy-on-circuit-playground-express/play-tone