# MP3 decode/encode - as system API wrapper?

**URL:** <https://forum.juce.com/t/mp3-decode-encode-as-system-api-wrapper/53596>\
**Category:** General JUCE discussion\
**Created:** [November 1, 2022, 6:51pm UTC](https://forum.juce.com/t/mp3-decode-encode-as-system-api-wrapper/53596 "2022-11-01T18:51:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![peteatjuce](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/peteatjuce/32/2347_2.png) [@peteatjuce](https://forum.juce.com/u/peteatjuce)\
**Post date:** [November 1, 2022, 6:51pm UTC](https://forum.juce.com/t/mp3-decode-encode-as-system-api-wrapper/53596/1 "2022-11-01T18:51:58Z")

</div>

Hi JUCE devs!

I’ve just been looking at the JUCE MP3 decoder.

> The code in juce\_MP3AudioFormat.cpp is NOT guaranteed to be free from infringements of 3rd-party  
> intellectual property. If you wish to use it, please seek your own independent advice about the  
> legality of doing so. If you are not willing to accept full responsibility for the consequences  
> of using this code, then do not enable the JUCE\_USE\_MP3AUDIOFORMAT setting.

I was wondering if you’d considered modifying the JUCE MP3 layer, to instead be a wrapper around the MP3 decoder (and encoder…) that’ll almost certainly be available at the platform level on most platforms?

That would remove any license related issues; and offering of an MP3 encoder in this way would be tremendously useful from an app developer perspective…

Best wishes,

Pete

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [November 2, 2022, 9:28am UTC](https://forum.juce.com/t/mp3-decode-encode-as-system-api-wrapper/53596/2 "2022-11-02T09:28:53Z")

</div>

The SoundRadix repo actually made some of those:

> [@CoreAudioWriter, anyone interested?](https://forum.juce.com/t/coreaudiowriter-anyone-interested/40716):
>
> juce::CoreAudioFormat provides support for reading a various audio formats, like .aac, .m4a and many more on macOS/iOS, but it doesn’t support writing them (in current main JUCE branch state). We’ve added support for also writing files via the new juce::CoreAudioWriter in [SR’s JUCE branch](https://github.com/soundradix/JUCE/blob/8bde5739ce2dedc5e0dc68e26ee10a08deb3fc3a/modules/juce_audio_formats/codecs/juce_CoreAudioFormat.cpp#L769), and everyone’s welcome to use or cherry-pick it, and hopefully also offer feedback or fixes if there are any issues. Note that it currently ignores the qualityOptionIndex and metaData parameters, and that our…

I also remember we did some support for Windows APIs but don’t remember what exactly (this post **not** suggesting that but I remember we had such a thing):

> [@AudioFormatReader - AAC - MP4 Reader For Windows](https://forum.juce.com/t/audioformatreader-aac-mp4-reader-for-windows/40468/6):
>
> Not afaik. But this topic is a feature request, and the best way to implement it is probably to support Media Foundation. It will allow reading not just MP4 files but other types too.

Anyway,  
System codecs can be tricky if you’re not targeting Apple and Microsoft.  
Android - some devices can have different codecs/licenses.  
Linux - each flavor is different.

---

<div class="post-metadata">

**Author:** ![peteatjuce](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/peteatjuce/32/2347_2.png) [@peteatjuce](https://forum.juce.com/u/peteatjuce)\
**Post date:** [November 2, 2022, 9:31am UTC](https://forum.juce.com/t/mp3-decode-encode-as-system-api-wrapper/53596/3 "2022-11-02T09:31:43Z")

</div>

@ttg Thank you for that!

I must say it is “odd” to see the above License disclaimer in the JUCE MP3 source code.  
If it isn’t 100% “safe” to use, why is it included at all?!

Thanks again for the pointer!

Pete

---

<div class="post-metadata">

**Author:** ![ttg](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ttg/32/14456_2.png) [@ttg](https://forum.juce.com/u/ttg)\
**Post date:** [November 2, 2022, 9:39am UTC](https://forum.juce.com/t/mp3-decode-encode-as-system-api-wrapper/53596/4 "2022-11-02T09:39:07Z")

</div>

> [@peteatjuce](#):
>
> If it isn’t 100% “safe” to use, why is it included at all?!

At least JUCE team suggests it 99% safe 🙂

> **[Vectis IP Announces Call for Patents Essential to the Opus codec](https://news.ycombinator.com/item?id=33158475)**
>
> 206 points —
> 105 comments —
> teilo —
> 1:38 AM - 11 Oct 2022

---

<div class="post-metadata">

**Author:** ![peteatjuce](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/peteatjuce/32/2347_2.png) [@peteatjuce](https://forum.juce.com/u/peteatjuce)\
**Post date:** [November 2, 2022, 9:52am UTC](https://forum.juce.com/t/mp3-decode-encode-as-system-api-wrapper/53596/5 "2022-11-02T09:52:50Z")

</div>

It is the 1% that worries me!! 😭

Best wishes Pete

---

<div class="post-metadata">

**Author:** ![yairadix](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/yairadix/32/1114_2.png) [@yairadix](https://forum.juce.com/u/yairadix)\
**Post date:** [November 2, 2022, 10:06am UTC](https://forum.juce.com/t/mp3-decode-encode-as-system-api-wrapper/53596/6 "2022-11-02T10:06:33Z")

</div>

> [@ttg](#):
>
> I also remember we did some support for Windows APIs but don’t remember what exactly (this post **not** suggesting that but I remember we had such a thing)

We do have internally, i.e not inside the JUCE fork, a writer for `.AAC` files on Windows using Media Foundation. But it’s only the writer and only for AAC. Can share it if there’s interest.
