24-bit wav files and other observations

John W. Eaton jwe at bevo.che.wisc.edu
Thu Feb 21 17:47:27 CST 2008


On 21-Feb-2008, Daniel J Sebald wrote:

| I wanted to read a WAV file with 24 bit data width using
| auload()--rather than the 8, 16, or 32-bit facility.  I've made some
| simple changes (see attached patch), which brings up a few issues.
| 
| 
| 1) The fread() routine always returns a variable of type 'double'.
| You'd think that the variable would have the native format.  E.g.,
| 
|   data = fread(file, samples, 'uint8', 0, arch);
| 
| would mean 'data' to be of type 'uint8'.

If you want that, then you need to write

  data = fread(file, samples, 'uint8=>uint8', 0, arch);

or

  data = fread(file, samples, '*uint8', 0, arch);

This feature is documented in the help for fread.

| 2) Why does Octave/Matlab not have 'uint24' throughout?  For
| example, there'd be nothing unusual about
| 
|   data = fread(file, samples, 'int24', 0, arch);
| 
| and a type 'int24'.

What general-purpose systems have 24-bit ints as a native data type?

| I would think that bitor(-2,1) should be -1.  Is this a bug?

The documentation for bitor says:

 -- Built-in Function:  bitor (X, Y)
     Return the bitwise OR of nonnegative integers.  X, Y must be in
     range [0..bitmax]

Maybe it is a bug that it doesn't warn or give an error for negative
values.

| 5)  Is the documentation for "who" correct?

It's best to report bugs on the bug at octave.org list.

jwe


More information about the Octave-maintainers mailing list