IPB

Welcome Guest ( Log In | Register )

9 Pages V   1 2 3 > »   
Closed TopicStart new topic
Is it possible to stretch 16 bits symmetrically?, instead of padding with zeros?
giro1991
post Apr 13 2014, 20:40
Post #1





Group: Members
Posts: 124
Joined: 27-February 13
Member No.: 106916



Hello all,

Odd question but is it possible to stretch 16 bits file outward symetrically to 32bit, instead of padding?

Perhaps with addition of upsampling at the same time could generate a new wave entirely in the digital 'realm'.
Like an artifical re-creation of the wave.

Thoughts welcome.

Cheers

EDIT, is fixed / floating point precision related to this?

This post has been edited by giro1991: Apr 13 2014, 20:55


--------------------
www.realitymod.com member
Go to the top of the page
+Quote Post
Nick.C
post Apr 13 2014, 21:21
Post #2


lossyWAV Developer


Group: Developer
Posts: 1801
Joined: 11-April 07
From: Wherever here is
Member No.: 42400



QUOTE (giro1991 @ Apr 13 2014, 20:40) *
Odd question but is it possible to stretch 16 bits file outward symetrically to 32bit, instead of padding?


Padding with 16-bits moves the existing 16-bit samples 16-bits apart, i.e. multiplies them by 65536. Is that not stretching?


--------------------
lossyWAV -q X -a 4 --feedback 4| FLAC -8 ~= 320kbps
Go to the top of the page
+Quote Post
xnor
post Apr 13 2014, 21:22
Post #3





Group: Developer
Posts: 814
Joined: 29-April 11
From: Austria
Member No.: 90198



16-bit signed: -32768 to +32767.
Example: a value of 8 (binary 1000) is -72.25 dB below full scale.

32-bit signed: -2147483648 to +2147483647.
Example: a value of 8*65536 = 524288 (binary 1000 0000 0000 0000 0000) is -72.25 dB below full scale.


Anything other than multiplying by 65536 (the 16 extra bits = 2^16) will result in distortion.
In binary, a multiplication by 2 is just shifting all bits to the left by one bit. Multiplying by 2^16 is equivalent to shifting all bits to the left 16 times.


edit: The extra 16 bits just add extra dynamic range.
Think of it this way: if you don't multiply the values you get the same signal at 32 bits but a very low level. Above the original values you then have 16 empty bits for extra dynamic range.

This post has been edited by xnor: Apr 13 2014, 21:38
Go to the top of the page
+Quote Post
Octocontrabass
post Apr 13 2014, 21:44
Post #4





Group: Members
Posts: 57
Joined: 9-September 13
Member No.: 110004



I know that for unsigned integers, the simplest way to stretch a lower number of bits to a higher number of bits while maintaining the full range is to duplicate the higher bits into the low bits. For 16-bit to 32-bit, you'd just duplicate the entire 16 bits. This method is frequently used in image processing, where it is important that the range of color is not reduced during upsampling.

This method is slightly incorrect for signed values, which are typical of 16-bit audio. I never did work out if there was an easier way, but you could achieve the correct results by converting to unsigned, upsampling, and then converting back to signed.

If the destination format is floating-point, then it's even easier: convert the number to a float, then divide by 32767.


However, I would choose to zero-pad in order to upconvert. It is mathematically correct for both signed and unsigned, and some lossless codecs (including FLAC, which I typically use) have specific optimizations to compress the padding.


I don't know of any algorithms that would help "regenerate" the lower bits, but I do know that there is not much sense in trying if the audio is already 16-bit to begin with.
Go to the top of the page
+Quote Post
saratoga
post Apr 13 2014, 22:15
Post #5





Group: Members
Posts: 5046
Joined: 2-September 02
Member No.: 3264



This question doesn't make sense, but probably ordinary zero padding is what the OP is asking for.
Go to the top of the page
+Quote Post
db1989
post Apr 13 2014, 23:08
Post #6





Group: Super Moderator
Posts: 5275
Joined: 23-June 06
Member No.: 32180



