Python-PIANO-Project

This project was divided on two Milestones. The Idea for Milestone One: You are the PIANIST, you should mix and match frequencies to generate your own song using the numpy, matplotlib.pyplot, and sounddevice libraries in Python. The Idea For Milestone Two: Noise Cancellation and Frequency Domain

Background For Milestone One:

Each pressed piano key/note number 𝑖, corresponds to a single tone with frequency 𝑓𝑖 generated for a certain period of time 𝑇𝑖starting from time 𝑑𝑖 over a defined time range 𝑑.

π‘₯𝑖(𝑑) = sin(2 * πœ‹ * 𝑓𝑖 * 𝑑) * [𝑒(𝑑 βˆ’ 𝑑𝑖) βˆ’ 𝑒(𝑑 βˆ’ 𝑑𝑖 βˆ’ 𝑇𝑖)]

Where the unit step functions defines the playing interval.

Example: Assume that we started pressing the middle C key (𝑓1 = 261.63 𝐻𝑧), at time 𝑑1 = 0 for a duration of 𝑇1 = 1.5 seconds, the resultant signal is:

π‘₯1(𝑑) = sin(2 * 261.63πœ‹ * 𝑑) [𝑒(𝑑) βˆ’ 𝑒(𝑑 βˆ’ 0.5)]

Background For Milestone Two:

Assume that additional noise is generated by a child who kept pressing the same 2 random piano keys during your song playing interval such that the noise is represented as follows, 𝑛(𝑑) = sin(2 * 𝑓𝑛1 * πœ‹ * 𝑑) + sin(2 * 𝑓𝑛2 * πœ‹ * t)

Where, 𝑓𝑛1 and 𝑓𝑛2 are two frequencies selected randomly from the 3rd and 4th octaves frequencies list respectively. Your final song after the noise becomes, π‘₯𝑛(𝑑) = π‘₯(𝑑) + 𝑛(𝑑)

Goal: Noise Cancelation: using frequency domain conversion