BitDepth

Started by Ingolf2,

Ingolf2

I think I can create 8 or 16 bits streams by specifying a flag for 8 bits, but i've never seen anything on 24 or 32 bits. Is it possible for bass to play 24 or 32 bit (float) data?

Ian @ un4seen

It's not currently possible to play 24/32-bit streams in BASS, but it's a possibility I'm considering since the arrival of DX9, which removed some obstacles.

I plan to look into supporting 32-bit floating-point channels. Not sure about 24/32-bit integer PCM though, there's no real need when you can use floating-point... and I don't want to bloat the thing with handling for loads of extra data formats :)

Note, DirectSound will not allow anything other than 8/16-bit on pre-Win98SE OSs, even if the hardware supports it.

Ingolf2

Aha! Didn't know that. Indeed, why use 32 bit integer when you can use floating point values. But, isn't integer calculation faster than floating point?

Another question, I calculated that 24 bits ranges from -8388608..8388607. Same as 16.7 million colors for images, but signed, am I right? Now I don't know any type of integer that holds such a value, only 32 bits which is higher. How does this work?

Simple maybe, in SoundForge it's called 32 bits IEEE float, can you tell me what that means? And is it true that 32 bits floating point data ranges from 0 to 1?

Ian @ un4seen

QuoteBut, isn't integer calculation faster than floating point?
It varies between each CPU architecture, but floating-point can often be quicker, for example multiply/divide.

QuoteAnother question, I calculated that 24 bits ranges from -8388608..8388607. Same as 16.7 million colors for images, but signed, am I right? Now I don't know any type of integer that holds such a value, only 32 bits which is higher. How does this work?
You work (do calculations etc...) in 32-bit, and then fiddle about packing it into the 24-bit sample array.

QuoteSimple maybe, in SoundForge it's called 32 bits IEEE float, can you tell me what that means? And is it true that 32 bits floating point data ranges from 0 to 1?
Yep, the "32 bits IEEE float" format data ranges -1 to 1, and is what BASS would use, if floating-point channel support is added :)

podobo

I've very interested in 24/32 bit support..

A question though, what is the 32 bit mode in XMPlay?

Ingolf2

-1..1 is what I ment indeed.

Another question then. When using 32 bit integers for calculations, I create a "file of Longint" to create a temp file of 32 bit integers. Then, when I write the data as 24 bit, so do some scaling or something from 32 to 24 bit, the data is written as 32 bit because there are always a fixed number of bytes preserved, is it not?

Ian @ un4seen

In 24-bit files (eg. 24-bit WAV or BMP) each data value is written in 3 bytes - it'd be a waste of space to use 4 bytes.

Ingolf

Then this will be a delphi question I think. How can I specify a file of 3 bytes in stead of 4? Because there is no type specifying 3 bytes, how can I create one?

Irrational86

You dont have to...what you can do is this, assign an Integer a value (no more than what 24-bit allows) and when writting it to a file, instead of using SizeOf(Integer) or 4, or anything similar, you make it write 3 bytes of it only...i guess that would work, not sure though, i havent tried this yet...

Ingolf

I have used the automated system of Delphi, which is very handy, but not at this point.

You can for example create a "file of TBitmap" type of file, and then fill in with bitmaps using Write(FileHandle, Bitmap) and read it using a similar method. Pretty cool, but in this case.

Someone should use FileCreate and WriteBuffer like methods which can take any variable and any size.

My question was just: Can I do this with the delphi system, but my guess is not.