QUOTE (xnor @ Apr 13 2014, 21:22) *
edit: The extra 16 bits just add extra dynamic range.
Think of it this way: if you don't multiply the values you get the same signal at 32 bits but a very low level. Above the original values you then have 16 empty bits for extra dynamic range.
Whereas if you do shift/0-pad, you get the signal at the same level but with more room for finer details in the new lower bits.
Go to the top of the page
+Quote Post
Martel
post Apr 14 2014, 09:54
Post #7





Group: Members
Posts: 553
Joined: 31-May 04
From: Czech Rep.
Member No.: 14430



QUOTE (giro1991 @ Apr 13 2014, 20:40) *
Perhaps with addition of upsampling at the same time could generate a new wave entirely in the digital 'realm'.
Like an artifical re-creation of the wave.
You can't get any more information about the original wave than what was in the original digitized waveform. No amount of upsampling/upconverting is going to re-introduce information lost during digitization of the original signal.
What you call "an artifical re-creation of the wave" is actually done in a digital-to-analogue converter and results in a "perfectly smooth" analogue wave. Only frequencies above half of the original sampling frequency are missing and quiet components might drown in the quantization noise. But all this was already lost, the best you could do is somehow make up the missing information (empirical/statistical modelling) but this is never going to be perfect (the precise information is lost).

If you convert a 44.1kHz/16bit waveform of a 1kHz sine wave to 192kHz/24bit, it will appear "smoother" (i.e. it will have more samples, there will be sample values using all 24 bits) but no additional information will be actually created.

This post has been edited by Martel: Apr 14 2014, 10:02


--------------------
IE4 Rockbox Clip+ AAC@192; HD 668B/HD 518 Xonar DX FB2k FLAC;
Go to the top of the page
+Quote Post
giro1991
post Apr 14 2014, 16:09
Post #8





Group: Members
Posts: 124
Joined: 27-February 13
Member No.: 106916



QUOTE (Octocontrabass @ Apr 13 2014, 21:44) *
... you could achieve the correct results by converting to unsigned, upsampling, and then converting back to signed.

If the destination format is floating-point, then it's even easier: convert the number to a float, then divide by 32767.

I don't know of any algorithms that would help "regenerate" the lower bits, but I do know that there is not much sense in trying if the audio is already 16-bit to begin with.


Yes, this is my main curiosity.
Consider computer graphics for example, edges in games are jagged by default, then it is up to another (independant) algorithm to smooth out edges. Likewise for images.

From that smooth edge produced you can always go back to the orginal by reversing surely.

QUOTE (Martel @ Apr 14 2014, 09:54) *
What you call "an artifical re-creation of the wave" is actually done in a digital-to-analogue converter and results in a "perfectly smooth" analogue wave."


Forget "digital filters" found on hardware for time being.
Smoothness in the dsp realm is what would like to acheive, if input is 16, obviously you need to down convert to 16bit for playback, what what i'm interested in though is the stage between, which exists only in the computational realm, a signal to 'work with'.

I am aware you can't add details from the original session/track of course, but that is not my curiosity..

I notice foobar pipeline is 32bit float internal, If I were to enable an up sampler for example, I wonder if the wave is zero padded or in fact a genuine wave spanning the enire 32bit realm or whther or not I need to infact sign and unsign in between, with the additonal samples of course.

This post has been edited by giro1991: Apr 14 2014, 16:10


--------------------
www.realitymod.com member
Go to the top of the page
+Quote Post
giro1991
post Apr 14 2014, 16:12
Post #9





Group: Members
Posts: 124
Joined: 27-February 13
Member No.: 106916



It may be odd question but reciprocal thinking is healthy.


--------------------
www.realitymod.com member
Go to the top of the page
+Quote Post
pdq
post Apr 14 2014, 16:29
Post #10





Group: Members
Posts: 3422
Joined: 1-September 05
From: SE Pennsylvania
Member No.: 24233



QUOTE (giro1991 @ Apr 14 2014, 11:12) *
It may be odd question but reciprocal thinking is healthy.

That may be, but until someone here actually understands what you are trying to ask, you may not get any satisfactory answers.
Go to the top of the page
+Quote Post
saratoga
post Apr 14 2014, 16:31
Post #11





Group: Members
Posts: 5046
Joined: 2-September 02
Member No.: 3264



Resizing an image is analogous to resampling audio, not zero padding.
Go to the top of the page
+Quote Post
pdq
post Apr 14 2014, 16:45
Post #12





