Audio recorder : saving in .mp3

Hello !

I’m using the component : Audio recorder
When i’m saving the file, the only extension available is .webm
To be more usefull, the audio file’s would should an audio file extension, such as .wav, .mp3, or .m4a.

Have you plan to add another file extension (at least mp3) ?

What browser are you trying it on? I have only tried Chrome, and indeed it’s .webm. I don’t know if other browsers handle it differently.

Here’s what GPT-4 told me:

The recording format of audio in a web browser largely depends on the APIs used by the web application and the support provided by the browser itself. As of my knowledge cutoff in 2021, there’s no universal “default setting” that would only allow browsers to record audio in .webm format.

To be more specific, a common way to capture audio in a browser is to use the MediaStream Recording API (often just called the MediaRecorder API). This API allows web applications to record audio and video from a user’s device, and the recorded data can be stored as a Blob and subsequently can be processed or saved in various ways.

The output format of the MediaRecorder API, however, depends on the browser’s implementation and support. For example, as of 2021, Firefox supports recording in Ogg Opus, WebM Opus, and WebM VP8 (if video is also recorded), while Chrome supports recording in WebM Opus and WebM VP8.

audio recorded in a web browser can be stored in formats other than .webm, including .mp3, .m4a, or .wav. However, it’s important to note that the MediaRecorder API, which is commonly used to record audio in a web browser, does not natively support these formats in all browsers.

To record audio in these formats, you would generally need to use a library or service that provides the necessary audio encoding. Here’s an overview of how it can be done for each of these formats:

  • .mp3: There are JavaScript libraries like lamejs or Recordmp3.js that can convert recorded audio data to .mp3 format. However, encoding audio to .mp3 can be computationally intensive and may result in performance issues, especially on slower devices.
  • .m4a: This format is more challenging to work with in a browser-based recording context, because it’s not as widely supported as some other formats. You might need to use a server-side solution to convert the recorded audio to .m4a format.
  • .wav: This is probably the easiest of the three formats to work with, because it’s a raw audio format that doesn’t require much processing. You can use the Web Audio API to capture audio and then use a library like Recorder.js to save the audio data as a .wav file.
1 Like