question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

audio file format

See original GitHub issue

Hi,

I am trying to record audio in the browser

    const {
        status,
        startRecording,
        stopRecording,
        mediaBlobUrl,
    } = useReactMediaRecorder({
        video: false,
        audio: true,
        blobPropertyBag: {
            type: "audio/wav"
        }
    });

and fetching the file from it

            const audioBlob = await fetch(mediaBlobUrl).then(r => r.blob());

            console.log(audioBlob);

            const audiofile = new File([audioBlob], `${uuidv4()}.wav`, { type: "audio/wav" })

Now i saved this file in disk, and used file audio.wav

and it shows up as as WebM file

$ file b61508fa-9c4e-47fc-bb54-5def7abf9bfc.wav                                                         ─╯
b61508fa-9c4e-47fc-bb54-5def7abf9bfc.wav: WebM

what i need is a wav file ! and it is giving me a WebM file

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:13 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
0x006Fcommented, Nov 29, 2020

blobPropertyBag is used only for generating the blobs (after the recording has been completed) inside the media recorder. If you want to use a specific codec to use, you need to pass through mediaRecorderOptions. It’ll check for the browser support first and will emit a console.error if there’s no support. I’d say not to use the blobPropertyBag if it’s not a big-deal. It’s just a placeholder for extending the Blob object. Or else we need to keep them in-sync.

That being said, currently this library defaults to video/mp4 / audio/wav while generating the blob, which is kinda incorrect. That needs to be fixed.

For a quick conversion, I’d suggest ffmepg, which has webm --> wav support I believe.

0reactions
olegpanchenkocommented, Aug 23, 2022
 useReactMediaRecorder({ mediaRecorderOptions: { mimeType: 'audio/wav' } });
Read more comments on GitHub >

github_iconTop Results From Across the Web

Audio file format - Wikipedia
An audio file format is a file format for storing digital audio data on a computer system. The bit layout of the audio...
Read more >
The 10 Most Common Audio Formats: Which One Should You ...
Audio File Format: MP3 · Audio File Format: AAC · Audio File Format: OGG (Vorbis) · Audio File Format: WMA (Lossy).
Read more >
Best audio format file types | Adobe
The best audio format types for audiophiles. · MP3 MP3 (MPEG-1 Audio Layer III) is the most popular of the lossy formats. ·...
Read more >
Top 10 Audio File Formats - Sage Audio
Top 10 Audio File Formats · 10. DSD · 9. Ogg Vorbis · 8. WMA (Lossless) · 7. WMA (Lossy) · 6. ALAC...
Read more >
Audio Format - GeeksforGeeks
Audio Format ; PCM – · WAV – · AIFF – ; MP3 – · AAC – · WMA – ; FLAC –...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found