Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8284327
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T11:04:03+00:00 2026-06-08T11:04:03+00:00

I have signed mono 16-bit PCM audio samples stored in a SInt16 buffer and

  • 0

I have signed mono 16-bit PCM audio samples stored in a SInt16 buffer and I am trying to convert them to unsigned mono 8-bit PCM samples stored in a UInt8 buffer. I’ve written the following basically-working code:

for (int i=0; i < numSamples; i++) { 
    SInt8 tempSigned8Bit = signed16BitBuffer[i]/127; // In 2 passes
    unsigned8BitBuffer[i] = tempSigned8Bit + 127;    // for clarity
}

However, I can hear clipping at the maximum amplitudes in the resulting audio, or at least that is my impression of where the distortion is occurring. Is this an artifact of the re-quantization or do I need to include some sort of clamping as described in this question about a similar conversion but without any signedness conversion:

Convert 16 bit pcm to 8 bit

Bitwise optimizations unnecessary but I certainly wouldn’t say no to them.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T11:04:06+00:00Added an answer on June 8, 2026 at 11:04 am

    This will fail for large values because you need to divide by 256 not 127. Also the offset needs to be 128, not 127.

    for (int i = 0; i < numSamples; i++) { 
        SInt8 tempSigned8Bit = signed16BitBuffer[i] / 256;
        unsigned8BitBuffer[i] = tempSigned8Bit + 128;
    }
    

    The conversion for +/- full scale and zero looks like this:

    Signed    Divide    Add
    16 bit    by 256    128
    sample
    
     32767 ->  127 ->   255    ; Full scale +
         0 ->    0 ->   128    ; 0
    -32768 -> -128 ->     0    ; Full scale -
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have signed numbers (2s complement) stored in 32-bit integers, and I want to
I have signed every jar required by the application but when trying to launch,
I have my signed assemblies here, in one of them I have a picture
I have signed them using the export wizared but when i transfer them onto
I need to get shipping rates from USPS. I have signed up with them,
I have signed my applet and it is in jar. I have added the
I have signed up(paid) for Google site search. They have me a url of
I have signed my android application with keytool but don't know what to do
In Visual Studio's Project Properties -> Signing tab, I have signed my project with
I have a signed class library that I want to create assemblies for via

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.