[Stk] Using 24bit wav andd aiff files

Perry Cook prc at cs.princeton.edu
Mon Jun 20 09:57:23 PDT 2011


I think I've run across different packings and byte orders for 24 bit audio,
even within something like a .wav file.   This is for file storage, and not
real-time, but it might be worth researching if there is a variety of 
permutations for 24 bit streams as well.  You might need to introduce
a new SINT24LO, and SINT24HI (also aliased to SINT24 for backward
compability ??).

PRC

On Jun 20, 2011, at 9:49 AM, Gary Scavone wrote:

> Hi Carlos,
> 
> I recently noticed some discrepancies with 24-bit support in STK (and RtAudio).  While SINT24 was listed as "Upper 3 bytes of 32-bit signed integer", the code in FileRead was partly assuming it to be the lower 3 bytes.  After some consideration, I decided to change the definition of SINT24 to the "lower 3 bytes" for the next release, with the resulting addition of one line to the FileRead :: open() function code:
> 
>     if ( fread( &buf, 3, 1, fd_ ) != 1 ) goto error;
> +      buf >>= 8;
>      if ( byteswap_ ) ...
> 
> Is this the problem you found?  Do you see any particular advantage to defining an SINT24 to be the upper vs. the lower 3 bytes?
> 
> Regards,
> 
> --gary
> 
> On 2011-06-11, at 1:18 PM, Carlos Luna wrote:
> 
>> Hi. I´ve just began using STK and have found it very interesting. I hope I can contribute to this project in the future. Now, to the point: has anyone been able to load a 24bit file using the FileRead class (STK ver. 4.4.2)? When I try to load a 24bit wav file, it gives me an error (FileRead: 24 bits per sample with data format 1 are not supported) and refuses to load. When loading a 24 bit aiff file, it loads but then the playback outputs just noise.
>> 
>> I´ve written some fixes for this, and now it seems to work ok (for both wav and aiff files). But before posting them, I´d like to know if this is a general problem (and somehow, no one has needed to use 24 bit files before) or it´s just me not knowing how to correctly use the FileRead class.
>> _______________________________________________
>> Stk mailing list
>> Stk at ccrma.stanford.edu
>> http://ccrma-mail.stanford.edu/mailman/listinfo/stk
> 
> 
> _______________________________________________
> Stk mailing list
> Stk at ccrma.stanford.edu
> http://ccrma-mail.stanford.edu/mailman/listinfo/stk




More information about the Stk mailing list