pixelperfectengine.audio.base.func

Undocumented in source.

Public Imports

pixelperfectengine.audio.base.types
public import pixelperfectengine.audio.base.types;
Undocumented in source.

Members

Aliases

ADPCMStream
alias ADPCMStream = NibbleArray
Undocumented in source.

Functions

bendFreq
double bendFreq(double freq, double am)

Bends the frequency by the given amount of seminotes.

calculateHP20alpha
double calculateHP20alpha(float fs, float f0)

Creates the alpha value for a HP20 filter. Filter formula: y[n] = (y[n-1] + x[n] - x[n-1]) * alpha Where alpha is: 1 / (1 + 2 * pi * timeConstantInSeconds * samplerate)

calculateLP6factor
double calculateLP6factor(float fs, float f0)

Calculates the time factor for an LP6 filter. Filter formula: y[n] = y[n-1] + (x[n] - y[n-1]) * factor Where factor is: 1.0 - exp(-1.0 / (timeConstantInSeconds * samplerate))

convExIntToFlt
void convExIntToFlt(size_t length, int* src, float* dest)

Converts a 32 bit extended integer stream to 32 bit floating point.

convertM1CtrlValToM2
uint convertM1CtrlValToM2(ubyte msb, ubyte lsb)

Converts MIDI 1.0 14 bit control values to MIDI 2.0 32 bit. Might not work the best with certain values.

createBPF0
BiquadFilterValues createBPF0(float fs, float f0, float q)

Calculates biquad band pass filter (constant skirt gain, peak gain = Q) filter coefficients from the supplied values.

createBPF1
BiquadFilterValues createBPF1(float fs, float f0, float q)

Calculates biquad band pass filter (constant 0 db peak gain) filter coefficients from the supplied values.

createHPF
BiquadFilterValues createHPF(float fs, float f0, float q)

Calculates biquad high-pass filter coefficients from the supplied values.

createLPF
BiquadFilterValues createLPF(float fs, float f0, float q)

Calculates biquad low-pass filter coefficients from the supplied values.

createNotchFilt
BiquadFilterValues createNotchFilt(float fs, float f0, float q)
Undocumented in source. Be warned that the author may not have intended to support it.
decode16bitPCM
void decode16bitPCM(const(short)[] src, int[] dest, DecoderWorkpad wp)

Decodes an amount of 16 bit signed PCM to extended 32 bit. Amount is decided by dest.length. src is a full waveform. Position is stored in wp.pos.

decode4bitDialogicADPCM
void decode4bitDialogicADPCM(ADPCMStream src, int[] dest, DecoderWorkpad wp)

Decodes an amount of 4 bit Oki/Dialogic ADPCM stream to extended 32 bit. Amount is decided by dest.length. src is a full waveform. Position is stored in wp.pos.

decode4bitIMAADPCM
void decode4bitIMAADPCM(ADPCMStream src, int[] dest, DecoderWorkpad wp)

Decodes an amount of 4 bit IMA ADPCM stream to extended 32 bit. Amount is decided by dest.length. src is a full waveform. Position is stored in wp.pos.

decode8bitPCM
void decode8bitPCM(const(ubyte)[] src, int[] dest, DecoderWorkpad wp)

Decodes an amount of 8 bit unsigned PCM to extended 32 bit. Amount is decided by dest.length. src is a full waveform. Position is stored in wp.pos.

decodeALawStream
void decodeALawStream(const(ubyte)[] src, int[] dest, DecoderWorkpad wp)

Decodes an A-Law encoded stream.

decodeMuLawStream
void decodeMuLawStream(const(ubyte)[] src, int[] dest, DecoderWorkpad wp)

Decodes a Mu-Law encoded stream.

fastPow
double fastPow(double a, double b)
Undocumented in source. Be warned that the author may not have intended to support it.
interleave
void interleave(size_t length, float* srcL, float* srcR, float* dest)

Interleaves two channels. dest must be as big as the length of srcL and srcR.

midiToFreq
double midiToFreq(int note, double baseFreq)

Converts MIDI note to frequency.

mixIntoStream
void mixIntoStream(size_t length, float* src, float* dest, float amount, float corr)

Mixes an audio stream to the destination.

noteToFreq
double noteToFreq(double note, double baseFreq)

Converts note number to frequency.

resetBuffer
void resetBuffer(T[] targetBuffer)

Sets an array (buffer) to all zeros.

stretchAudioNoIterpol
void stretchAudioNoIterpol(const(int)[] src, int[] dest, WavemodWorkpad wp, uint modifier, uint clamping)

Streches a buffer to the given amount using no interpolation. Amount decided by dest.length. Can be used to pitch the sample.

Static variables

ADPCM_INDEX_TABLE_2BIT
byte[4] ADPCM_INDEX_TABLE_2BIT;

For IMA ADPCM Needs less storage at the cost of worse quality

ADPCM_INDEX_TABLE_3BIT
byte[8] ADPCM_INDEX_TABLE_3BIT;

For IMA ADPCM Needs less storage at the cost of worse quality

ADPCM_INDEX_TABLE_4BIT
byte[16] ADPCM_INDEX_TABLE_4BIT;

For IMA and Dialogic ADPCM Standard quality and size

ADPCM_INDEX_TABLE_5BIT
byte[32] ADPCM_INDEX_TABLE_5BIT;

For IMA ADPCM Better quality, but needs more storage

A_LAW_DECODER_TABLE
short[256] A_LAW_DECODER_TABLE;

Used for decoding A-Law encoded PCM streams.

DIALOGIC_ADPCM_STEP_TABLE
ushort[49] DIALOGIC_ADPCM_STEP_TABLE;

Most OKI and Yamaha chips seems to use this step-table

IMA_ADPCM_STEP_TABLE
ushort[89] IMA_ADPCM_STEP_TABLE;

Used by IMA ADPCM and its derivatives.

MU_LAW_DECODER_TABLE
short[256] MU_LAW_DECODER_TABLE;

Used for decoding Mu-Law encoded PCM samples

Y_ADPCM_INDEX_TABLE
byte[16] Y_ADPCM_INDEX_TABLE;

For the Yamaha ADPCM A found in YM2610 and probably other chips

Variables

CONV_RATIO_RECIPROCAL
__m128 CONV_RATIO_RECIPROCAL;

Constant for fast integer to floating point conversion

Meta