SCMTheory package overview
Goto: [
Modulo Sequences |
FourierTheorems |
Complex Numbers |
Spectral Plots |
Symmetry |
Miscellaneous
]
The Stanford Computer-Music Theory Package for Mathematica
(SCMTheory.m) contains functions to help
visualize and manipulate signals in the time and frequency domains.
In particular, many functions are provided for spectral visualization and
for the handling of complex numbers. The table below lists most of the
functions defined in the package. A short description of each function can
also be found below.
- Alias[modSequence, factor]
- Returns the alias of modSequence by factor. Length of modSequence
divided by factor must be an integer.
- Amplitude[number]
- Gives the absolute value of the number which is the length of a
complex number. Slightly smarter than the Abs function.
- CircularPlot[modSequence, options]
- plots the complex number sequence on the domain of a circle.
Magnitude of number is is the distance from the domain circle to the
plotted points. Angle of the complex number is the angle of the plotted
point on a torroidal ring around the domain circle at the given magnitude
radius. A bandlimited interpolation between points can be added.
Alias: CPlot
- CircularTransformPlot[modSequence,
options]
- is similar to the function CircularPlot, but will plot the
DFT of the sequence as points and an interpolation line using the
DTFT. Alias: CTPlot.
- ComplexSinusoidPlot[minTime, maxTime,
options]
- Plots a Complex Sinusoid and projections onto the real and imaginary
planes. Type Options[ComplexSinusoidPlot] to see the default options.
Alias: CSPlot
- Convolution[modSequence1, modSequence2,
Spectral->True]
- Will convolve the two signals. If Spectral->True, then convolution
will be done by multiplying the individual spectral components of the
two signals and then taking the inverse DFT. If Spectral->False then
convolution will be done in the time domain. Note that the convolution
is circular -- the length of the output sequence is the same as the
input sequences.
- Correlation[modSequence1,
modSequence2]
- Multiplies the conjugate of the DFT of the conjugate of sequence1
by the DFT of sequence 2 and returns the inverse DFT of this spectrum.
- Decimate[modSequence, amount]
- will sample every amount'th value from the modSequence. modSequence
should be divisible by amount+1 or last incomplete multiple of amount
in signal will be dropped. Example: {0,1,2,3} decimated by 1 gives {0,2}.
- DigitalSinc[length, x]
- returns the digital sinc function, where length is the separation
between an infinite number of shifted sinc functions.
- DFTAnalyze[modSequence, options]
- Treats the input sequence as a signal, and plots the signal and
its spectrum. Uses the function RealImaginaryPlot and MagnitudePhasePlot.
- EvenPart[function, variable]
- returns the even part of function with respect to variable. Even +
Odd = original function.
- EvenOddPlot[function, range,
plotOptions...]
- plots the given function as well as plotting the even and odd
parts of the functions over the given range. Options are the same as
for Plot[], plus there is EvenStyle and OddStyle to control the style
of the even and odd function lines. Alias: EOPlot
- EvenOddSinusoidPlot[phaseShift,
plotOptions...]
- plots two cycles of a sine wave with the given phase as a dashed
line along with the cosine (even) and sine (odd) functions with no phase
that add together to give the phase-shifted sine function. Same options
as EvenOddPlot. Alias: EOSPlot
- Flip[modSequence]
- Gives the flip, or reverse, of the modSequence.
Example: Flip[{0,1,2,3,4}] = {0,4,3,2,1}
- HermitianQ[function]
- tests whether the function or sequence or 2-D matrix is hermitian.
- InnerProduct[vector1, vector2]
- Returns sum of vector1 * Conjugate[vector2]. Alias:
IP.
- Interpolate[modSequence, amount,
options...]
- Will stretch the sequence with amount-1 extra samples between the
original samples with band-limted values.
- MagnitudePhasePlot[modSequence,
options]
- plot the magnitude and phase of the input sequenc. Default display
is magnitude in a decibel scale. Uses the functions MagnitudePlot
and PhasePlot.
- MagnitudePlot[modSequence, options]
- plots the Magnitude of a modulo sequence. Uses the same options as
SeqPlot, but adds the option LogScale which plots the y-axis on a decibel
scale if set to True (function assumes that sequence contains amplitudes).
Will take continuous functions like SeqPlot, but will only sample the
functions and not display them.
- NumericIDFT[modSequence]
- Returns the numeric Inverse DFT of the sequence.
- NumericDFT[modSequence]
- Returns the numeric Discrete Fourier Transform of the sequence.
- OddPart[function, variable]
- returns the even part of function with respect to variable. Even +
Odd = original function.
- ParabolaFit[s1, s2, s3, variable:x]
- returns a parabolic function of variable that passes through all
three specified samples and which is centered about the middle sample
ParabolaFit[{x1,y1},{x2,y2},{x3,y3}, variable:x] will return
a parabolic
function of variable for any three arbitrary points.
- ParabolaPeak[s1, s2, s3]
- returns the parabolic extremum point of the parabola
uniquely described by the three input samples. Returns a delta
sample value for the location of the peak from the second sample
ParabolaPeak[{x1,y1},{x2,y2},{x3,y3}] will give the
x-y coordinates of the parabolic maximum (or minimum) of an
arbitrary set of three points.
- ParabolaFitPlot[p1,p2,p3, ShowPlot:False,
plotOptions...]
- plots the specified three points or samples and the fitted parabolic
function. If ShowPlot is not False, then the maximum or minimum of the
parabola is displayed in red (light gray). plotOptions are the plotting
options similar to Plot's options.
- Phase[number]
- Gives the angle of a complex number. Slightly smarter than the
Arg function. For computational simplicity, Phase[0] is
defined as zero eventhough Arg[0] is undefined.
- PhasePlot[modSequence, options]
- Will plot the phase of a sequence. Has similar options as SeqPlot,
but you cannot use the Repeat option. See Options[PhasePlot] for
default options.
- Polar[complexNumber]
- Converts a number or list of numbers to polar form:
Abs[x] Exp[I Arg[x]].
- RealImaginaryPlot[modSequence,
options...]
- plots the real part and imaginary part of a sequence. Uses the
two functions RealPlot and ImaginaryPlot.
- RectForm[number]
- Converts a complex number or list of numbers to rectangular form:
Re[x] + I Im[x]. Alias: CartesianForm.
- ReImPlot[function, range,
plotOptions...]
- plots the real part of the given function as a dashed black
line and the imaginary part as a solid red line over the given range.
Alias: RIPlot
- Repeat[modSequence, repetition]
- Will repeat modSequence by repetition.
Example: Repeat[{1,2,3}, 2] == {1,2,3,1,2,3}
- SampleFunction[function,
{variable, min, max, spacing:1}]
- Samples a function and returns a list of the samples.
- SeqPlot[modSequence, options...]
- plots a modulo sequence as a discrete set of lines.
SeqPlot[function, range, options...] samples the function, with the
possibility of adding the rule Continuous->True to overlay the sampled
function. See Options[SeqPlot] for a list of the default options.
- Shift[modSequence, amount]
- Same as RotateRight[]. Delays a sequence of samples by amount.
Example: Shift[{0,1,2,3}, 1] == {3,0,1,2}
- ShiftToCausal[modSequence]
- Rotates the sequence by half the length. If the length is even,
then the first element in the sequence is interpreted as the most negative
unpaired element. Reverses exactly the process of ShiftToNonCausal.
- ShiftToNonCausal[modSequence]
- Rotates the sequence by half the length. If the length is even,
then the unpaired element at length/2 is interpreted as the most negative
element. Reverses exactly the process of ShiftToCausal.
- SignalFunction[signalList, variable:n,
offset:0]
- Creates an arbitrary signal where each signal element in the list
is an Impulse at time (position+offset), of variable.
- Sinc[x]
- returns the function Sin[π x]/(π x).
- Stretch[modSequence, amount]
- Will stretch a modSequence by amount.
Example: {1,1,1} stretched by 2 = {1,0,1,0,1,0}
- SymbolicDFT[modSequence, variable1:n,
variable2:k]
- Returns the symbolic DFT on the sequence.
- SymbolicInverseDFT[modSequence,
variable1:k, variable2:n]
- Returns a symbolic Inverse DFT of the sequence.
- ZeroPad[modSequence, numZeros]
- will zero-pad a mod sequence with the specified number of zeros. Start of
the signal is assumed to be time 0, and negative time is coming from the
other direction, so zeros are added in the middle of the sequence.