This paper presents a method for noise-free recording of the keyboard-based musical instruments. By integrating an r-shaped triboelectric generator (TEG) into the keyboard of a piano, it can produce electric signal while playing music due to the combination of contact electrification and electric induction. We investigated the electric signal and developed a graphical user interface to convert the electric signal back to music. Using the piano and the graphical user interface, active noise-free recording can be realized. Namely, only the sound produced by the piano can be converted and recorded, while other noise in the environment can be filtered automatically.