The toolkit was created by Cooper Baker in 2013, with generous support from a University of California San Diego research grant supervised by Tom Erbe. In 2019 the project was updated as a cross-platform library and added to Pd's external object management system. Special thanks to Miller Puckette for invaluable insight regarding spectral math and the Pd api.
Citation
Baker, C., Erbe, T. "Pd Spectral Toolkit", Proceedings of the International Computer Music Conference, Pp. 410-413, Perth, Australia, 2013.
Links
· Pd-Spectral-Toolkit.zip· Source Code Browser
· GitHub Repository
· ICMC Paper.pdf
· Poster.pdf
Installation
Pd Assisted Install:
· Pd -> Help -> Find Externals -> "Pd Spectral Toolkit" -> Search
· Select the appropriate version for your system
Manual Install:
· Copy the Pd Spectral Toolkit folder into your Pd installation (i.e. /Library/Pd/Pd Spectral Toolkit in Mac OS)
· Edit Pd startup settings to load pd_spectral_toolkit
· Restart Pd
Object Categories
comparison!&&~ !=~ !||~ &&~ <=~ <~ ==~ >=~ >~ ||~operator
!~ %~ cmplxabs~ cmplxadd~ cmplxdiv~ cmplxmult~ cmplxsqrt~ cmplxsub~ recip~ rounder~ trunc~conversion
amptodb~ amptomag~ cartoamp~ cartodb~ cartofreq~ cartomag~ cartophase~ cartopolar~ ctltosig~ dbtoamp~ dbtomag~ degtorad~ degtoturn~ freqtocar~ freqtophase~ freqtopolar~ magtoamp~ magtodb~ phasetofreq~ polartocar~ polartofreq~ radtodeg~ radtoturn~ sigtoctl~ turntodeg~ turntorad~spectral
binindex~ binmax~ binmin~ binmix~ binmonitor~ binsort~ bintrim~ blocksmooth~ freqsieve~ fundfreq~ harmprod~ magtrim~ oscbank~ pafft~ paifft~ partconv~ peaks~ phaseaccum~ phasedelta~ piwrap~ rotate~ valleys~ windower winfft~ winifft~misc
bitsafe~ countwrap dspbang~ monitor~ rgbtable scale~ softclip~ tabindex~ terminal
Object Index
!&&~ | logical not and |
!=~ | logical not equal |
!||~ | logical not or |
!~ | not |
&&~ | logical and |
%~ | modulo |
<=~ | logical less than or equal |
<~ | logical less than |
==~ | logical equal |
>=~ | logical greater than or equal |
>~ | logical greater than |
||~ | logical or |
amptodb~ | amplitude to dB-FS decibels conversion |
amptomag~ | amplitude to magnitude conversion |
binindex~ | outputs a ramp with values from zero to block size minus one |
binmax~ | reports maximum bin value and associated data per block |
binmin~ | reports minimum bin value and associated data per block |
binmix~ | mixes inlet 2 values for all matching inlet 1 values and zeroes all others |
binmonitor~ | outputs a float representing the value of a single bin |
binsort~ | sorts spectral data in ascending or descending order |
bintrim~ | zeroes bin values outside of a specified range |
bitsafe~ | fixes infinity and not a number values |
blocksmooth~ | replaces a block's zero values with preceeding adjacent non-zero values |
cartoamp~ | cartesian coordinates to amplitude conversion |
cartodb~ | cartesian coordinates to dB-FS decibels conversion |
cartofreq~ | cartesian coordinates to magnitude and frequency pairs conversion |
cartomag~ | cartesian coordinates to magnitude conversion |
cartophase~ | cartesian coordinates to phase conversion |
cartopolar~ | cartesian coordinates to polar coordinates conversion |
cmplxabs~ | complex absolute value |
cmplxadd~ | complex addition |
cmplxdiv~ | complex division |
cmplxmult~ | complex multiplication |
cmplxsqrt~ | complex square root |
cmplxsub~ | complex subtraction |
countwrap | bang driven wrapping counter |
ctltosig~ | control range to signal range conversion |
dbtoamp~ | dB-FS decibels to amplitude conversion |
dbtomag~ | dB-FS decibels to magnitude conversion |
degtorad~ | degrees to radians conversion |
degtoturn~ | degrees to turns conversion |
dspbang~ | outputs a bang when dsp is turned on |
freqsieve~ | assigns frequencies and magnitudes to proper bins |
freqtocar~ | magnitude and frequency pairs to cartesian coordinates conversion |
freqtophase~ | frequency to phase conversion |
freqtopolar~ | magnitude and frequency pairs to polar coordinates conversion |
fundfreq~ | reports most prominent fundamental frequency per spectral block |
harmprod~ | harmonic product spectrum |
magtoamp~ | magnitude to amplitude conversion |
magtodb~ | magnitude to dB-FS decibels conversion |
magtrim~ | zeroes bin values outside of a specified magnitude range |
monitor~ | samples a signal and outputs a float every 20 milliseconds |
oscbank~ | oscillator bank for spectral resynthesis |
pafft~ | windowed phase aligned fast fourier transform |
paifft~ | windowed normalized phase aligned inverse fast fourier transform |
partconv~ | partitioned convolution with cartesian coordinates |
peaks~ | finds peaks in spectral data and zeroes everything else |
phaseaccum~ | running phase sums for each bin per frame |
phasedelta~ | phase deviation per frame for each bin |
phasetofreq~ | phase to frequency conversion |
piwrap~ | wraps a signal between -pi and pi |
polartocar~ | polar coordinates to cartesian coordinates conversion |
polartofreq~ | polar coordinates to magnitude and frequency pairs conversion |
radtodeg~ | radians to degrees conversion |
radtoturn~ | radians to turns conversion |
recip~ | reciprocal calculation |
rgbtable | outputs color values based on input float value |
rotate~ | rotates samples in a signal vector |
rounder~ | rounds decimal values to specified precision |
scale~ | scales values from one range to another |
sigtoctl~ | signal range to control range conversion |
softclip~ | soft clipping waveshaper |
tabindex~ | writes table values at index location |
terminal | command line shell interface |
trunc~ | truncates decimal values to specified precision |
turntodeg~ | turns to degrees conversion |
turntorad~ | turns to radians conversion |
valleys~ | finds valleys in spectral data and zeroes everything else |
windower | writes various window functions into arrays |
winfft~ | windowed fast fourier transform |
winifft~ | windowed normalized inverse fast fourier transform |
[ !&&~ ] Not And
Performs a logical not and comparison of two signals and outputs 1 or 0. inlet 1: value a inlet 2: value b outlet: result argument: value b | source index top |
[ !=~ ] Not Equal
Performs a logical not equal comparison of two signals and outputs 1 or 0. inlet 1: value a inlet 2: value b outlet: result argument: value b | source index top |
[ !||~ ] Not Or
Performs a logical not or comparison of two signals and outputs 1 or 0. inlet 1: value a inlet 2: value b outlet: result argument: value b | source index top |
[ !~ ] Not
Performs a logical not operation on a signal. inlet: value outlet: result | source index top |
[ &&~ ] And
Performs a logical and comparison of two signals and outputs 1 or 0. inlet 1: value a inlet 2: value b outlet: result argument: value b | source index top |
[ %~ ] Modulo
Performs a modulo operation using the values of two signals and outputs the result. inlet 1: dividend inlet 2: divisor outlet: remainder argument: divisor | source index top |
[ <=~ ] Less Than or Equal
Performs a logical less than or equal comparison of two signals and outputs 1 or 0. inlet 1: value a inlet 2: value b outlet: result argument: value b | source index top |
[ <~ ] Less Than
Performs a logical less than comparison of two signals and outputs 1 or 0. inlet 1: value a inlet 2: value b outlet: result argument: value b | source index top |
[ ==~ ] Equal
Performs a logical equal comparison of two signals and outputs 1 or 0. inlet 1: value a inlet 2: value b outlet: result argument: value b | source index top |
[ >=~ ] Greater Than or Equal
Performs a logical greater than or equal comparison of two signals and outputs 1 or 0. inlet 1: value a inlet 2: value b outlet: result argument: value b | source index top |
[ >~ ] Greater Than
Performs a logical greater than comparison of two signals and outputs 1 or 0. inlet 1: value a inlet 2: value b outlet: result argument: value b | source index top |
[ ||~ ] Or
Performs a logical or comparison of two signals and outputs 1 or 0. inlet 1: value a inlet 2: value b outlet: result argument: value b | source index top |
[ amptodb~ ] Amplitude to Decibels
Converts amplitude values to dB-FS decibel values. inlet: amplitude outlet: decibels | source index top |
[ amptomag~ ] Amplitude to Magnitude
Converts amplitude values to magnitude values. inlet 1: amplitude inlet 2: overlap factor outlet: magnitude argument: overlap factor | source index top |
[ binindex~ ] Bin Index
Outputs ascending values from zero to block size minus one for each signal block. outlet: ascending sample indices | source index top |
[ binmax~ ] bin maximum
Outputs the maximum sample value in block a, the associated sample value in block b, and the index location of samples a and b for each signal block. inlet 1: signal block a inlet 2: signal block b outlet 1: maximum a value outlet 2: associated b value outlet 3: index of a and b values | source index top |
[ binmin~ ] Bin Minimum
Outputs the minimum sample value in block a, the associated sample value in block b, and the index location of samples a and b for each signal block. inlet 1: signal block a inlet 2: signal block b outlet 1: minimum a value outlet 2: associated b value outlet 3: index of a and b values | source index top |
[ binmix~ ] Bin Mixer
Mixes inlet 2 values for all matching inlet 1 values. Mixed values are placed into location of largest inlet 2 value and all others are zeroed. Operates on one signal vector at a time. inlet 1: a values inlet 2: b values outlet 1: mixed a values outlet 2: mixed b values | source index top |
[ binmonitor~ ] Bin Monitor
Outputs a float representing the value of a specific sample index in the signal vector once per block. Useful for looking at values of particular bins in spectral data. inlet 1: spectral data inlet 2: bin number outlet: bin value float argument: bin number | source index top |
[ binsort~ ] Bin Sort
Sorts Spectral data according to left inlet values and outputs the data in ascending or descending order. inlet 1: dataset a inlet 2: dataset b outlet 1: sorted dataset a outlet 2: dataset b sorted by a outlet 3: dataset indices sorted by a messages: "ascending" or "descending" arguments: "ascending" or "descending" | source index top |
[ bintrim~ ] Bin Trim
Zeroes spectral data outside of a specified bin range. inlet 1: spectral data a inlet 2: spectral data b inlet 3: lower bin number inlet 4: upper bin number outlet 1: trimmed data a outlet 2: trimmed data b arguments: lower bin, upper bin | source index top |
[ bitsafe~ ] Bit Safe
Detects infinity or not a number values and replaces them with float or zero values. inlet: value outlet: result | source index top |
[ blocksmooth~ ] Block Smooth
Replaces zero values within a signal vector with preceding adjacent non-zero values. inlet: rough signal outlet: smooth signal | source index top |
[ cartoamp~ ] Cartesian to Amplitude
Converts cartesian coordinates to amplitude values. inlet 1: real value inlet 2: imaginary value inlet 3: overlap factor outlet: amplitude argument: overlap factor | source index top |
[ cartodb~ ] Cartesian to Decibels
Converts cartesian coordinates to dB-FS decibel values. inlet 1: real value inlet 2: imaginary value inlet 3: overlap factor outlet: decibels argument: overlap factor | source index top |
[ cartofreq~ ] Cartesian to Frequency
Converts cartesian coordinates to magnitude and frequency pairs. inlet 1: real value inlet 2: imaginary value inlet 3: overlap factor outlet 1: magnitude outlet 2: frequency argument: overlap factor | source index top |
[ cartomag~ ] Cartesian to magnitude
Converts cartesian coordinates to magnitude values. inlet 1: real value inlet 2: imaginary value outlet: magnitude | source index top |
[ cartophase~ ] Cartesian to Phase
Converts cartesian coordinates to phase values. inlet 1: real value inlet 2: imaginary value outlet: phase | source index top |
[ cartopolar~ ] Cartesian to Polar
Converts cartesian coordinates to polar coordinates. inlet 1: real value inlet 2: imaginary value outlet 1: magnitude outlet 2: phase | source index top |
[ cmplxabs~ ] Complex Absolute
Calculates the absolute value of a complex number. inlet 1: real value inlet 2: imaginary value outlet: absolute value | source index top |
[ cmplxadd~ ] Complex Addition
Adds two complex numbers and outputs the result. inlet 1: real value a inlet 2: imaginary value a inlet 3: real value b inlet 4: imaginary value b outlet 1: real sum outlet 2: imaginary sum argument 1: real value b argument 2: imaginary value b | source index top |
[ cmplxdiv~ ] Complex Division
Performs complex division and outputs the result. inlet 1: real numerator inlet 2: imaginary numerator inlet 3: real denominator inlet 4: imaginary denominator outlet 1: real result outlet 2: imaginary result argument 1: real denominator argument 2: imaginary denominator | source index top |
[ cmplxmult~ ] Complex Multiplication
Multiplies two complex numbers and outputs the result. inlet 1: real factor a inlet 2: imaginary factor a inlet 3: real factor b inlet 4: imaginary factor b outlet 1: real product outlet 2: imaginary product argument 1: real factor b argument 2: imaginary factor b | source index top |
[ cmplxsqrt~ ] Complex Square Root
Calculates the square root of a complex number and outputs the result. inlet 1: real value inlet 2: imaginary value outlet 1: real result outlet 2: imaginary result | source index top |
[ cmplxsub~ ] Complex Subtraction
Subtracts one complex number form another and outputs the difference. inlet 1: real minuend inlet 2: imaginary minuend inlet 3: real subtrahend inlet 4: imaginary subtrahend outlet 1: real difference outlet 2: imaginary difference argument 1: real subtrahend argument 2: imaginary subtrahend | source index top |
[ countwrap ] Counter Wrap
Counts between minimum and maximum limits using an arbitrary increment value and wraps overflow back into counting range. inlet 1: bang inlet 2: current count inlet 3: increment value inlet 4: minimum value inlet 5: maximum value outlet: count value 1 argument: increment 2 arguments: minimum, maximum 3 arguments: increment, minimum, maximum 4 arguments: count, increment, minimum, maximum | source index top |
[ ctltosig~ ] Control to Signal
Scales values from control range (0 to 1) to signal range (-1 to 1). inlet: control values outlet: signal values | source index top |
[ dbtoamp~ ] Decibels to Amplitude
Converts dB-FS decibel values to amplitude values. inlet: decibels outlet: amplitude | source index top |
[ dbtomag~ ] Decibels to Magnitude
Converts dB-FS decibel values to magnitude values. inlet 1: decibels inlet 2: overlap factor outlet: magnitude argument: overlap factor | source index top |
[ degtorad~ ] Degrees to Radians
Converts degrees to radians. inlet: degrees outlet: radians | source index top |
[ degtoturn~ ] Degrees to Turns
Converts degrees to turns. inlet: degrees outlet: turns | source index top |
[ dspbang~ ] DSP Bang
Outputs a bang when DSP is turned on or when the DSP chain is reconstructed. outlet: bang | source index top |
[ freqsieve~ ] Frequency Sieve
Assigns spectral frequency data to its proper bins based on frequency and magnitude. The frequency of greatest magnitude for each bin is selected and all other frequencies are ignored. An optional "unused" argument causes the object to output the ignored data. inlet 1: magnitude inlet 2: frequency inlet 3: overlap factor outlet 1: magnitude outlet 2: frequency 1 argument: "unused" or overlap factor 2 arguments: "unused" and overlap factor | source index top |
[ freqtocar~ ] Frequency to Cartesian
Converts magnitude and frequency pairs to cartesian coordinates. inlet 1: magnitude inlet 2: frequency inlet 3: overlap factor outlet 1: real values outlet 2: imaginary values argument: overlap factor | source index top |
[ freqtophase~ ] Frequency to Phase
Converts frequency values to phase values for each bin of spectral data. inlet 1: frequency inlet 2: overlap factor outlet: phase (-pi to pi) argument: overlap factor | source index top |
[ freqtopolar~ ] Frequency to Polar
Converts magnitude and frequency pairs to polar coordinates. inlet 1: magnitude inlet 2: frequency inlet 3: overlap factor outlet 1: magnitude outlet 2: phase (-pi to pi) argument: overlap factor | source index top |
[ fundfreq~ ] Fundamental Frequency
Finds the fundamental frequency of greatest magnitude within a specified frequency range. inlet 1: magnitude data inlet 2: phase data inlet 3: lower frequency limit inlet 4: upper frequency limit inlet 5: overlap factor outlet: frequency arguments: low freq, high freq, overlap factor | source index top |
[ harmprod~ ] Harmonic Product Spectrum
Calculates the harmonic product spectrum of an input spectrum. Default harmonic product spectrum uses 4 harmonics (i.e. 4x downsampling) inlet: raw spectrum outlet: harmonic product spectrum argument: number of harmonics message: "set ___" (harmonics) | source index top |
[ magtoamp~ ] Magnitude to Amplitude
Converts magnitude values to amplitude values. inlet 1: magnitude inlet 2: overlap factor outlet: amplitude argument: overlap factor | source index top |
[ magtodb~ ] Magnitude to Decibels
Converts magnitude values to dB-FS decibel values. inlet 1: magnitude inlet 2: overlap factor outlet: decibels argument: overlap factor | source index top |
[ magtrim~ ] Magnitude Trim
Zeroes spectral data outside of a specified magnitude range. inlet 1: spectral data a inlet 2: spectral data b inlet 3: lower magnitude value inlet 4: upper magnitude value outlet 1: trimmed data a outlet 2: trimmed data b arguments: lower magnitude, upper magnitude | source index top |
[ monitor~ ] Monitor
Samples a signal and outputs a float every 20 milliseconds. inlet: signal outlet: float | source index top |
[ oscbank~ ] Oscillator Bank
Generates window-size/2 sinusoids based on input magnitude and frequency pairs. Magnitude and frequency changes are linearly interpolated between block boundaries. inlet 1: magnitude data inlet 2: frequency data inlet 3: overlap factor outlet: sinusoids | source index top |
[ pafft~ ] Phase Aligned FFT
Applies a window function then rotates the signal vector before performing a forward fast fourier transform. inlet 1: audio signal inlet 2: rotation amount in samples outlet 1: real values outlet 2: imaginary values argument: array_name (window array) message: "set array_name" | source index top |
[ paifft~ ] Phase Aligned IFFT
Performs an inverse fast fourier transform then rotates the signal vector, applies a window function, and normalizes output. inlet 1: real values inlet 2: imaginary values inlet 3: rotation amount in samples outlet: audio signal argument: array_name (window array) message: "set array_name" | source index top |
[ partconv~ ] Partitioned Convolution
Performs partitioned convolution using cartesian coordinates with a convolution kernel stored in an external array. inlet 1: real values inlet 2: imaginary values outlet 1: convolved real values outlet 2: convolved imaginary values message: "set kernel_array_name" argument: kernel_array_name | source index top |
[ peaks~ ] Peaks
Finds peaks in inlet 1 spectral data, outputs peak values and associated data from inlet 2. Optionally detects an arbitrary number of highest peaks. inlet 1: spectral data a inlet 2: spectral data b inlet 3: number of peaks outlet 1: data a peaks outlet 2: associated data b argument: number of peaks | source index top |
[ phaseaccum~ ] Phase Accumulate
Calculates running sums of successive FFT frame phases for each bin. inlet: spectral phase data outlet: accumulated phase data | source index top |
[ phasedelta~ ] Phase Delta
Calculates phase deviation between successive FFT frames for each bin. inlet: spectral phase data outlet: phase delta data | source index top |
[ phasetofreq~ ] Phase to Frequency
Converts phase values to frequency values for each bin of spectral data. inlet 1: frequency inlet 2: overlap factor outlet: phase (-pi to pi) argument: overlap factor | source index top |
[ piwrap~ ] Pi Wrap
Wraps a signal between -pi and pi. inlet 1: phase outlet: wrapped phase | source index top |
[ polartocar~ ] Polar to Cartesian
Converts polar coordinates to cartesian coordinates. inlet 1: magnitude inlet 2: phase outlet 1: real value outlet 2: imaginary value | source index top |
[ polartofreq~ ] Polar to Frequency
Converts polar coordinates to magnitude and frequency pairs. inlet 1: magnitude inlet 2: phase inlet 3: overlap factor outlet 1: magnitude outlet 2: frequency argument: overlap factor | source index top |
[ radtodeg~ ] Radians to Degrees
Converts radians to degrees. inlet: radians outlet: degrees | source index top |
[ radtoturn~ ] Radians to Turns
Converts radians to turns. inlet: radians outlet: turns | source index top |
[ recip~ ] Reciprocal
Calculates reciprocal values. inlet: signal outlet: reciprocal | source index top |
[ rgbtable ] RGB Table
Outputs red, green, and blue values between 0 and 1 based on an input value between 0 and 1, according to the selected color scheme (default RGB). inlet 1: float outlet 1: red float outlet 2: green float outlet 3: blue float argument: color scheme message: color scheme | source index top |
[ rotate~ ] Rotate
Rotates a signal vector by an arbitrary number of samples. inlet 1: signal vector inlet 2: rotation amount outlet: rotated signal argument: rotation amount | source index top |
[ rounder~ ] Rounder
Rounds signal values to arbitrary precision of up to 8 decimal places. Default is zero decimal places. inlet 1: signal inlet 2: precision outlet: rounded signal argument: precision | source index top |
[ scale~ ] Scale
Scales a signal from one range to another. inlet 1: signal inlet 2: input minimum inlet 3: input maximum inlet 4: output minimum inlet 5: output maximum outlet: scaled signal arguments: in minimum, in maximum, out minimum, out maximum | source index top |
[ sigtoctl~ ] Signal to Control
Scales values from signal range (-1 to 1) to control range (0 to 1). inlet: signal values outlet: control values | source index top |
[ softclip~ ] Soft Clipping
Applies the polynomial waveshaping function: y[n] = ( 3x[n] / 2 ) - ( x[n]^3 / 2 ) inlet: signal outlet: smoothly clipped signal | source index top |
[ tabindex~ ] Table Index
Writes signal values into a table at arbitrary locations and optionally clears the array at the start of each signal vector. inlet 1: signal inlet 2: sample index arguments: array_name, clear message: "clear x" (where x is 0 or 1; sets clear behavior) message: "set array_name" message: "bang" (redraws array) | source index top |
[ terminal ] Terminal
Sends messages to an instance of the operating system's command line shell and outputs the results. (mac/linux only) inlet: commands outlet: results | source index top |
[ trunc~ ] Truncate
Truncates signal values to arbitrary precision of up to 8 decimal places. Default is zero decimal places. inlet 1: signal inlet 2: precision outlet: truncated signal argument: precision | source index top |
[ turntodeg~ ] Turns to Degrees
Converts turns to degrees. inlet: turns outlet: degrees | source index top |
[ turntorad~ ] Turns to Radians
Converts turns to radians. inlet: turns outlet: radians | source index top |
[ valleys~ ] Valleys
Finds valleys in inlet 1 spectral data, outputs valley values and associated data from inlet 2. Optionally detects an arbitrary number of highest valleys. inlet 1: spectral data a inlet 2: spectral data b inlet 3: number of valleys outlet 1: data a valleys outlet 2: associated data b argument: number of valleys | source index top |
[ windower ] Windower
Writes normalized window functions into arrays. inlet: control messages arguments: array_name, window_type, parameter message: "set array_name" message: "window_type" message: "window_type parameter" window types: bartlett-hann, blackman, blackman-harris, blackman-nuttall, cosine, gaussian, hann, hanning, hann-poisson, hamming, kaiser, lanczos, nuttall, poisson, rectangle, sine, triangle, tukey parametric windows: blackman, gaussian, hann-poisson, kaiser, poisson, tukey | source index top |
[ winfft~ ] Windowed FFT
Applies a window function then performs a fast fourier transform. inlet 1: audio signal outlet 1: real values outlet 2: imaginary values argument: array_name (window array) message: "set array_name" | source index top |
[ winifft~ ] Windowed IFFT
Performs an inverse fast fourier transform then applies a window function and normalizes output. inlet 1: real values inlet 2: imaginary values outlet: audio signal argument: array_name (window array) message: "set array_name" | source index top |