bugGNU Octave - Bugs: bug #64388, audiowrite of mp3s fails


bug #64388: audiowrite of mp3s fails

Submitter:  John Donoghue <lostbard>
Submitted:  Thu 06 Jul 2023 03:56:04 PM UTC
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Ready For Test Assigned to:  None
Originator Name:  lostbard Open/Closed:  * Open
Release:  * dev Operating System:  * Any
Fixed Release:  9.1.0 (current default) Planned Release:  9.1.0 (current default)
* Mandatory Fields

Add a New Comment Rich Markup

Sat 15 Jul 2023 10:01:09 AM UTC, comment #5: 

Thanks for your patch.

I understand that the identifiers that are checked in the configure test are enum values (not preprocessor macros). That means that a configure test is required. I also understand that we need a new preprocessor macro if we don't want to impose stricter requirements to the sndfile library that we link to.

Afaict, the requirement for ogg file support in the sndfile library is in place since at least 2015:
There's probably little point to make it optional now.

Given that, I pushed your patch (with some minor changes) to the default branch of Octave:

Would it make sense to also add a BIST for that? Maybe, writing a sine to a .mp3 file and reading it back?

Marking as ready for test.

Markus M├╝tzel <mmuetzel>
Group Member
Thu 06 Jul 2023 06:54:52 PM UTC, comment #4: 

Looking at the current configure, we already do a test to see if ogg support is available (Test is 'whether sndfile library is modern enough') which if I didnt miss anything in the code is just so we dont have to #if the ogg support ?

John Donoghue <lostbard>
Group Member
Thu 06 Jul 2023 06:25:59 PM UTC, comment #3: 

the macros are enums rather than defines so cant be #if defined

John Donoghue <lostbard>
Group Member
Thu 06 Jul 2023 04:50:19 PM UTC, comment #2: 

Do we need the configure check?  Couldn't we just check whether the necessary macros are defined in the source file itself?

John W. Eaton <jwe>
Group administrator
Thu 06 Jul 2023 03:57:27 PM UTC, comment #1: 

Possible patch added

(file #54911)

John Donoghue <lostbard>
Group Member
Thu 06 Jul 2023 03:56:04 PM UTC, original submission:  

Newer versions of libsndfile support writing mp3 files and octave audioread will read the files correctly

However audiowrite does not work as the file extension has not been added to octave

octave:1> s = rand(8000,1);
octave:2> audiowrite("test2.mp3", s, 8000)
error: audiowrite: failed to open output file 'test2.mp3': Error : major format is 0.

John Donoghue <lostbard>
Group Member


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

Attach Files:

Attached Files
file #54911:  mp3_1.patch added by lostbard (3KiB - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by mmuetzel (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by lostbard (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 project members can vote.


    Follow 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2023-07-15 mmuetzel StatusNone Ready For Test
        Releasestable dev
        Fixed ReleaseNone 9.1.0 (current default)
        Planned ReleaseNone 9.1.0 (current default)
    2023-07-06 lostbard Attached File- Added mp3_1.patch, #54911

    Back to the top

    Powered by Savane 3.12