Intel® Integrated Performance Primitives
Community support and discussions relating to developing high-performance vision, signal, security, and storage applications.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.

MP3Encoder and bits per sample.

mhand75
Beginner
144 Views

I am using the UMC MP3Encoder class. I am having trouble figuring out how to handle audio files with 8 bits per sample. When trying to encode these files, I get distorted audio (the MP3 audio that results from the encoding is about half the length that it should be and vocals sound like a chipmunk). This only happens when I am working with WAV files that have a bits per sample of 8. When I test files with 16 it works fine.

Is there something I am doing wrong with my initialization:

// Read wav file into buffer
AudioData inMediaBuffer;
WavFile::Info wavInfo;
.... Read in WAV file ....

// Setup encoder defaults
MP3EncoderParams MP3EncoderParams;
MP3EncoderParams.m_pData = &inMediaBuffer;

MP3EncoderParams.m_info_in.sample_frequency = wavInfo.sample_rate;
MP3EncoderParams.m_info_in.channels = wavInfo.channels_number;
MP3EncoderParams.m_info_in.channel_mask = wavInfo.channel_mask;
MP3EncoderParams.m_info_in.bitPerSample = wavInfo.resolution;

MP3EncoderParams.m_info_out.bitrate = 128000;
MP3EncoderParams.m_info_out.sample_frequency = wavInfo.sample_rate;
MP3EncoderParams.m_info_out.channels = wavInfo.channels_number;
MP3EncoderParams.m_info_out.channel_mask = wavInfo.channel_mask;
MP3EncoderParams.m_info_out.stream_type = UMC::MP1L3_AUDIO;
MP3EncoderParams.m_info_out.bitPerSample = wavInfo.resolution;

// Initialize encoder
MP3Encoder MP3Encoder;
MP3Encoder.Init(&MP3EncoderParams);



Thanks for your help.
0 Kudos
3 Replies
Vladimir_Dudnik
Employee
144 Views
Hello, what version of IPP do you use?

Vladimir
mhand75
Beginner
144 Views
Hello, what version of IPP do you use?

Vladimir

Hi Vladimir,

We are using 6.0, Update 2.


Vladimir_Dudnik
Employee
144 Views

There is comment from our expert:


Input stream format for all UMC audio encoders is 16 bit PCM. To encode 8 bit per sample audio stream you should convert it to 16 bit audio stream. You should also take into account that 8 bit stream can have linear, mu-law or a-law format (information about actual format of your file you can find in the WAV file header)


Regards,
Vladimir
Reply