SpHr_SignalGaussian [ Flags ] fs,  destWaveName


Generates a single Gaussian noise (single dimension).


Parameters

fs  Sampling frequency (Hz)


destWaveName  Name of generated wave. The wave is single precision and always overwritten. 


Flags

/Rows = rows

    Length in rows. Same as /Pnts flag. Do not use with /Sec or /ms.


/Pnts = pnts

    Length in points. Same as /Rows flag. Do not use with /Sec or /ms.


/Sec = seconds

    Length in seconds (do not use with /Rows, /Pnts, or /ms flags).


/ms = ms

    Length milliseconds (do not use with /Rows, /Pnts, or /Sec flags).


/dB = db

    Amplitude (RMS re: 20µPa) in decibels (dB = 20*log[Pa/2e-05]).


/Pa = pa

    Amplitude (RMS) in Pascals. Do not use with /dB flag.


/NS = seed

    Value used to seed Mersenne Twister pseudorandom number generator. Copyright (C) 2004, Makoto Matsumoto and Takuji Nishimura, All rights reserved.

    If /NS is omitted or set as 0, a random seed is  generated internally. The variable V_Seed is set to the value of the seed passed or generated internally.

    Passed double precision seeds are converted to signed long long integers but only positive values are used as seeds.

    The arc4random number generator is used whenever a seed is set to a negative number. In these cases, abs(seed) is used.


/Sum [ = sum ]

    Option to sum an existing wave, specified by destWaveName, with the newly generated wave. 

    sum = 0,  destWaveName will be overwritten, same as no /Sum flag.

    sum = 1,  If destWaveName already exists, new values will be summed with destWaveName. Same as /Sum flag alone.


/Buff = {  front_ms [ , back_ms ] }

    front_ms,  length of zero buffer, in milliseconds, added prior to the noise's onset. 

    back_ms,  length of zero buffer, in milliseconds, added after to the noise's offset. If not specified, a buffer equal in length to front_ms is used.


/Ramp = { onset_ms [, offset_ms ] }

    onset_ms,  Hanning onset ramp length in milliseconds. The ramp adds no length to the signal.

    offset_ms,  Hanning offset ramp length in milliseconds. The ramp adds no length to the signal. If not specified, a ramp equal in length to onset_ms is used.


/HP = { cornerHz [ , order ] }

    cornerHz is the high-pass filter corner (-0 dB) frequency specified by cornerHz and order specified by order. For a 'brick-wall' filter, pass order = 0.


/LP = { cornerHz [ , order ] }

    Low-pass filter with corner (-0 dB) frequency specified by cornerHz and order specified by order. For a 'brick-wall' filter, pass order = 0.


/Sp={ spectrum [ , referenceHz ] }

    spectrum = 0,  flat (white) frequency response.

    spectrum = 1,  1/frequency (pink) frequency response.

    When spectrum = 1, referenceHz may be used to specify the reference frequency around which lower and higher magnitude values are scaled. When not specified, a default frequency of 1000 Hz is used.


/Sp = { interpType , units, MagSrcWave [, FreqSrcWave ] }

    interpType = 0,  MagSrcWave values are used to directly scale individual DFT magnitude values. MagSrcWave must have the same DFT-compatible number of points as the signal being generated.

    interpType = 1,  MagSrcWave values are linearly interpolated. Corresponding frequency values can be passed by: (1) the second column of MagSrcWave, (2) a second wave specified by FreqSrcWave, or (3) the x-scaling of MagSrcWave if x values range from zero to fs/2.

    interpType = 2,  MagSrcWave values are interpolated using a cubic spline. This interpolation may fail if < 6 points are interpolated. Corresponding frequency values are passed as described above.

    interpType = 4,  MagSrcWave values are quadratically interpolated. Corresponding frequency values are passed as described above.

    units = 0,  MagSrcWave values are in decibels (dB).

    units = 1,  MagSrcWave values are in Pascals (Pa).

    MagSrcWave,  Specification for wave of frequency-specific magnitude values. If MagSrcWave has two columns, the second column is assumed to specify frequency values.

    FreqSrcWave,  Specification for optional wave of frequency values corresponding to MagSrcWave.


/DFT = { dft [, dftDestWaveName ] }

    dft = 0,  same as no /DFT flag, avoid using DFT if not required.

    dft = 1,  use discrete Fourier transform even if not required.

    If dftDestWaveName is specified, the real and imaginary parts of the generated signal are written to the complex wave specified by dftDestWaveName before computing the inverse DFT. Onset and offset ramps specified using the /Ramp flag, are ignored.

    A variable named V_DFT is set to 1 if forward and inverse DFTs were used to generate the signal. V_DFT is set to 0 if no DFT was used.


Example

Function SpHr_SignalGaussian_Example()

    variable fs = 48000

    // 1/f noise with 30 Hz High-pass filter

    SpHr_SignalGaussian/ms=200/Sp=1/HP=30/dB=70/Ramp=10 fs, Noise

    SpHr_DFTSpectrum /Mag=Mag/dB /Oct=6 Noise

    Display/K=1 Noise

    Label left "amplitude (\\U)"

    Label bottom "time (\\U)"

    Display/K=1 Mag

    ModifyGraph log(bottom)=1

    Label left "magnitude (\\U)"

    Label bottom "frequency (\\U)"

End

Contact: Brian