Group: Members
Posts: 3422
Joined: 1-September 05
From: SE Pennsylvania
Member No.: 24233



If you resize an image to increase the number of pixels, it becomes closer and closer to being continuous, but no matter what, it still consists of pixels.

This is not the case with audio. The reconstruction filter that follows digital-to-analog conversion creates a true, continuous, analog signal with no "steps".
Go to the top of the page
+Quote Post
Martel
post Apr 14 2014, 16:59
Post #13





Group: Members
Posts: 553
Joined: 31-May 04
From: Czech Rep.
Member No.: 14430



Have you ever thought about why computer games take a considerable performance hit from enabling anti-aliasing? It's not just some cheap soften or edge-detection (un-informed algorithm) applied to the image. The graphics card is actually calculating more information about the image. It's not just up-converting the aliased base resolution image (without AA).


--------------------
IE4 Rockbox Clip+ AAC@192; HD 668B/HD 518 Xonar DX FB2k FLAC;
Go to the top of the page
+Quote Post
drewfx
post Apr 14 2014, 17:00
Post #14





Group: Members
Posts: 93
Joined: 17-October 09
Member No.: 74078



Assuming you are trying to generate a new and different sounding (distorted) waveform and aren't trying to "add detail" or something like that to the original, it is of course possible.

Google waveshaping.
Go to the top of the page
+Quote Post
[JAZ]
post Apr 14 2014, 22:25
Post #15





Group: Members
Posts: 1787
Joined: 24-June 02
From: Catalunya(Spain)
Member No.: 2383



like saratoga said, the analogy with resizing an image is actually equivalent to resampling, and resampling is perfectly possible with audio.

The correct analogy is color bit depth. You cannot get a 24bit color image out of a 8bit image, just like you cannot get a 24bit sound file out of an 8 bit sound file. The "noise" (lack of precision) is maintained.

On Audio, I thought once of a method to "kill" the noise floor, but my (lack of) knowledge, and some limitations that I've read about point that it could produce unwanted results. Basically, it would be to try to apply the "noise gate" idea in the frequency domain. I.e. audio->frequency, zero frequencies below a determined dB range, frequency -> audio.
I had this idea when listening to some low bitrate (bad quality) MP3 files out of Vinyl. Since there weren't enough bits, the encoder was removing part of the background noise (not only because of the filter).

This post has been edited by [JAZ]: Apr 14 2014, 22:25
Go to the top of the page
+Quote Post
giro1991
post Apr 15 2014, 17:50
Post #16





Group: Members
Posts: 124
Joined: 27-February 13
Member No.: 106916



Glad hear this regarding that analogy. smile.gif I am a not a proffesional in this subject so bear with me.
I do not believe waveshaping is what I'm after.
It surprises me that I cannot find a dsp that quantizes to 32bit to create this fanatical wave.
I did find a "crusher" which can output 24bit (not sure if this is it, but it appears to work below).
24 is enough but surely 32bit would be easier to compute from 16bit?

Most application pipelines are 32/64bit float but never involve this 'spreading' because it is presumed 9/10 users have a well implimented DAC on the end to do alll this fiddle, which I am trying to acheive myself.

I'm certain a 32bit quantizer would be beneficial if used with a upsampler, to generate a signal.
Cant help but notice Quantize and quantum are alike - picture the digital 'realm'I picture it like this in my head, though not as many waves.

This is the closest I got to below, though only 24bit, and the results through mobo output improved considerably in the treble tregion, I even applied a steep filter at 10k (like the Asus One does!) and the highs differed very little which really surprised me, though I am doing this through rubbish portable speakers, the result is definately pleasant compared to default mobo dac.
So much so it makes me wonder how they are even classed as safe for manufacture because the highs are litterally deafening.

I was reading the application of a 14bit dac from the 80's to get an idea and noticed the clever use of a ramp like dither applied towards the end of the spectrum to keep SNR low and slow roll off to aid output in a way I can not explain technically (which is what makes CDPs sound how they do, it essentially a DSP priot to dac).

There is also this same ramp shape on the geektronic dsp and can be made to to oscilate with the speed notch.


I know to some people on this forum this is not news, but for laymen like myself it would very interesting to experiment with a 32 bit quantizer, if one exists.


