HydrogenAudio

Lossy Audio Compression => MP3 => MP3 - General => Topic started by: czar1na on 2017-02-21 03:21:03

Title: 32bit PCM audio to mp3 has clicks and pops?
Post by: czar1na on 2017-02-21 03:21:03
Hi,

I have a Raspberry Pi Zero with an I2S MEMS Mic that records raw 32bit PCM audio.

I'm using Sox to record raw audio and encode it into mp3:

rec --buffer 2000000 -c 1 -r 44100 -b 32 test.mp3

However, this gives the warning:

/usr/bin/rec WARN formats: mp3 can't encode to 32-bit

And my resulting test.mp3 file has little clicking and popping static noises throughout. I've attached the mp3 file.

I know nothing is wrong with my mic, as I've recorded AAC encoded audio with FFMPEG successfully before. Am I doing something wrong here?
Title: Re: 32bit PCM audio to mp3 has clicks and pops?
Post by: kode54 on 2017-02-21 06:03:10
I only hear popping when it initializes the microphone at the start. I see noise, but the only noise I can actually hear is typical line level noise present in a noisy environment.
Title: Re: 32bit PCM audio to mp3 has clicks and pops?
Post by: Roseval on 2017-02-21 08:47:08
/usr/bin/rec WARN formats: mp3 can't encode to 32-bit
MP3 doesn't use a bit depth, it simply tries to pack everything as efficient as possible.

Is the popping in the audio (in the file) or is it a artifact of the playback chain?
Title: Re: 32bit PCM audio to mp3 has clicks and pops?
Post by: DVDdoug on 2017-02-21 17:59:30
Quote
I only hear popping when it initializes the microphone at the start.
I assume that happens with WAV too?   ...Unrelated to MP3 encoding?

A pop/click at the beginning (and end) is usually DC offset (http://manual.audacityteam.org/man/dc_offset.html) caused by a hardware problem.

There are filters/algorithms to fix offset, or you can apply a high-pass filter (DC is zero-Hz) and a short fade-in (several milliseconds).