{"id":8373,"date":"2025-02-18T14:37:37","date_gmt":"2025-02-18T12:37:37","guid":{"rendered":"https:\/\/www.tonmeister.ca\/wordpress\/?p=8373"},"modified":"2025-02-25T15:13:22","modified_gmt":"2025-02-25T13:13:22","slug":"bit-depth-conversion-part-3","status":"publish","type":"post","link":"https:\/\/www.tonmeister.ca\/wordpress\/2025\/02\/18\/bit-depth-conversion-part-3\/","title":{"rendered":"Bit depth conversion: Part 3"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">Converting fixed point to floating point<\/h2>\n\n\n\n<p>In <a href=\"https:\/\/www.tonmeister.ca\/wordpress\/2025\/02\/16\/bit-depth-conversion-part-1\/\" data-type=\"post\" data-id=\"8340\">Part 1 <\/a>of this series, I talked about three different options for converting from a fixed-point representation to another fixed-point representation with a bigger bit depth.<\/p>\n\n\n\n<p>This happens occasionally. The simplest case is when you send a 16-bit signal to a 24-bit DAC. Another good example is when you send a 16-bit LPCM signal to a 24- or 32-bit fixed point digital signal processor. <\/p>\n\n\n\n<p>However, these days it&#8217;s more likely that the incoming fixed-point signal (incoming signals are almost <strong>always<\/strong> in a fixed-point representation) is converted to floating point for signal processing. (I covered the differences between fixed- and floating-point representations in <a href=\"https:\/\/www.tonmeister.ca\/wordpress\/2021\/07\/19\/fixed-point-vs-floating-point\/\" data-type=\"post\" data-id=\"6865\">another posting<\/a>.)<\/p>\n\n\n\n<p>If you&#8217;re converting from fixed point to floating point, you divide the sample&#8217;s value by 2^(nBits-1). In other words, if you&#8217;re converting a 5-bit signal to floating point, you divide each sample&#8217;s value by 2^4, as shown below.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"404\" height=\"788\" src=\"https:\/\/www.tonmeister.ca\/wordpress\/wp-content\/uploads\/bit_depth_pt03_fig01.png\" alt=\"\" class=\"wp-image-8374\" srcset=\"https:\/\/www.tonmeister.ca\/wordpress\/wp-content\/uploads\/bit_depth_pt03_fig01.png 404w, https:\/\/www.tonmeister.ca\/wordpress\/wp-content\/uploads\/bit_depth_pt03_fig01-154x300.png 154w\" sizes=\"auto, (max-width: 404px) 100vw, 404px\" \/><figcaption class=\"wp-element-caption\">Figure 1. Converting a 5-bit fixed point signal to floating point<\/figcaption><\/figure>\n<\/div>\n\n\n<p>The reason for this is that there are 2^(nBits-1) quantisation levels for the negative portions of the signal. The positive-going portions have one fewer levels due to the two&#8217;s complement representation (the 00000 had to come from somewhere&#8230;).<\/p>\n\n\n\n<p>So, you want the most-negative value to correspond to -1.0000 in the floating point world, and then everything else looks after itself.<\/p>\n\n\n\n<p>Of course, this means that you will never hit +1.0. You&#8217;ll have a maximum signal level of 1 &#8211; 1\/2^(nBits-1), which is very close. Close enough.<\/p>\n\n\n\n<p>The nice thing about doing this conversation is that by entering into a floating point world, you immediately gain resolution to attenuate and headroom to increase the gain of the signal &#8211; which is exactly what we do when we start processing things.<\/p>\n\n\n\n<p>Of course, this also means that, when you&#8217;re done processing, you&#8217;ll need to feed the signal out to a fixed-point world again (for example, to a DAC or to an S\/PDIF output). That conversion is the topic of Part 4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Converting fixed point to floating point In Part 1 of this series, I talked about three different options for converting from a fixed-point representation to another fixed-point representation with a bigger bit depth. This happens occasionally. The simplest case is when you send a 16-bit signal to a 24-bit DAC. Another good example is when [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":true,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[63,4,59],"tags":[],"class_list":["post-8373","post","type-post","status-publish","format-standard","hentry","category-analysis","category-audio","category-digital-audio"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p48hIM-2b3","_links":{"self":[{"href":"https:\/\/www.tonmeister.ca\/wordpress\/wp-json\/wp\/v2\/posts\/8373","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tonmeister.ca\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tonmeister.ca\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tonmeister.ca\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tonmeister.ca\/wordpress\/wp-json\/wp\/v2\/comments?post=8373"}],"version-history":[{"count":2,"href":"https:\/\/www.tonmeister.ca\/wordpress\/wp-json\/wp\/v2\/posts\/8373\/revisions"}],"predecessor-version":[{"id":8387,"href":"https:\/\/www.tonmeister.ca\/wordpress\/wp-json\/wp\/v2\/posts\/8373\/revisions\/8387"}],"wp:attachment":[{"href":"https:\/\/www.tonmeister.ca\/wordpress\/wp-json\/wp\/v2\/media?parent=8373"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tonmeister.ca\/wordpress\/wp-json\/wp\/v2\/categories?post=8373"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tonmeister.ca\/wordpress\/wp-json\/wp\/v2\/tags?post=8373"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}