Bela
Real-time, ultra-low-latency audio and sensor processing system for BeagleBone Black
 All Classes Files Functions Variables Typedefs Macros Groups
Macros | Functions
Audio level controls

Macros

#define DEFAULT_DAC_LEVEL   0.0
 
#define DEFAULT_ADC_LEVEL   -6.0
 
#define DEFAULT_PGA_GAIN   16
 
#define DEFAULT_HP_LEVEL   -6.0
 

Functions

int Bela_setDACLevel (float decibels)
 Set the level of the audio DAC. More...
 
int Bela_setADCLevel (float decibels)
 Set the level of the audio ADC. More...
 
int Bela_setPgaGain (float decibels, int channel)
 Set the gain of the audio preamplifier. More...
 
int Bela_setHeadphoneLevel (float decibels)
 Set the level of the onboard headphone amplifier. More...
 
int Bela_muteSpeakers (int mute)
 Mute or unmute the onboard speaker amplifiers. More...
 

Detailed Description

These functions control the input and output levels for the audio codec. If a Bela program does not call these functions, sensible default levels will be used.

Macro Definition Documentation

#define DEFAULT_DAC_LEVEL   0.0

Default level of the audio DAC in decibels. See Bela_setDACLevel().

#define DEFAULT_ADC_LEVEL   -6.0

Default level of the audio ADC in decibels. See Bela_setADCLevel().

#define DEFAULT_PGA_GAIN   16

Default level of the Programmable Gain Amplifier in decibels.

#define DEFAULT_HP_LEVEL   -6.0

Default level of the headphone output in decibels. See Bela_setHeadphoneLevel().

Function Documentation

int Bela_setDACLevel ( float  decibels)

Set the level of the audio DAC.

This function sets the level of all audio outputs (headphone, line, speaker). It does not affect the level of the (non-audio) analog outputs.

Important: do not call this function from within render(), as it does not make any guarantees on real-time performance.

Parameters
decibelsLevel of the DAC output. Valid levels range from -63.5 (lowest) to 0 (highest) in steps of 0.5dB. Levels between increments of 0.5 will be rounded down.
Returns
0 on success, or nonzero if an error occurred.
int Bela_setADCLevel ( float  decibels)

Set the level of the audio ADC.

This function sets the level of the audio input. It does not affect the level of the (non-audio) analog inputs.

Important: do not call this function from within render(), as it does not make any guarantees on real-time performance.

Parameters
decibelsLevel of the ADC input. Valid levels range from -12 (lowest) to 0 (highest) in steps of 1.5dB. Levels between increments of 1.5 will be rounded down.
Returns
0 on success, or nonzero if an error occurred.
int Bela_setPgaGain ( float  decibels,
int  channel 
)

Set the gain of the audio preamplifier.

This function sets the level of the Programmable Gain Amplifier(PGA), which amplifies the signal before the ADC.

Important: do not call this function from within render(), as it does not make any guarantees on real-time performance.

Parameters
decibelsLevel of the PGA Valid levels range from 0 (lowest) to 59.5 (highest) in steps of 0.5dB. Levels between increments of 0.5 will be rounded.
channelSpecifies which channel to apply the gain to. Channel 0 is left, channel 1 is right
Returns
0 on success, or nonzero if an error occurred.
int Bela_setHeadphoneLevel ( float  decibels)

Set the level of the onboard headphone amplifier.

This function sets the level of the headphone output only (3-pin connector on the Bela cape or the output jack on the BeagleBone Audio Cape). It does not affect the level of the speakers or the line out pads on the cape.

Important: do not call this function from within render(), as it does not make any guarantees on real-time performance.

Parameters
decibelsLevel of the DAC output. Valid levels range from -63.5 (lowest) to 0 (highest) in steps of 0.5dB. Levels between increments of 0.5 will be rounded down.
Returns
0 on success, or nonzero if an error occurred.
int Bela_muteSpeakers ( int  mute)

Mute or unmute the onboard speaker amplifiers.

This function mutes or unmutes the amplifiers on the Bela cape. Whether the speakers begin muted or unmuted depends on the BelaInitSettings structure passed to Bela_initAudio().

Important: do not call this function from within render(), as it does not make any guarantees on real-time performance.

Parameters
mute0 to enable the speakers, nonzero to mute the speakers.
Returns
0 on success, or nonzero if an error occurred.