bugGNU Octave - Bugs: bug #38186, audio package: ausave generates...

 
 

bug #38186: audio package: ausave generates unplayable files on 64-bit platforms

Submitter:  None
Submitted:  Mon 28 Jan 2013 08:03:10 PM UTC
   
 
Category:  Octave Package Severity:  2 - Minor
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Wont Fix Assigned to:  None
Originator Name:  Steven Braeger Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * other
Operating System:  * Any Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 21 Feb 2015 05:41:15 PM UTC, comment #2: 

The audio package has no maintainer currently. Lowering the priority because the upcoming Octave 4.0 release will have much improved audio read/write capabilities with the Matlab compatible audioread and audiowrite functions.

Mike Miller <mtmiller>
Group Member
Tue 29 Jan 2013 09:33:45 AM UTC, comment #1: 

Is the change of the default value for sampleformat intentional?

Carnë Draug <carandraug>
Group Member
Mon 28 Jan 2013 08:03:10 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');


(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. 



  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.)

Attach Files:
   
   
Comment:
   

Attached Files
file #27337:  ausave.m added by None (9KiB - text/x-objcsrc)
file #27338:  stuff added by None (2KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -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.

    Only group members can vote.

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-02-22 mtmiller StatusPostponed Wont Fix
        Open/ClosedOpen Closed
    2015-02-21 mtmiller Severity3 - Normal 2 - Minor
        Item GroupNone Incorrect Result
        StatusNone Postponed
        Release3.6.2 other
        Summaryaudio package has incorrect ausave.m on 64-bit platforms...generates unplayable files audio package: ausave generates unplayable files on 64-bit platforms
    2013-01-28 None Attached File- Added ausave.m, #27337
        Attached File- Added stuff, #27338

    Back to the top

    Powered by Savane 3.13-f8d8.
    Corresponding source code