- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Vladimir
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Vladimir
Hi Vladimir,
We are using 6.0, Update 2.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page