bugGNU Octave - Bugs: bug #45490, audiowrite / wavwrite writes 32bit...

 
 

bug #45490: audiowrite / wavwrite writes 32bit samples as int32 instead of float32

Submitted by:  None
Submitted on:  Wed 08 Jul 2015 06:53:05 AM UTC  
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Marc René Schädler Originator Email:  -email is unavailable-
Open/Closed:  Closed Release:  dev
Operating System:  Any

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Tue 05 Sep 2017 10:11:35 PM UTC, comment #6: 

Looks good to me, and works, thanks.

Mike Miller <mtmiller>
Project Administrator
Tue 05 Sep 2017 06:05:33 PM UTC, comment #5: 

I went ahead and pushed the patch here (http://hg.savannah.gnu.org/hgweb/octave/rev/d21de523dbce).  I also added some more input validation of the Quality parameter, and added BIST tests for input validation.  Marking as fixed and closing report.

Rik <rik5>
Project Administrator
Fri 01 Sep 2017 11:23:11 PM UTC, comment #4: 

Any action on this bug?  There is a table at https://www.mathworks.com/help/matlab/ref/audiowrite.html that Octave should follow.  It lists the output format which depends on the file extension ('.wav'), the class of the input, and the number of bits per sample.

I tried

audiowrite ('single32.wav', xs, 8000, 'BitsPerSample', 32)
audiowrite ('int32.wav', xint32, 8000, 'BitsPerSample', 32)

and then in the shell I used 'file' to check the resulting WAV formats.  Both files are

int32.wav: RIFF (little-endian) data, WAVE audio, Microsoft PCM, 32 bit, mono 8000 Hz

It sounded like Mike thought this would be very easy.  I made a stab at it and am attaching the patch to this report.  I also changed the output to PCM32 when Bits Per Sample is 24 for compatibility with Matlab.  I also added a decode for Bits Per Sample == 64 which maps to SF_DOUBLE_FORMAT.

(file #41712)

Rik <rik5>
Project Administrator
Sat 25 Jul 2015 04:56:21 AM UTC, comment #3: 

Confirmed this bug still applies to the current implementation of the wavwrite / audiowrite functions.

https://www.mathworks.com/help/matlab/ref/audiowrite.html
https://www.mathworks.com/help/matlab/ref/wavwrite.html

This should be simple to add special cases to audiowrite if the file format is WAV (as we currently do to make 8-bit PCM be unsigned for WAV files).

Mike Miller <mtmiller>
Project Administrator
Tue 14 Jul 2015 05:37:37 PM UTC, comment #2: 

Can you please try your tests in Octave 4.0? The wavread and wavwrite functions have been completely overhauled in version 4.0. I can't recall the supported PCM sample formats, but it is almost certainly different from 3.8. I'll try and look at this later myself when I get a chance.

Mike Miller <mtmiller>
Project Administrator
Tue 14 Jul 2015 05:32:45 PM UTC, comment #1: 

The use of int32 is very uncommon and I wonder if anyone supports it. As long as the behaviour is documented, and it is possible to write a PCM_IEEE_FLOAT file, it is fine. When discussing the RIFF wave format, we should use WAVEFORMATEXTENSIBLE for anything else than int16 and uint8. This affects wavread, which does not support that format.

Anonymous
Wed 08 Jul 2015 06:53:05 AM UTC, original submission:  

Matlabs wavwrite seems to write 32bit samples as type 3 normalized floating point.
Octaves wavwrite saves them as int32.

[1] http://de.mathworks.com/help/matlab/ref/wavwrite.html

Anonymous

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #41712:  bug45490.cset added by rik5 (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 rik5 (Updated the item)
  • -email is unavailable- added by mtmiller (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 9 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2017-09-05 rik5 StatusPatch Submitted => Fixed
        Open/ClosedOpen => Closed
    2017-09-01 rik5 Attached File- => Added bug45490.cset, #41712
        StatusConfirmed => Patch Submitted
    2017-08-21 mtmiller Summarywavwrite writes 32bit samples as int32 instead of float32 => audiowrite / wavwrite writes 32bit samples as int32 instead of float32
    2015-07-25 mtmiller StatusNeed Info => Confirmed
        Release3.8.2 => dev
        Operating SystemGNU/Linux => Any
    2015-07-14 mtmiller StatusNone => Need Info

    Back to the top


    Powered by Savane 3.5