User Tools


reference:advanced_calculations

Advanced Calculations

BIQUAD OutputArray(OUT),InputArray(IN),FilterCoefficientArray(FP)

Apply biquadratic filter

・The following calculation is performed on all elements of the specified array. (0 <= t < len(IN))
OUT[t]=FP[0]*IN[t]+FP[1]*IN[t-1]+FP[2]*IN[t-2]-FP[3]*OUT[t-1]-FP[4]*OUT[t-2]
・If a 1D array is specified, it will be handled as monaural and if a 2D array is specified, it will be handled as stereo.
・If the array index is negative, use monaural or the value of FP[5..8] for the left channel and FP[9..12] for the right channel.
FP[5..12] value is updated at each execution.
・The filter coefficient array of the main characteristics such as a low-pass filter can be obtained with the BQPARAM command.

Arguments

OutputArray

Array that stores the results of applying the filter

InputArray

Array containing the signals to which the filter is applied

FilterCoefficientArray

Array containing filter coefficient

・The number of elements in the array must be 13 or more.

Example

DIM OD[2,1000],ID[2,1000],FP[13]
BQPARAM FP,#BQLPF,48000,8000,1/SQR(2)
BIQUAD OD,ID,FP 

BQPARAM FilterCoefficientArray,FilterType,SamplingFrequency,CutoffFrequency,QValueOrBandwidth[, AmplificationFactor]

Calculate filter coefficients of biquadratic filter

Arguments

FilterCoefficientArray

Array to store filter coefficient (length must be 13 or more)

・ [5..12] of the specified array is not changed even if this command is executed.

FilterType

0 #BQAPF All-Pass Filter Only the phase near the cutoff frequency changes
1 #BQLPF Low-Pass Filter Passes below the cutoff frequency
2 #BQHPF High-Pass Filter Passes frequencies above the cutoff frequency
3 #BQBPF Bandpass Filter Passes a specified frequency band centered on the cutoff frequency
4 #BQBSF Bandstop Filter Blocks the specified frequency band centered on the cutoff frequency
5 #BQLSF Low-Shelf Filter Amplifies the frequency below the cutoff frequency with the specified amplification factor
6 #BQHSF High-Shelf Filter Amplifies the frequency above the cutoff frequency with the specified amplification factor
7 #BQPEQ Peaking Equalizer Amplifies a specified frequency band centered on the cutoff frequency with a specified amplification factor

SamplingFrequency

Sampling frequency of input signal

・0 is an error.

CutoffFrequency

Filter cutoff frequency

QValueOrBandwidth

Handle filter types, BPF/BSF/PEQ as bandwidth (unit: octave), and otherwise, QValue as smoothness of filter characteristics.

・0 is an error.

AmplificationFactor

Amplification factor of filter (unit: db). The descriptions must be needed when the filter types, #BQLSF, #BQHSF and #BQPEQ, are used.

Example

DIM OD[1000],ID[1000],FP[13]
BQPARAM FP,#BQLSF,48000,8000,1/SQR(2),3.0
BIQUAD OD,ID,FP 

FFT OutputRealPartArray,OutputImaginaryPartArray,InputRealPartArray,InputImaginaryPartArray[,WindowFunctionValueArray]

Perform Fourier transform on complex array

・All specified arrays must have the same number of elements, and the number of elements must be 2 to the power of n.
・The output and input arrangement may be the same.

Arguments

OutputRealPartArray,OutputImaginaryPartArray

Complex array of real and imaginary parts containing the result of the operation

InputRealPartArray,InputImaginaryPartArray

Complex array of real and imaginary parts to operate on

WindowFunctionValueArray

Array containing the window function values

・If specified, the input complex number array is multiplied by the element value of the same index, and then the Fourier transform is performed.
・The window function value array can also be obtained with the FFTTWFN command.

Example

DIM iR[1024],iI[1024],WF[1024]
DIM oR[1024],oI[1024]
FFTWFN WF,3
FFT oR,oI,iR,iI,WF 

IFFT OutputRealPartArray,OutputImaginaryPartArray,InputRealPartArray,InputImaginaryPartArray

Perform inverse Fourier transform on complex array

・All specified arrays must have the same number of elements, and the number of elements must be 2 to the power of n.
・The output and input arrangement may be the same.

Arguments

OutputRealPartArray,OutputImaginaryPartArray

Complex array of real and imaginary parts containing the result of the operation

InputRealPartArray,InputImaginaryPartArray

Complex array of real and imaginary parts to operate on

Example

DIM iR[1024],iI[1024]
DIM oR[1024],oI[1024]
IFFT oR,oI,iR,iI 

FFTWFN Array,WindowFunctionType

Obtain window function value array

Arguments

Array

Array containing the window function values

WindowFunctionType

0 #WFRECT Rectangular Window
1 #WFHAMM Humming Window
2 #WFHANN Hanning Window
3 #WFBLKM Blackman Window

Example

DIM WF[1024]
FFTWFN WF,#WFHAMM

ARYOP OperationType,ResultStorageArray,Parameter1,Parameter2[,Parameter3]

Perform a batch operation on elements in an array

・From the beginning of the array to the end of the result storage array, the operation specified by the operation type is performed between each element, and the operation result is stored in the result storage array.
・If the number of elements in the parameter array is different from the number of elements in the result storage array, when it reaches the end of the array, return to the top of the array and refer to it repeatedly.

Argument

Operation type

0 #AOPADD Addition (p1+p2)
1 #AOPSUB Subtraction (p1-p2)
2 #AOPMUL Multiplication (p1*p2)
3 #AOPDIV Division (p1/p2)
4 #AOPMAD Sum of Products (p1*p2+p3)
5 #AOPLIP Linear Interpolation (p1*p3+p2*(1-p3))
6 #AOPCLP Clamp (Rounds the value of p1 within the range of p2<=x<=p3)

ResultStorageArray

Numeric array for storing operation results

Parameter1,Parameter2,Parameter3

Parameters 1, 2, and 3 can be specified as a numeric array or normal numeric value

・If a normal numerical value is specified, that numerical value is used for all element operations.

reference/advanced_calculations.txt · Last modified: 2020/08/24 12:17 (external edit)

Page Tools