A Signal is a FloatArray that represents a sampled function of time buffer. Signals support math operations.
Fill a Signal of the given size with a sum of sines at the given amplitudes and phases. The Signal will be normalized.
size |
the number of samples in the Signal. |
amplitudes |
an Array of amplitudes for each harmonic beginning with the fundamental. |
phases |
an Array of phases in radians for each harmonic beginning with the fundamental. |
Fill a Signal of the given size with a sum of Chebyshev polynomials at the given amplitudes. For eventual use in waveshaping by the Shaper ugen; see Shaper helpfile and Buffer:cheby too.
size |
the number of samples in the Signal. |
amplitudes |
an Array of amplitudes for each Chebyshev polynomial beginning with order 1. |
normalize |
a Boolean indicating whether to normalize the resulting Signal. If the zeroOffset argument is true, the normalization is done for use as a transfer function, using normalizeTransfer, otherwise it just uses normalize to make the absolute peak value 1. Default is true. |
zeroOffset |
a Boolean indicating whether to offset the middle of each polynomial to zero. If true, then a zero input will always result in a zero output when used as a waveshaper. If false, then the "raw" (unshifted) Chebyshev polynomials are used. Default is false. |
Fill a Signal of the given size with a Hanning window.
size |
the number of samples in the Signal. |
pad |
the number of samples of the size that is zero padding. |
Fill a Signal of the given size with a Hamming window.
Signal.hammingWindow
had incorrect coefficients. To get the old behavior back, use Signal.hammingWindow_old
.size |
the number of samples in the Signal. |
pad |
the number of samples of the size that is zero padding. |
Fill a Signal of the given size with a Welch window.
size |
the number of samples in the Signal. |
pad |
the number of samples of the size that is zero padding. |
Fill a Signal of the given size with a rectangular window.
size |
the number of samples in the Signal. |
pad |
the number of samples of the size that is zero padding. |
Fourier Transform: Fill a Signal with the cosine table needed by the FFT methods. See also the instance methods -fft and -ifft.
This used to be Signal.hammingWindow
, but the coefficients were incorrect (making it a different window in the generalized Hamming window family). It is provided to assist in porting code to 3.11 and later.
For more information, check out the Guide: ExtraWindows
Fill a Signal of the given size with a Bartlett/triangular window.
size |
the number of samples in the Signal. |
pad |
the number of samples of the size that is zero padding. |
sym |
a Boolean indicating whether the window is symmetric or periodic. Default is false. |
Fill a Signal of the given size with a Blackman-Harris window.
size |
the number of samples in the Signal. |
pad |
the number of samples of the size that is zero padding. |
sym |
a Boolean indicating whether the window is symmetric or periodic. Default is false. |
Fill a Signal of the given size with a Blackman-Nuttall window.
size |
the number of samples in the Signal. |
pad |
the number of samples of the size that is zero padding. |
sym |
a Boolean indicating whether the window is symmetric or periodic. Default is false. |
Fill a Signal of the given size with a Gaussian window.
size |
the number of samples in the Signal. |
pad |
the number of samples of the size that is zero padding. |
a |
the inverse of standard deviation (width) of the Gaussian. Higher means narrower; analogous to quality factor. |
sym |
a Boolean indicating whether the window is symmetric or periodic. Default is false. |
Fill a Signal of the given size with a Hanning window. Overwrote SCClassLibrary to have the symmetry argument.
size |
the number of samples in the Signal. |
pad |
the number of samples of the size that is zero padding. |
sym |
a Boolean indicating whether the window is symmetric or periodic. Default is false. |
Fill a Signal of the given size with a Hamming window. Overwrote SCClassLibrary to have the symmetry argument.
size |
the number of samples in the Signal. |
pad |
the number of samples of the size that is zero padding. |
sym |
a Boolean indicating whether the window is symmetric or periodic. Default is false. |
Synonymous with hanningWindow method with the extra symmetry argument.
size |
the number of samples in the Signal. |
pad |
the number of samples of the size that is zero padding. |
sym |
a Boolean indicating whether the window is symmetric or periodic. Default is false. |
Fill a Signal of the given size with a Kaiser window.
size |
the number of samples in the Signal. |
pad |
the number of samples of the size that is zero padding. |
a |
the alpha value. Reduces to rectangular window at zero and narrows at higher values. Parameterized as described here: https://ccrma.stanford.edu/~jos/sasp/Kaiser_Window.html |
sym |
a Boolean indicating whether the window is symmetric or periodic. Default is false. |
Fill a Signal of the given size with a Lanczos window.
size |
the number of samples in the Signal. |
pad |
the number of samples of the size that is zero padding. |
sym |
a Boolean indicating whether the window is symmetric or periodic. Default is false. |
Fill a Signal of the given size with a Tukey window (tapered-cosine window).
size |
the number of samples in the Signal. |
pad |
the number of samples of the size that is zero padding. |
a |
the alpha value. At 0, reduces to Hann window. At 1, reduces to rectangular. Default to 0.5. |
sym |
a Boolean indicating whether the window is symmetric or periodic. Default is false. |
Fourier Transform: Fill a Signal with the cosine table needed by the Real-FFT methods. See also the instance methods -rfft and -irfft.
Fourier Transform: Fill a Signal with the cosine table needed by the Real-FFT-Two methods. See also the instance methods -rfftTwo and -irfftTwo.
Fill a Signal of the given size with a sum of cosines at the given amplitudes and phases. The Signal will be normalized.
size |
the number of samples in the Signal. |
amplitudes |
an Array of amplitudes for each harmonic beginning with the fundamental. |
phases |
an Array of phases in radians for each harmonic beginning with the fundamental. |
Fill a Signal of the given size with a sum of Hann enveloped cosines at the given amplitudes and phases. The Signal will be normalized.
size |
the number of samples in the Signal. |
amplitudes |
an Array of amplitudes for each harmonic beginning with the fundamental. |
phases |
an Array of phases in radians for each harmonic beginning with the fundamental. |
Fill a Signal of the given size with zeros. A synonym for *newClear.
size |
the number of samples in the Signal. |
Read a soundfile.
path |
a String representing the path of the soundfile to be read. |
size |
the number of samples. If size is |
startFrame |
the first frame of the soundfile to read. The default is 0, which is the beginning of the file. May be a negative number, which indicates the number of zeros to fill before reading the soundfile. |
channel |
soundfile channel to read. The default is 0, the first channel. |
Read a periodic waveform from a soundfile.
path |
a String representing the path of the soundfile to be read. |
size |
the number of samples. If size is |
frame |
center frame of the soundfile about which to read. I.e., the synthesis window is centered on this frame. The default is 0, which is the beginning of the file. |
channel |
soundfile channel to read. The default is 0, the first channel. |
freq |
analysis frequency of the waveform, in Hz. The default is 440 Hz. |
alpha |
Kaiser window alpha. The default is 3. |
winScale |
power of two scaling coefficient for the window size. The default is 1. |
freq
Successful synthesis of a periodic waveform from a soundfile depends largely on closely estimating the frequency of the waveform. The folding frequency of the Kaiser synthesis window is mapped to this analysis frequency.
alpha
Time domain smoothing is directly specified by the Kaiser window alpha. Choosing alpha = 0; winScale = 0
specifies a rectangular window, and allows us to view an unsmoothed period of the source waveform. Higher values of alpha mean more time domain smoothing.
winScale
The window scale argument scales the Kaiser window folding frequency with respect to the period of the waveform, like this:
winScale | waveform periods |
1 | 2 |
0 | 1 |
-1 | 0.5 |
The default, winScale = 1
, is optimimal in the sense that frequency domain artifacts are relected furthest from the harmonics of the periodic waveform of interest, without excessive oversampling.
Read a Hann enveloped wave packet from a soundfile.
path |
a String representing the path of the soundfile to be read. |
size |
the number of samples. If size is |
frame |
center frame of the soundfile about which to read. I.e., the synthesis window is centered on this frame. The default is 0, which is the beginning of the file. |
channel |
soundfile channel to read. The default is 0, the first channel. |
freq |
analysis frequency of the waveform, in Hz. The default is 440 Hz. |
alpha |
Kaiser window alpha. The default is 3. |
winScale |
power of two scaling coefficient for the window size. The default is 1. |
See *readWave discussion above.
Return a rectangular windowed sinc filter kernel.1
size |
the number of samples in the Signal. |
freq |
the cutoff frequeny, in Hz. |
sampleRate |
sample rate, in Hz. |
Return a log shelf filter kernel.2 See also: FreqSpectrum: *logShelf.
size |
the number of samples in the Signal. | ||||
freq0 |
the frequeny, at which to begin transition from gainDC to gainNy, in Hz. | ||||
freq1 |
the frequeny, at which to end transition from gainDC to gainNy, in Hz. | ||||
gainDC |
the gain at DC, in dB. | ||||
gainNy |
the gain at Nyquist, in dB. | ||||
phase |
phase response.
| ||||
sampleRate |
sample rate, in Hz. |
Return an Array of gaussian windowed filter kernels.
size |
the number of samples in the Signals. | ||||||
freqs |
the cross-over frequenies, in Hz. | ||||||
alpha |
window smoothing coefficient
| ||||||
sampleRate |
sample rate, in Hz. |
Return gaussian white noise, with a mean of 0 and standard deviation of 1.
See also SimpleNumber: -gauss.
size |
the number of samples in the Signal. |
Return periodic power-law noise, aka fractional noise. Magnitude at Nyquist is normalized to 1.
size |
the number of samples in the Signal. | ||||||||||||||||||
beta |
power spectral density.
|
Return a rectangular windowed sinus power-law chirp.3
size |
the number of samples in the Signal. | ||||||||||||||||||
freq0 |
initial frequeny, in Hz. | ||||||||||||||||||
freq1 |
final frequeny, in Hz. | ||||||||||||||||||
phase |
initial phase, in radians. | ||||||||||||||||||
beta |
power spectral density.
| ||||||||||||||||||
sampleRate |
sample rate, in Hz. |
Synthesized in the time domain.
Return a rectangular windowed sinus power-law chirp.
size |
the number of samples in the Signal. | ||||||||||||||||||
freq0 |
initial frequeny, in Hz. | ||||||||||||||||||
freq1 |
final frequeny, in Hz. | ||||||||||||||||||
phase |
initial phase, in radians. | ||||||||||||||||||
beta |
power spectral density.
| ||||||||||||||||||
sampleRate |
sample rate, in Hz. |
Synthesized in the time domain.
Return a rectangular windowed complex analytic sinus power-law chirp.
size |
the number of samples in the Signal. | ||||||||||||||||||
freq0 |
initial frequeny, in Hz. | ||||||||||||||||||
freq1 |
final frequeny, in Hz. | ||||||||||||||||||
phase |
initial phase, in radians. | ||||||||||||||||||
beta |
power spectral density.
| ||||||||||||||||||
sampleRate |
sample rate, in Hz. |
Synthesized in the time domain.
Return a complex analytic Signal of the given size with a sum of cosines and a sum of sines at the given amplitudes and phases. The Signal will be normalized.
size |
the number of samples in the Signal. |
amplitudes |
an Array of amplitudes for each harmonic beginning with the fundamental. |
phases |
an Array of phases in radians for each harmonic beginning with the fundamental. |
Hilbert Transform: Return complex Hilbert Transform coefficients.
size |
the number of samples in the Signal. |
pad |
the number of samples of the size that is zero padding. |
sym |
a Boolean indicating whether the window is symmetric or periodic. Default is false. |
Return an Array of Higher Order Ambisonic signal (HOA) near-field effect (NFE), distance radial filters collected by Associated Legendre degree (ℓ).
size |
The number of samples in the Signals. |
radius |
Radius, in meters. |
order |
Ambisonic order. |
sampleRate |
Sample rate, in Hz. |
speedOfSound |
Speed of sound, in meters per second. |
Offers FIR coefficients, equivalent to the IIR coefficients returned by NFECoeffs: -dist. Implemented as a frequency sampling design, with coefficients returned by HoaOrder: -distWeights. See also: FreqSpectrum: *hoaDist.
Return an Array of Higher Order Ambisonic signal (HOA) near-field effect (NFE), control radial filters collected by Associated Legendre degree (ℓ).
size |
The number of samples in the Signals. |
encRadius |
Encoding radius, in meters. |
decRadius |
Decoding radius, in meters. |
order |
Ambisonic order. |
sampleRate |
Sample rate, in Hz. |
speedOfSound |
Speed of sound, in meters per second. |
Offers FIR coefficients, equivalent to the IIR coefficients returned by NFECoeffs: -ctrl. Implemented as a frequency sampling design, with coefficients returned by HoaOrder: -ctrlWeights. See also: FreqSpectrum: *hoaCtrl.
Return an Array of Higher Order Ambisonic signal (HOA) near-field effect (NFE), focalisation radial filters collected by Associated Legendre degree (ℓ).
size |
The number of samples in the Signals. | ||||||||
radius |
Radius, in meters. | ||||||||
order |
Ambisonic order. | ||||||||
window |
Angular weighting window.
| ||||||||
sampleRate |
Sample rate, in Hz. | ||||||||
speedOfSound |
Speed of sound, in meters per second. |
Offers FIR coefficients; implemented as a linear phase frequency sampling design, with coefficients returned by HoaOrder: -foclWeights. See also: FreqSpectrum: *hoaFocl.
Return an Array of Higher Order Ambisonic signal (HOA) filters combining multi-band beamforming and near-field effect (NFE) focalisation, collected by Associated Legendre degree (ℓ).
size |
The number of samples in the Signals. | ||||||
radius |
Radius, in meters. Set to | ||||||
beamDict |
A dictionary specifying beam shapes and edge frequencies. See Beaming & Decoder Matching and discussion below. | ||||||
dim |
The number of dimensions: 2D or 3D. | ||||||
match |
Matching criteria, see Beaming & Decoder Matching:
NOTE: Prepend f to include focalisation in normalisation. E.g., \frms . | ||||||
numChans |
Number of loudspeakers. NOTE: Must be set when choosing match: \energy . | ||||||
order |
Ambisonic order. | ||||||
window |
Focalisation angular weighting window. See *hoaFocl. NOTE: Ignored if radius is set to nil . | ||||||
sampleRate |
Sample rate, in Hz. | ||||||
speedOfSound |
Speed of sound, in meters per second. |
Offers FIR coefficients; implemented as a linear phase frequency sampling design, with coefficients returned by *logShelf and *hoaFocl. See also: FreqSpectrum: *hoaMultiBandFocl for design examples.
Plot the Signal in a window. The arguments are not required and if not given defaults will be used.
For details, see plot
Loads the signal into a buffer on the server and plays it. Returns the buffer so you can free it again.
loop |
A Boolean whether to loop the entire signal or play it once. Default is false. |
mul |
volume at which to play it, 0.2 by default. |
numChannels |
if the signal is an interleaved multichannel file, number of channels, default is 1. |
server |
the server on which to load the signal into a buffer. |
Fill the Signal with a function evaluated over an interval.
function |
a function that should calculate the value of a sample. The function is called with three arguments:
As arguments, three values are passed to the function: the current input value (abscissa), the old value (if the signal is overwritten), and the index. |
start |
the starting value of the interval. |
end |
the ending value of the interval. |
Convert the Signal into a Wavetable.
Fill the Signal with a value.
Scale the Signal by a factor in place.
Offset the Signal by a value in place.
Return the peak absolute value of a Signal.
Normalize the Signal in place such that the maximum absolute peak value is 1.
Normalizes a transfer function so that the center value of the table is offset to zero and the absolute peak value is 1. Transfer functions are meant to be used in the Shaper ugen.
Invert the Signal in place.
Reverse a subrange of the Signal in place.
Fade a subrange of the Signal in place.
Return the integral of a signal.
Add a signal to myself starting at the index. If the other signal is too long only the first part is overdubbed.
Write a signal to myself starting at the index. If the other signal is too long only the first part is overdubbed.
Blend two signals by some proportion.
Perform an FFT on a real and imaginary signal in place. See also the class method *fftCosTable.
Perform an inverse FFT on a real and imaginary signal in place. See also the class method *fftCosTable.
Return a complex Real-FFT spectrum from a complex FFT spectrum. See also the instance method -rfftToFft.
Perform a Real-FFT on a real signal.8 See also the class method *rfftCosTable.
Perform an inverse Real-FFT on a real and imaginary signal. See also the class method *rfftCosTable.
Return a complex FFT spectrum from a complex Real-FFT spectrum. See also the instance method -fftToRfft.
Perform a Real-FFT on two real signals. See also the class method *rfftTwoCosTable.
Perform an inverse Real-FFT on two real and imaginary signals. See also the class method *rfftTwoCosTable.
Perform a DFT on a real and imaginary signal.
size
is not restricted to a power of two.imag |
imaginary signal. | ||||
method |
|
Perform an inverse DFT on a real and imaginary signal.
size
is not restricted to a power of two.imag |
imaginary signal. | ||||
method |
|
Perform a Zoom DFT on a real and imaginary signal.
Signal.size
is not restricted to a power of two.imag |
imaginary signal. |
zoomsize |
the number of coefficients to return. |
k0 |
lowest DFT coefficient. Not required to be an integer. |
k1 |
highest DFT coefficient. Not required to be an integer. |
Perform a Zoom DFT on a real signal.
Signal.size
is not restricted to a power of two.zoomsize |
the number of coefficients to return. |
k0 |
lowest DFT coefficient. Not required to be an integer. |
k1 |
highest DFT coefficient. Not required to be an integer. |
Return individual terms of a DFT on a real and imaginary signal.9
Signal.size
is not restricted to a power of two.imag |
imaginary signal. | ||||||
k |
DFT coefficient(s) as a single value or an Array. Not required to be an integer. | ||||||
method |
|
Return individual terms of a DFT on a real signal.
Signal.size
is not restricted to a power of two.k |
DFT coefficient(s) as a single value or an Array. Not required to be an integer. | ||||||
method |
|
Signal will respond to unary operators by returning a new Signal.
The flip operator.10
Signal will respond to binary operators by returning a new Signal.
Thresholding replaces every value < threshold with 0.
Bilateral thresholding.
thresh |
When the |
adverb |
Optional, for processing Collections. See Adverbs for Binary Operators. |
Add a single cosine to myself with the given harmonic, amplitude and phase.
A sum of cosines with the given amplitudes and phases, returned in place.
amplitudes |
an Array of amplitudes for each harmonic beginning with the fundamental. |
phases |
an Array of phases in radians for each harmonic beginning with the fundamental. |
A sum of cosines with the given harmonics, amplitudes and phases, returned in place.
list |
a rank 2 collection containing harmonic numbers, amplitudes and phases. |
A sum of Hann enveloped cosines at the given amplitudes and phases, returned in place.
amplitudes |
an Array of amplitudes for each harmonic beginning with the fundamental. |
phases |
an Array of phases in radians for each harmonic beginning with the fundamental. |
A sum of Hann enveloped cosines with the given harmonics, amplitudes and phases, returned in place.
list |
a rank 2 collection containing harmonic numbers, amplitudes and phases. |
Given a periodic waveform, returns a Hann enveloped wave packet. The receiver is unchanged.
Given a superposition density window, returns a constant-overlap-add (COLA) window.11 The receiver is unchanged.
Returns a new Signal whose elements are repeated sequences of the receiver, up to size length. The receiver is unchanged.
Returns a new Signal resampled in the frequency domain to a new size. The receiver is unchanged.
Remove the DC component the Signal in place.
Writes the entire Signal to a file, where every chunk of four bytes is a 32-bit floating point sample.
Writes the entire Signal to a soundfile.
path |
a String representing the path of the soundfile to be written. |
headerFormat |
a String for the soundfile format. Valid strings are listed at SoundFile: -headerFormat. If not given, the default |
sampleFormat |
a String for the sample format. Valid strings are listed at SoundFile: -sampleFormat. If not given, the default |
sampleRate |
an Integer sample rate (44100 by default). |
Convolve myself with a signal.
aSignal |
the multiplier. | ||||||
method |
|
Periodic convolve myself with a signal.
aSignal |
the multiplier. | ||||||
method |
|
Partition convolve myself with a signal.
aSignal |
the multiplier. | ||||||
size |
the partition size. | ||||||
method |
|
Hilbert Transform: Return a complex analytic signal from a real signal.12
Return the instantaneous frequency from a real signal.13
mindb |
a minimum value in dB to clip amplitude response to. Prevents singularities. |
sampleRate |
sample rate, in Hz. |
Return a complex signal with the given real and imaginary parts.
Rotate the Signal by a value in radians, in place.
Rotate the phase of Signal by a value in radians, in place.
Return a linear phase kernel, preserving the magnitude, in place.
sym |
a Boolean indicating whether the window is symmetric or periodic. Default is false. |
Return a minimum phase kernel, preserving the magnitude, in place.14
mindb |
a minimum value in dB to clip amplitude response to. Reduces time aliasing. |
oversample |
time oversampling scale factor. May be a float or an integer. Reduces time aliasing. |
Return a gaussian noise phase kernel, preserving the magnitude, in place.
Return the even part of a signal.15
Return the odd part of a signal.
Return the RMS of a signal.
Return the peak of the frequency domain magnitude of a signal.
oversample |
time oversampling scale factor. May be a float or an integer. |
Normalize the Signal in place such that the maximum magnitude in the frequency domain is 1.
oversample |
time oversampling scale factor. May be a float or an integer. |
Return the real part of the cepstrum of a real signal.16
Return the real part of the inverse of the real part of the cepstrum.
Perform a Chirp z-Transform on a real and imaginary signal.17
imag |
imaginary signal. |
cwtsize |
the number of coefficients to return. Defaults to |
step |
ratio between points along the z-plane spiral contour of interest. Defaults to |
start |
complex starting point on that contour. Defaults to NOTE: The default nil values of cwtsize , step , and start return the DFT. |
Perform a Chirp z-Transform on a real signal.
cwtsize |
the number of coefficients to return. Defaults to |
step |
ratio between points along the z-plane spiral contour of interest. Defaults to |
start |
complex starting point on that contour. Defaults to NOTE: The default nil values of cwtsize , step , and start return the DFT. |