Jump to content
  • 0

PCM samples are signed?



2 answers to this question

Recommended Posts

  • 0

It's at the tail end of the official documentation:

Audio data formats

Audio data is two's complement signed. Depending on the selected mode the data needs to be written to the FIFO in the following order:

Mode Order in which to write data to FIFO
8-bit mono <mono sample>
8-bit stereo <left sample> <right sample>
16-bit mono <mono sample (7:0)> <mono sample (15:8)>
16-bit stereo <left sample (7:0)> <left sample (15:8)> <right sample (7:0)> <right sample (15:8)>
Link to comment
Share on other sites

  • 0

"Two's complement signed" means it's a signed integer. If the "two's complement" part is what's confusing, it's the same way that C and C++ represent their signed numbers.

To negate a value in two's complement, invert all the bits and then add 1 to the result.

So, for instance, 0x0001 is "1", to create "-1" you would invert all the bits (getting 0xFFFE) and then add 1 (getting 0xFFFF, which is "-1" in two's complement). Similarly, negating -1 starts by negating all the bits (getting 0x0000) and then adding 1 (getting 0x0001, which is "1" in two's complement).

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

Please review our Terms of Use