Some strange type of RAW data...

At this moment I’m working with some kind of RAW audio data, and I have one not typical question.
File that you can see in attach have a strange feature: it can be successfully imported as little-endian or big-endian. As I know, if the import endianess settings are wrong, I will hear a noise. But in this case I can hear two different sounds. I was very surprised and still can not understand how it works.
It’s fully clear that I’m dealing with an unusual byte-orgranization type, but I absolutely can not understand, how should I separate one sound from another (I need to save it as separated raw data).

I absolutely know, that is a PCM 16bit 44100Hz MONO file.

Here is a screenshot of waveforms, which I have by importing this file as MONO, LITTLE and BIG endian.
When I saw this, at first I thought that second waveform can be placed as second channel of one STEREO file. But when I exported this as STEREO, LITTLE and BIG endian, I saw this:
And at this point I totally confused and need your help! (18.6 KB)

For 16-bit PCM files, each sample value is represented as a 16 binary digits (1s and 0s).
A “byte” is 8 bits, so 16-bits is 2 bytes.

Example, a 16-bit number:

The two “bytes” in this number are:
11000011 (the “big” byte, or “Most Significant Byte”, or “MSB”)
00111100 (the “little” byte, or “Least Significant Byte”, or “LSB”)

Due to decisions made by computer engineers, some systems order 16-bit numbers as “MSB” followed by “LSB”, while other systems order them as “LSB” followed by “MSB”.

So the number “11000011 00111100” could be represented as either:

or as

PCM audio is usually represented as little-endian.

You can probably imagine that if you read the bytes in the wrong order, the resulting sound will be very different, as illustrated by your example.
My guess is that your “data.bin” file was written as little-endian.

Thank you for your reply, Steve!
I know basics of PCM-files architecture, but it seems that everything is a little more complicated here.

Yes, I agree with you, that this file was written as little-endian. But I have another file (this is a sample of the same instument, called “Whistle”), and when I try to import it, I can hear necessary sound only in BIG-endian mode. When I try to import it as LITTLE-endian, I can hear Accordion, which is also present in the device (an old hardware-rompler) with which I work.

It is also MONO PCM 16bit 44100hz. I attached this file below.
Thank you! (30.7 KB)

How do you know that it is 16-bit mono and not 2 x 8-bit little-endian?

And at this moment I should… THANK YOU SO MUCH!
And now I will explain a little :slight_smile:
Device from which I want to get some sounds, have a 16-bits DSP. In device user-manual I also can see, that “all samples has high-quality 16bit resolution” (and for some reason I believed it). But in real world, it turned out wrong. Of course, a lot of samples recorded as 16-bit PCM, but “Whistle” and “Accordion” turned out to be 8 bit. And now I know, what I need to separate this samples.

Thank you again, Steve! Have a nice day! :slight_smile:

Thank you for sharing. I’d love to check that file out.