bugGNU Octave - Bugs: bug #38184, Octave-Forge audio has bugged...

 
 

bug #38184: Octave-Forge audio has bugged ausave on 64-bit platforms (and possibly other related bugs)

Submitter:  None
Submitted:  Mon 28 Jan 2013 07:59:56 PM UTC
   
 
Category:  Octave Package Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Duplicate Assigned to:  None
Originator Name:  Steven Braeger Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  3.6.2
Operating System:  GNU/Linux Fixed Release:  None
Planned Release:  None

Discussion locked!

Tue 29 Jan 2013 09:05:29 AM UTC, comment #1: 

Dubplicate of bug #38186.

Carnë Draug <carandraug>
Group Member
Mon 28 Jan 2013 07:59:56 PM UTC, original submission:  

/usr/share/octave/packages/audio-1.1.4/ausave.m

contains code to save data in various uncompressed audio formats.  These formats contain header printing code like: 


    ## write the magic header
    arch = 'ieee-be';
    fwrite(file, toascii('FORM'), 'char');
    fwrite(file, datasize+46, 'long', 0, arch);
    fwrite(file, toascii('AIFF'), 'char');
+verbatim+

(along with other code that performs similarly).

However, files output by this code on 64-bit platforms cannot be read by other music programs.  The reason is this...'long' on a 32-bit platform creates a 32-bit number, but a 64-bit number on a 64-bit platform, making improper file offsets.  Here is a hex dump of the first 32 bytes of a correct aiff file.

+verbatim+

  46 4F 52 4D   'FORM'
  00 89 D6 D6   32-bit datasize
  41 49 46 46   'AIFF'
  43 4F 4D 4D   'COMM'
  00 00 00 12   32-bit com field.
  00 02 00 22   ..other data
  75 9D 00 10
  40 0E AC 44


However, here is the first 32 bytes output from ausave of that same file on 64-bit octave on linux.


  46 4F 52 4D  'FORM'
  00 00 00 00
  00 89 D6 A2  64-bit datasize field
  41 49 46 46  'COMM'
  43 4F 4D 4D  'AIFF'
  00 00 00 00
  00 00 00 12  64-bit comm field
  00 02 00 00  ..other data


This file does not play in any player, reporting 'error in header, cannot play form 0' on most of them.

The fix is to change all instances of 'long' in the fwrite() calls to 'uint32' or 'int32' as appropriate..and also to do the same with the other data types 'short' and 'char' as well.  I have attached a patched version of the file. 

While you are at it, you should fix the following bug in the help string.   It reads ' Format is one of ulaw, alaw, char,
## short, long, float, double' is in the

This is not the case, as 'char' is not supported.  The correct argument should be 'uchar'


Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #27336:  ausave.m added by None (9KiB - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2013-01-29 carandraug StatusNone Duplicate
        Open/ClosedOpen Closed
        Discussion LockNone Locked
    2013-01-28 None Attached File- Added ausave.m, #27336

    Back to the top

    Powered by Savane 3.13-4b48.
    Corresponding source code