Recognize Pitch to Reconstruct a Signal
The main pitch of an audio signal can be detected or tracked using classical signal processing or neural network-based algorithms. The main pitch can be used for analysis, classification or reconstruction of a signal. In this example, the built-in PitchRecognize function is used to construct an approximation of a signal based on its detected pitch.
Start with a recording of a Bach fugue.
Track the pitch of the signal using a neural network-based method.
Define a function that performs the recognition using the "SoundNotePitch" property in PitchRecognize, deletes the missing values, splits separate notes appropriately and finally outputs a Sound object containing the reconstruction.
Use the function to reconstruct a Sound object from the original recording.
Since the pitch information computed by PitchRecognize is completely symbolic, you can reconstruct the melody using any instrument available through SoundNote.
Force PitchRecognize to return a discretized set of frequencies.
Give the time series to AudioGenerator to control the oscillator frequency.
Improve the approximation by incorporating amplitude data from the original signal, using AudioLocalMeasurements to track the maximum sample values.
Compare the spectrogram with the original.
For fun, generate the tonal response to the first statement of the theme. Translate the sequence up a fifth, except for the first note, which will be raised by a fourth.
Repeat the generation.