--------------------
www.realitymod.com member
Go to the top of the page
+Quote Post
saratoga
post Apr 15 2014, 17:56
Post #17





Group: Members
Posts: 5046
Joined: 2-September 02
Member No.: 3264



QUOTE (giro1991 @ Apr 15 2014, 12:50) *
Glad hear this regarding that analogy. smile.gif I am a not a proffesional in this subject so bear with me.
I do not believe waveshaping is what I'm after.
It surprises me that I cannot find a dsp that quantizes to 32bit to create this fanatical wave.


On a typical PC, almost all DSP effects will be quantized at 32 bits because they use 32/64 bit processors. Beyond what you already have, I do not understand what you are expecting to find.
Go to the top of the page
+Quote Post
giro1991
post Apr 15 2014, 18:08
Post #18





Group: Members
Posts: 124
Joined: 27-February 13
Member No.: 106916



The way I picture it,
bit depth is vertical definition and
sample rate is horizontal definition.
surely, stretching bitdepth (however acheived) would allow more definition... and you could technically keep adding definition, (not from the original source of course) but definition in the quantum realm.

EDIT: as opposed to padding with zero's which im certain is what pieplines do.

This post has been edited by giro1991: Apr 15 2014, 18:11


--------------------
www.realitymod.com member
Go to the top of the page
+Quote Post
giro1991
post Apr 15 2014, 18:18
Post #19





Group: Members
Posts: 124
Joined: 27-February 13
Member No.: 106916



QUOTE (xnor @ Apr 13 2014, 21:22) *
edit: The extra 16 bits just add extra dynamic range.

Perhaps in a playback sense yes, but isnt dynamic range just a measure that exists otherwise in the digital realm?


--------------------
www.realitymod.com member
Go to the top of the page
+Quote Post
saratoga
post Apr 15 2014, 19:09
Post #20





Group: Members
Posts: 5046
Joined: 2-September 02
Member No.: 3264



QUOTE (giro1991 @ Apr 15 2014, 13:08) *
EDIT: as opposed to padding with zero's which im certain is what pieplines do.


They're exactly the same thing. One and the same.

And yes, internally everything you're processing is running at 32 bit or higher, so this is being done for you already.
Go to the top of the page
+Quote Post
db1989
post Apr 15 2014, 19:16
Post #21





Group: Super Moderator
Posts: 5275
Joined: 23-June 06
Member No.: 32180



Multiplying a.k.a. shifting a.k.a. padding with 0s is stretching the sampling points.

0 becomes 0. 1 becomes 2. 2 becomes 4. And so on.

QUOTE
I am a not a proffesional in this subject so bear with me.
You donít need to be a professional to think about this for a few seconds and realise that what you want is already being done and your alternative hypothetical methods are nonsensical.
Go to the top of the page
+Quote Post
[JAZ]
post Apr 15 2014, 22:39
Post #22





Group: Members
Posts: 1787
Joined: 24-June 02
From: Catalunya(Spain)
Member No.: 2383



I should start by saying that I haven't understand half of your post, so this is an advise.

Said that, you are still confusing concepts. Audio is one dimensional. 2D Graphics are two dimensional. 3D graphics are three dimensional. Or said it in other words, at one point in time, audio has only one value, graphics have an X/Y or X/Y/X coordinate (depending on 2D or 3D).

As I said before, you should not think on audio bitdepth as a "vertical", or "Y" coordinate. It is comparable to color depth, not to any coordinate.

When audio is sampled, it is sampled at a constant speed. This gives it some properties which translate in preserving frequencies up to half its samplerate (strictly lower than). With adequate algorithms, the samplerate can be changed while maintaining all the frequencies (depending on the filter slope used, and always being the highest one to preseve, less than double the samplerate).

But while the time is strictly defined and constant (and even when it isn't, and there's jitter, most of the time it can be safely ignored), the same isn't true for the value we store for that time. We quantize to a discrete amount of values, determined by the bit depth used.

Say we record 33.40, 44.15, 25.90. But when writing the file, we need to store 33, 44 and 26. The difference between the real value and the value stored is not only a numerical difference, but also part of the audio that will be reproduced. The correct term is quantization distortion.
This distortion will be present in the audio, is correlated to the signal, and isn't nice.
To avoid the correlation, which is what makes it bad, a process called "dither" is applied, which means that, instead of quantizing based on the recorded value, a noise signal is added before quantizing (which can be of different kinds, and desirably shaped so that more noise is present in the upper frequencies, to improve the lower ones).

