arduino-audio-tools
Loading...
Searching...
No Matches
Public Member Functions | Protected Attributes | List of all members
audio_tools::AACEncoderFDK Class Reference

Encodes PCM data to the AAC format and writes the result to a stream This is basically just a wrapper using https://github.com/pschatzmann/arduino-fdk-aac. More...

#include <CodecAACFDK.h>

Inheritance diagram for audio_tools::AACEncoderFDK:
audio_tools::AudioEncoder audio_tools::AudioWriter

Public Member Functions

 AACEncoderFDK (Print &out_stream)
 
void begin ()
 
virtual void begin (AudioBaseInfo info)
 Opens the encoder
More...
 
virtual void begin (int input_channels=2, int input_sample_rate=44100, int input_bits_per_sample=16)
 Opens the encoder
More...
 
aac_fdk::AACEncoderFDK * driver ()
 
void end ()
 
UINT getParameter (const AACENC_PARAM param)
 
const char * mime ()
 
 operator bool ()
 
virtual void setAfterburner (bool afterburner)
 
virtual void setAudioInfo (AudioBaseInfo from)
 Defines the Audio Info. More...
 
virtual void setAudioObjectType (int aot)
 
virtual void setBitrate (int bitrate)
 
virtual void setOutputBufferSize (int outbuf_size)
 Set the Output Buffer Size object. More...
 
void setOutputStream (Print &out_stream)
 
int setParameter (AACENC_PARAM param, uint32_t value)
 
virtual void setSpectralBandReplication (int eld_sbr)
 
virtual void setVariableBitrateMode (int vbr)
 
size_t write (const void *in_ptr, size_t in_size)
 
- Public Member Functions inherited from audio_tools::AudioEncoder
 AudioEncoder (AudioEncoder const &)=delete
 
virtual const char * mime ()=0
 
AudioEncoderoperator= (AudioEncoder const &)=delete
 
virtual void begin ()=0
 
virtual void end ()=0
 
virtual operator bool ()=0
 
virtual void setAudioInfo (AudioBaseInfo from)=0
 
virtual void setOutputStream (Print &out_stream)=0
 
virtual size_t write (const void *in_ptr, size_t in_size)=0
 

Protected Attributes

aac_fdk::AACEncoderFDK * enc =nullptr
 

Detailed Description

Encodes PCM data to the AAC format and writes the result to a stream This is basically just a wrapper using https://github.com/pschatzmann/arduino-fdk-aac.

Author
Phil Schatzmann

Member Function Documentation

◆ begin() [1/3]

void audio_tools::AACEncoderFDK::begin ( )
inlinevirtual

◆ begin() [2/3]

virtual void audio_tools::AACEncoderFDK::begin ( AudioBaseInfo  info)
inlinevirtual

Opens the encoder

Parameters
info
Returns
int

◆ begin() [3/3]

virtual void audio_tools::AACEncoderFDK::begin ( int  input_channels = 2,
int  input_sample_rate = 44100,
int  input_bits_per_sample = 16 
)
inlinevirtual

Opens the encoder

Parameters
input_channels
input_sample_rate
input_bits_per_sample
Returns
int 0 => ok; error with negative number

◆ end()

void audio_tools::AACEncoderFDK::end ( )
inlinevirtual

◆ mime()

const char * audio_tools::AACEncoderFDK::mime ( )
inlinevirtual

◆ operator bool()

audio_tools::AACEncoderFDK::operator bool ( )
inlinevirtual

◆ setAfterburner()

virtual void audio_tools::AACEncoderFDK::setAfterburner ( bool  afterburner)
inlinevirtual

Configure SBR independently of the chosen Audio Object Type ::AUDIO_OBJECT_TYPE. This parameter is for ELD audio object type only.

  • -1: Use ELD SBR auto configurator (default).
  • 0: Disable Spectral Band Replication.
  • 1: Enable Spectral Band Replication.

◆ setAudioInfo()

virtual void audio_tools::AACEncoderFDK::setAudioInfo ( AudioBaseInfo  from)
inlinevirtual

Defines the Audio Info.

Implements audio_tools::AudioWriter.

◆ setAudioObjectType()

virtual void audio_tools::AACEncoderFDK::setAudioObjectType ( int  aot)
inlinevirtual

This parameter controls the use of the afterburner feature. The afterburner is a type of analysis by synthesis algorithm which increases the audio quality but also the required processing power. It is recommended to always activate this if additional memory consumption and processing power consumption is not a problem. If increased MHz and memory consumption are an issue then the MHz and memory cost of this optional module need to be evaluated against the improvement in audio quality on a case by case basis.

  • 0: Disable afterburner (default).
  • 1: Enable afterburner.

◆ setBitrate()

virtual void audio_tools::AACEncoderFDK::setBitrate ( int  bitrate)
inlinevirtual

Audio object type. See ::AUDIO_OBJECT_TYPE in FDK_audio.h.

  • 2: MPEG-4 AAC Low Complexity.
  • 5: MPEG-4 AAC Low Complexity with Spectral Band Replication (HE-AAC).
  • 29: MPEG-4 AAC Low Complexity with Spectral Band Replication and Parametric Stereo (HE-AAC v2). This configuration can be used only with stereo input audio data.
  • 23: MPEG-4 AAC Low-Delay.
  • 39: MPEG-4 AAC Enhanced Low-Delay. Since there is no ::AUDIO_OBJECT_TYPE for ELD in combination with SBR defined, enable SBR explicitely by ::AACENC_SBR_MODE parameter. The ELD v2 212 configuration can be configured by ::AACENC_CHANNELMODE parameter.
  • 129: MPEG-2 AAC Low Complexity.
  • 132: MPEG-2 AAC Low Complexity with Spectral Band Replication (HE-AAC).

Please note that the virtual MPEG-2 AOT's basically disables non-existing Perceptual Noise Substitution tool in AAC encoder and controls the MPEG_ID flag in adts header. The virtual MPEG-2 AOT doesn't prohibit specific transport formats.

◆ setOutputBufferSize()

virtual void audio_tools::AACEncoderFDK::setOutputBufferSize ( int  outbuf_size)
inlinevirtual

Set the Output Buffer Size object.

Parameters
outbuf_size

◆ setOutputStream()

void audio_tools::AACEncoderFDK::setOutputStream ( Print out_stream)
inlinevirtual

Total encoder bitrate. This parameter is
mandatory and interacts with ::AACENC_BITRATEMODE.

  • CBR: Bitrate in bits/second.
  • VBR: Variable bitrate. Bitrate argument will be ignored. See suppBitrates for details.

Implements audio_tools::AudioWriter.

◆ setSpectralBandReplication()

virtual void audio_tools::AACEncoderFDK::setSpectralBandReplication ( int  eld_sbr)
inlinevirtual

Bitrate mode. Configuration can be different kind of bitrate configurations:

  • 0: Constant bitrate, use bitrate according to ::AACENC_BITRATE. (default) Within none LD/ELD ::AUDIO_OBJECT_TYPE, the CBR mode makes use of full allowed bitreservoir. In contrast, at Low-Delay ::AUDIO_OBJECT_TYPE the bitreservoir is kept very small.
  • 1: Variable bitrate mode, very low bitrate.
  • 2: Variable bitrate mode, low bitrate.
  • 3: Variable bitrate mode, medium bitrate.
  • 4: Variable bitrate mode, high bitrate.
  • 5: Variable bitrate mode, very high bitrate.

◆ write()

size_t audio_tools::AACEncoderFDK::write ( const void *  in_ptr,
size_t  in_size 
)
inlinevirtual

The documentation for this class was generated from the following file: