Signal:
Filter:
Classes | Collections > Ordered

Signal : FloatArray : RawArray : ArrayedCollection : SequenceableCollection : Collection : Object

Sampled audio buffer
Source: Signal.sc

Description

A Signal is a FloatArray that represents a sampled function of time buffer. Signals support math operations.

Class Methods

Signal.sineFill(size, amplitudes, phases)

Fill a Signal of the given size with a sum of sines at the given amplitudes and phases. The Signal will be normalized.

Arguments:

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.

Signal.chebyFill(size, amplitudes, normalize: true, zeroOffset: false)

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.

Arguments:

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.

Discussion:

NOTE: In previous versions, chebyFill always offset the curves to ensure the center value was zero. The zeroOffset argument was added in version 3.7, and the default behavior was changed, so that it no longer offsets.

Signal.hanningWindow(size, pad: 0)

Fill a Signal of the given size with a Hanning window.

Arguments:

size

the number of samples in the Signal.

pad

the number of samples of the size that is zero padding.

Signal.hammingWindow(size, pad: 0)

Fill a Signal of the given size with a Hamming window.

WARNING: In versions of SuperCollider before 3.11, the implementation of Signal.hammingWindow had incorrect coefficients. To get the old behavior back, use Signal.hammingWindow_old.

Arguments:

size

the number of samples in the Signal.

pad

the number of samples of the size that is zero padding.

Signal.welchWindow(size, pad: 0)

Fill a Signal of the given size with a Welch window.

Arguments:

size

the number of samples in the Signal.

pad

the number of samples of the size that is zero padding.

Signal.rectWindow(size, pad: 0)

Fill a Signal of the given size with a rectangular window.

Arguments:

size

the number of samples in the Signal.

pad

the number of samples of the size that is zero padding.

Signal.fftCosTable(fftsize)

Fourier Transform: Fill a Signal with the cosine table needed by the FFT methods. See also the instance methods -fft and -ifft.

Signal.hammingWindow_old(size, pad: 0)

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.

Inherited class methods

Undocumented class methods

Signal.readNew(file)

Instance Methods

.plot(name, bounds, discrete: false, numChannels, minval, maxval, separately: true)

From superclass: ArrayedCollection

Plot the Signal in a window. The arguments are not required and if not given defaults will be used.

For details, see plot

.play(loop: false, mul: 0.2, numChannels: 1, server)

Loads the signal into a buffer on the server and plays it. Returns the buffer so you can free it again.

Arguments:

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.

.waveFill(function, start: 0.0, end: 1.0)

Fill the Signal with a function evaluated over an interval.

Arguments:

function

a function that should calculate the value of a sample.

The function is called with three arguments:

x
the value along the interval.
old
the old value (if the signal is overwritten)
i
the sample index.

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.

.asWavetable

Convert the Signal into a Wavetable.

.fill(val)

Fill the Signal with a value.

.scale(scale)

Scale the Signal by a factor in place.

.offset(offset)

Offset the Signal by a value in place.

.peak

Return the peak absolute value of a Signal.

.normalize(beginSamp: 0, endSamp)

Normalize the Signal in place such that the maximum absolute peak value is 1.

.normalizeTransfer

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(beginSamp: 0, endSamp)

Invert the Signal in place.

.reverse(beginSamp: 0, endSamp)

Reverse a subrange of the Signal in place.

.fade(beginSamp: 0, endSamp, beginLevel: 0.0, endLevel: 1.0)

Fade a subrange of the Signal in place.

.integral

Return the integral of a signal.

.overDub(aSignal, index: 0)

Add a signal to myself starting at the index. If the other signal is too long only the first part is overdubbed.

.overWrite(aSignal, index: 0)

Write a signal to myself starting at the index. If the other signal is too long only the first part is overdubbed.

.blend(that, blendFrac: 0.5)

Blend two signals by some proportion.

Fourier Transform

.fft(imag, cosTable)

Perform an FFT on a real and imaginary signal in place. See also the class method *fftCosTable.

.ifft(imag, cosTable)

Perform an inverse FFT on a real and imaginary signal in place. See also the class method *fftCosTable.

Unary Messages

Signal will respond to unary operators by returning a new Signal.

.neg

.abs

.sign

.squared

.cubed

.sqrt

.exp

.log

.log2

.log10

.sin

.cos

.tan

.asin

.acos

.atan

.sinh

.cosh

.tanh

.distort

.softclip

.isPositive

From superclass: SequenceableCollection

.isNegative

From superclass: SequenceableCollection

.isStrictlyPositive

From superclass: SequenceableCollection

Binary Messages

Signal will respond to binary operators by returning a new Signal.

+(aNumber)

-(aNumber)

*(aNumber)

/(aNumber)

.div(aNumber)

.pow(aNumber)

.mod(aNumber)

.min(aNumber)

.max(aNumber)

.ring1(aNumber)

.ring2(aNumber)

.ring3(aNumber)

.ring4(aNumber)

.difsqr(aNumber)

.sumsqr(aNumber)

.sqrdif(aNumber)

.absdif(aNumber)

.amclip(aNumber)

.scaleneg(aNumber)

.clip2(aNumber: 1)

.wrap2(aNumber: 1)

.excess(aNumber: 1)

%(that)

From superclass: Object

**(that)

From superclass: Object

<!(that)

From superclass: Object

Inherited instance methods

Undocumented instance methods

!=(aNumber)

==(aNumber)

.addChebyshev(harmonicNumber: 1, amplitude: 1.0)

.addSine(harmonicNumber: 1, amplitude: 1.0, phase: 0.0)

.asComplex

.asFloat

.asInteger

.asSignal

.asWavetableNoWrap

.chebyFill(amplitudes, normalize: true, zeroOffset: false)

.chebyFill_old(amplitudes)

.clip(lo, hi)

.fftCosTable

.firstArg(aNumber)

.fold(lo, hi)

.fold2(aNumber: 1)

.hanWindow

.imag

.ramp

.real

.rectWindow

.rotate(n: 1)

.scurve

.sineFill(amplitudes, phases)

.sineFill2(list)

.sqrsum(aNumber)

.thresh(aNumber)

.triWindow

.welWindow

.wrap(lo, hi)

.zeroPad(minSize)