So now, this noise+signal+quantization is going to become only signal by which means exactly?



Edit: Just to make it clear... What i am saying is that audio bit depth cannot be improved. As it has been said, when increasing the bit depth, the usual method is zero-padding. It's the safest bet. One can also add noise at the next bit, but adding noise on all new bits is useless.

Edit2: It just occurred to me that the other concept that you might think when talking about stretching isn't what you expect. If you expand the 16bits, so that they are evenly distributed on a 24bit signal, or 32bit signal, what you have achieved is volume boosting it. But since 24 or 32bit have the same 0dBFS, what you end with is a more silent file, with the opposite effect of a DSP compressor.

This post has been edited by [JAZ]: Apr 15 2014, 22:49
Go to the top of the page
+Quote Post
xnor
post Apr 16 2014, 13:51
Post #23





Group: Developer
Posts: 814
Joined: 29-April 11
From: Austria
Member No.: 90198



QUOTE (giro1991 @ Apr 15 2014, 18:08) *
The way I picture it,
bit depth is vertical definition and
sample rate is horizontal definition.
surely, stretching bitdepth (however acheived) would allow more definition... and you could technically keep adding definition, (not from the original source of course) but definition in the quantum realm.

EDIT: as opposed to padding with zero's which im certain is what pieplines do.

Well kinda, see [JAZ]'s post above.

At each sampling interval you measure the current value, for example 0.472392 and then you quantize to 16 bits 0.472392 * 32768 = 15479[.341056]. The decimal places cannot be stored so you get a quantization error.

This error is irreversible.
If you resample to a higher sample rate all you do is interpolate between existing points (that all have quantization errors).
If you increase the bit depth you get exactly the same signal with some empty (wasted) bits.

Higher bit depth makes sense when you do processing. If you quantized back to 16 bits after each processing step you would potentially accumulate a lot of errors.




QUOTE (giro1991 @ Apr 15 2014, 18:18) *
Perhaps in a playback sense yes, but isnt dynamic range just a measure that exists otherwise in the digital realm?

Put simply, increasing dynamic range is all that extra bits do. You can only make use of this though, if the original signal uses that dynamic range or even exceed it.

This post has been edited by xnor: Apr 16 2014, 13:54
Go to the top of the page
+Quote Post
dhromed
post Apr 16 2014, 14:30
Post #24





Group: Members
Posts: 1323
Joined: 16-February 08
From: NL
Member No.: 51347



QUOTE (giro1991 @ Apr 15 2014, 18:08) *
surely, stretching bitdepth (however acheived) would allow more definition


You're confusing stretching a value across a new range, with "stretching" the bits that represent that value.

Say, the maximum 4-bit value is:

1111

And then you "stretch" it across 8 bits, according to your idea:

10101010

It's no longer the maximum! It's just a random value. You just distorted the signal. Good job.

The correct way is padding:

11110000

We don't know anything about those lower 4 bits. That information does not exist. At all. Therefore we can't make them 1111 as well.

Go to the top of the page
+Quote Post
DVDdoug
post Apr 16 2014, 20:18
Post #25





Group: Members
Posts: 2637
Joined: 24-August 07
From: Silicon Valley
Member No.: 46454



QUOTE
Is it possible to stretch 16 bits symetrically?, instead of padding with zero's?
I have another simple analogy for you -

If you convert dollars to cents, it gets "padded with zeros".

If you convert meters to millimeters, it gets "padded with zeros".

Remember we are starting out with integers, so you can't start-out with $111.25 and get 11125 cents. If you start with $111 you get 11100 cents... Two more zeros with no more information.

Now once you've converted to pennies, you can start keeping track of changes, deposits, withdrawals, interest, etc., with more precision. But with 32-bit audio it's sort-of like keeping track of 1/1000th or 1 millionth of a penny... Too small to worry about...

This post has been edited by DVDdoug: Apr 16 2014, 20:42
Go to the top of the page
+Quote Post

9 Pages V   1 2 3 > » 
Closed TopicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 23rd October 2014 - 19:18