Photon Voice v2.53

Classes | Static Public Member Functions | List of all members
AudioUtil Class Reference

Collection of Audio Utility functions and classes. More...

Classes

class  GeneratorPusher
 IAudioPusher that provides a constant tone signal. More...
 
class  GeneratorReader
 
interface  ILevelMeter
 Audio Level Metering interface. More...
 
interface  IVoiceDetector
 Voice Activity Detector interface. More...
 
class  LevelMeter
 Audio Level Meter. More...
 
class  LevelMeterDummy
 Dummy Audio Level Meter that doesn't actually do anything. More...
 
class  LevelMeterFloat
 LevelMeter specialization for float audio. More...
 
class  LevelMeterShort
 LevelMeter specialization for short audio. More...
 
class  Resampler
 Sample-rate conversion Audio Processor. More...
 
class  TempoUp
 
class  ToneAudioPusher
 IAudioPusher that provides a constant tone signal. More...
 
class  ToneAudioReader
 IAudioReader that provides a constant tone signal. More...
 
class  VoiceDetector
 Simple voice activity detector triggered by signal level. More...
 
class  VoiceDetectorCalibration
 Calibration Utility for Voice Detector More...
 
class  VoiceDetectorDummy
 Dummy VoiceDetector that doesn't actually do anything. More...
 
class  VoiceDetectorFloat
 VoiceDetector specialization for float audio. More...
 
class  VoiceDetectorShort
 VoiceDetector specialization for float audio. More...
 
class  VoiceLevelDetectCalibrate
 Utility Audio Processor Voice Detection Calibration. More...
 
class  WaveformAudioPusher
 IAudioPusher that provides the given waveform. More...
 
class  WaveformAudioReader
 IAudioReader that provides the given waveform. More...
 

Static Public Member Functions

static int ToneToBuf< T > (T[] buf, long timeSamples, int channels, double amp, double k, double phaseMod=0)
 
static int ToneToBuf< T > (T[] buf, int offset, int length, long timeSamples, int channels, double amp, double k, double phaseMod=0)
 
static int WaveformToBuf< T > (T[] buf, T[] waveform, long timePos)
 
static void Resample< T > (T[] src, T[] dst, int dstCount, int channels)
 Resample audio data so that the complete src buffer fits into dstCount samples in the dst buffer. More...
 
static void Resample< T > (T[] src, int srcOffset, int srcCount, T[] dst, int dstOffset, int dstCount, int channels)
 
static void Resample< T > (T[] src, int srcOffset, int srcCount, int srcChannels, T[] dst, int dstOffset, int dstCount, int dstChannels)
 
static void ResampleAndConvert (short[] src, float[] dst, int dstCount, int channels)
 Resample audio data so that the complete src buffer fits into dstCount samples in the dst buffer, and convert short to float samples along the way. More...
 
static void ResampleAndConvert (float[] src, short[] dst, int dstCount, int channels)
 Resample audio data so that the complete src buffer fits into dstCount samples in the dst buffer, and convert float to short samples along the way. More...
 
static void Convert (float[] src, short[] dst, int dstCount)
 Convert audio buffer from float to short samples. More...
 
static void Convert (short[] src, float[] dst, int dstCount)
 Convert audio buffer from short to float samples. More...
 
static void ForceToStereo< T > (T[] src, T[] dst, int srcChannels)
 Convert audio buffer with arbitrary number of channels to stereo. More...
 

Detailed Description

Collection of Audio Utility functions and classes.

Member Function Documentation

◆ Convert() [1/2]

static void Convert ( float[]  src,
short[]  dst,
int  dstCount 
)
static

Convert audio buffer from float to short samples.

Parameters
srcSource buffer.
dstDestination buffer.
dstCountSize of destination buffer (in total samples), source buffer must be of same length or longer.

◆ Convert() [2/2]

static void Convert ( short[]  src,
float[]  dst,
int  dstCount 
)
static

Convert audio buffer from short to float samples.

Parameters
srcSource buffer.
dstDestination buffer.
dstCountSize of destination buffer (in total samples), source buffer must be of same length or longer.

◆ ForceToStereo< T >()

static void ForceToStereo< T > ( T[]  src,
T[]  dst,
int  srcChannels 
)
static

Convert audio buffer with arbitrary number of channels to stereo.

For mono sources (srcChannels==1), the signal will be copied to both Left and Right stereo channels. For all others, the first two available channels will be used, any other channels will be discarded.

Parameters
srcSource buffer.
dstDestination buffer.
srcChannelsNumber of (interleaved) channels in src.

◆ Resample< T >()

static void Resample< T > ( T[]  src,
T[]  dst,
int  dstCount,
int  channels 
)
static

Resample audio data so that the complete src buffer fits into dstCount samples in the dst buffer.

This implements a primitive nearest-neighbor resampling algorithm for an arbitrary number of channels.

Parameters
srcSource buffer.
dstDestination buffer.
dstCountTarget size of destination buffer (in samples per channel).
channelsNumber of channels in the signal (1=mono, 2=stereo). Must be > 0.

◆ ResampleAndConvert() [1/2]

static void ResampleAndConvert ( float[]  src,
short[]  dst,
int  dstCount,
int  channels 
)
static

Resample audio data so that the complete src buffer fits into dstCount samples in the dst buffer, and convert float to short samples along the way.

This implements a primitive nearest-neighbor resampling algorithm for an arbitrary number of channels.

Parameters
srcSource buffer.
dstDestination buffer.
dstCountTarget size of destination buffer (in samples per channel).
channelsNumber of channels in the signal (1=mono, 2=stereo). Must be > 0.

◆ ResampleAndConvert() [2/2]

static void ResampleAndConvert ( short[]  src,
float[]  dst,
int  dstCount,
int  channels 
)
static

Resample audio data so that the complete src buffer fits into dstCount samples in the dst buffer, and convert short to float samples along the way.

This implements a primitive nearest-neighbor resampling algorithm for an arbitrary number of channels.

Parameters
srcSource buffer.
dstDestination buffer.
dstCountTarget size of destination buffer (in samples per channel).
channelsNumber of channels in the signal (1=mono, 2=stereo). Must be > 0.