Spectral Averaging Patch

Calling this a spectral averaging patch is in fact a misnomer. The original goal at the outset of the project was for the patch to take a literal spectral average of a pop song; however, the results were unpleasant sounding. Instead, the final version of this patch takes a snapshot of the dominant frequencies in a song, creating a spectral signature of the sound input.

file_input_new

The first step is the file_input patch. This patch allows you to open a song, play the song, and hear the sound both processed (wet volume) and unprocessed (dry volume). The song data is processed through a [pfft~]. The 400 seconds input into the [pfft~] upon loading multiply the average by 400 so that it can be heard over 400 seconds of time. The patch comes with an option to record the wet output for a set amount of time using the [metro] and the [sfrecord], but for the purposes of the “Top40” compositions, this option is ignored and instead the data in the [buffer] is recorded as a sort of spectral snapshot.

spectral_recorder.jpg

Inside the file_input [pfft~] is the spectral_recorder patch. This converts the song into four channels of FFT data, two for amplitude data (left and right) and two for phase data (left and right). The [casey] object filters out everything but the top five harmonics and records them into the buffer. The phase data is processed through [framedelta~], which computes the phase deviation between successive frames, [phasewrap~], which wraps the data between π and –π, and [frameaccum~], which accumulates the data. The phase data is then recorded in the buffer. The middle top column of objects processes the 400 seconds input in the file_input patch, and the [count~] and [index~] objects allow the FFT information to be recorded over time.

file_output.jpg

The file_output patch plays back the spectral snapshot taken in the file_input patch. The snapshot is loaded into the buffer and played back through the [pfft~] into the [dac~]. The user can record this output to a new file by hitting the “open” message attached to the [sfrecord~] object. The number box above the [* 1000] and [metro] objects allows the user to input the length in seconds to be recorded, and the [metro] will automatically shut off the [sfrecord~] when the time is up.

spectral_player.jpg

Inside the file_output [pfft~], the spectral_player patch simply takes the spectral snapshot recorded in the file_input patch and plays it back as a continuous stream of sound. The four channels of the snapshot buffer are read by the four [index~] objects, and that information is converted back to ordinary number data by the [poltocar~] and [fftout~] objects.

439 words

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License