Encoding bug when importing raw data?

Hi,

Started using a the latest version of Audacity a few days ago. I was using an older version and the reason I upgraded to the newer version is because I thought there was a bug in the old version but it appears to behave the same in the new version:

When importing raw data, if I click FILE > IMPORT > RAW DATA then select my file and then from the “Import raw data” box, I chose the encoding (and other parameters).

It seems that regardless of the one encoding type I chose, after I click IMPORT, the waveform appears and in the left-hand box with the “Mute” and “Solo” buttons left of the waveform, at the bottom of that box above the “Select” button, it always shows 32-bit float.

Then again in that box at the top, if I press the right drop-down arrow next to the filename and scroll down to the FORMAT option, it does show that 32-bit float is selected although that’s not what I selected when I imported the file.

If I change the encoding type, it doesn’t appear to change anything in the audio when it plays-back.

Any idea?

Thanks,

Ben

Audacity works at 32-bit float internally and it doesn’t remember what format you opened-imported so as long as it’s working and you’re getting a good waveform and good sound, don’t worry!

Ok, then this leads me to my second question… the raw data I am trying to import is 24-bit I2S data at 16kHz sampling. The audio comes from an ICS-43434 microphone. An MCU is providing it a 16kHz WCLK and a 1.024MHz BCLK. The data is sampled and saved to an SD card. Then I open the file using Audacity and I chose signed 24-bit PCM with a 16kHz sampling and I can sort of hear myself counting but it’s very noisy and the waveform is ugly. I was trying to rule-out Audacity… thanks for your time unless you have any other suggestion!

Cheers!

Ben

I assume you’ve experimented with the byte order and offset? With 24-bits the offset can be 0, 1 or, 2 so you can try all of the possibilities.

Otherwise, PCM data is pretty straightforward.

I’ve never used I2S but I took a quick look at the datasheet and I saw something about stereo. Something could be configured wrong if you’re only using one microphone…

Have you looked at the file with a hex editor? That can be kind-of tough with acoustic signals but there might be a clue with loud & quiet sounds. I assume with “silence” the most significant byte will be zero, or at least it should be a small number.

Since you are using a microcontroller, I assume you are a programmer and you should be able to write a program to create a PCM file (a sine or square wave). …Just to prove to yourself that Audacity is working as expected. Or you can save a 24-bit WAV file (which is PCM) and open it as raw data. The header will be read as audio so that will be noise/garbage but otherwise it’s just PCM samples.

Thanks for the reply.

Yes I am a programmer / electronics guy. Just to test the sampling and writing to the SD card, I “hijacked” the bit sampling and everytime 8-bits out of 24 get sampled, I replace the sampled data with letters A-Z therefore in my audio file, I was able to see all the letters in order. So I think that this works (24-bit sampling and writing to SD card). Now I need to test Audacity…

As for the format, I read that it was a bit different… chatGPT gave me the following explanation: I2S 24-bit @ 16kHz and PCM 24-bit @ 16kHz both refer to a 24-bit audio data format with a sampling rate of 16kHz, but I2S is a communication protocol while PCM is a digital audio format. The difference between them lies in the method of transmitting and representing audio data.

So I guess it is somewhat different, I will do some more reading I guess!

Thanks again!

Ben

This topic was automatically closed after 30 days. New replies are no longer allowed.