octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #38186] audio package has incorrect ausave.m o


From: anonymous
Subject: [Octave-bug-tracker] [bug #38186] audio package has incorrect ausave.m on 64-bit platforms...generates unplayable files
Date: Mon, 28 Jan 2013 20:03:11 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.94 Safari/537.4

URL:
  <http://savannah.gnu.org/bugs/?38186>

                 Summary: audio package has incorrect ausave.m on 64-bit
platforms...generates unplayable files
                 Project: GNU Octave
            Submitted by: None
            Submitted on: Mon 28 Jan 2013 08:03:10 PM UTC
                Category: Octave Forge Package
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: None
                  Status: None
             Assigned to: None
         Originator Name: Steven Braeger
        Originator Email: address@hidden
             Open/Closed: Open
         Discussion Lock: Any
                 Release: 3.6.2
        Operating System: Any

    _______________________________________________________

Details:

/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'




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Mon 28 Jan 2013 08:03:10 PM UTC  Name: ausave.m  Size: 9kB   By: None

<http://savannah.gnu.org/bugs/download.php?file_id=27337>
-------------------------------------------------------
Date: Mon 28 Jan 2013 08:03:10 PM UTC  Name: stuff  Size: 2kB   By: None

<http://savannah.gnu.org/bugs/download.php?file_id=27338>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?38186>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]