XaudioConvolute

Section: AUDIO Extension (3)
Updated: 2007-08-30
Index Return to Main Contents
 

NAME

XaudioConvolute, XaudioConvoluteAccumulate - convolute sample values  

SYNOPSIS

#include <X11/extensions/Xaudio.h>

void XaudioConvolute(Display *display, XaudioSampleBuffer dst, int dst_index, unsigned int dst_count,XaudioSampleBuffer src ,int src_index ,unsignedint src_count ,XaudioSampleBuffer kern ,int denominator , scaledst );

void XaudioConvoluteAccumulate(Display *display, XaudioSampleBuffer dst, int dst_index, unsigned int dst_count,XaudioSampleBuffer src ,int src_index ,unsignedint src_count ,XaudioSampleBuffer kern ,int denominator , scaledst );  

ARGUMENTS

display
Specifies the connection to the X server.
dst
Destination sample buffer.
dst_index
Index of first sample of destination sample buffer.
dst_count
Number of samples in destination buffer to compute convolution for.
src
Source sample buffer.
src_index
Index of first sample of source sample buffer.
src_count
Number of samples in source buffer to convolute.
kern
Convolution kernel.
denominator
Denominator to determine scaling between src, dst and kern.
shift
Numerator shift to determine offset between src and dst.
scalesrc
Multiplier to scale src with respect to kern.
scaledst
Multiplier to scale dst with respect to kern.

 

DESCRIPTION

The XaudioConvolute function computes the convolution of src and kern and writes the resulting sample values into dst. The XaudioConvoluteAccumulate function computes the convolution of src and kern and adds the resulting values to dst.

The operation performed is:

dst(j+dst_index) = Sigma_k src(k+src_index) * kern((shift+scalesrc*k-scaledst*j)/denominator)

where j iterates through 0, 1, ... , dst_count-1 and k iterates through 0, 1, ... src_count-1. kern is interpolated linearly between two adjacent sample values if the argument is not integral; kern is taken to be zero outside the index range of the sample buffer, see XaudioSampleBuffer(3).

The functions provide a generalized discrete convolution operator that is applicable even if the assumed sample rate of dst, src and kern differs. If denominator = scalesrc = scaledst = 1 the formula simplifies to:

dst(j+dst_index) = Sigma_k src(k+src_index) * kern(shift+k-j)

Thus the operation degenerates to the well-known discrete convolution operator (where sample rates must be identical). The convolution is commutative in src and kern only in the degenerate case.

The convolution operator provided here in its general form is mainly useful for sample rate conversion (and application of a band-pass filter at the same time, to reduce aliasing artifacts); see http://ccrma.stanford.edu/~jos/resample/ for a description of band-limited resampling.

The specialized form of the convolution operator is useful to apply finite impulse response filters to a sampled audio signal.

 

SEE ALSO

XaudioSampleBuffer(3), XaudioSampleBufferOps(3), XtimeAudio(3),


 

Index

NAME
SYNOPSIS
ARGUMENTS
DESCRIPTION
SEE ALSO

This document was created by man2html, using the manual pages.
Time: 13:14:25 GMT, January 31, 2008