C++ Reading the Data part of a WAV file

This image is taken from a Stanford course So you can see that the audio data occurs immediately after the headers you already read and there will be Subchunk2Size bytes of audio data. The pseudocode for this would be ReadRIFF(); ReadFMT(); int32 chunk2Id = Read32(BigEndian); int32 chunk2Size = Read32(LittleEndian); for (int i = 0; i … Read more

Downsampling wav audio file

You can use Librosa’s load() function, import librosa y, s = librosa.load(‘test.wav’, sr=8000) # Downsample 44.1kHz to 8kHz The extra effort to install Librosa is probably worth the peace of mind. Pro-tip: when installing Librosa on Anaconda, you need to install ffmpeg as well, so pip install librosa conda install -c conda-forge ffmpeg This saves … Read more

Python convert wav to mp3

I wrote a python library, pydub, that essentially does what Corey’s Answer suggests, though it uses ffmpeg in to do the conversions in order to support more formats. from pydub import AudioSegment AudioSegment.from_wav(“/input/file.wav”).export(“/output/file.mp3″, format=”mp3”)

How to join two wav files using python?

Python ships with the wave module that will do what you need. The example below works when the details of the files (mono or stereo, frame rates, etc) are the same: import wave infiles = [“sound_1.wav”, “sound_2.wav”] outfile = “sounds.wav” data= [] for infile in infiles: w = wave.open(infile, ‘rb’) data.append( [w.getparams(), w.readframes(w.getnframes())] ) w.close() … Read more

Converting WAV to any compressed audio format in client-side JavaScript

I’ve made an audio recorder that records to mp3 directly from the browser combining RecorderJS and libmp3lame.js You can find the gitHub project here: https://github.com/nusofthq/Recordmp3js and a more detailed explanation of the implementation: http://nusofthq.com/blog/recording-mp3-using-only-html5-and-javascript-recordmp3-js/

Saving audio input of Android Stock speech recognition engine

You haven’t included your code for actually writing out the PCM data, so its hard to diagnose, but if you are hearing strange noises then it looks most likely you have the wrong endian when you are writing the data, or the wrong number of channels. Getting the sample rate wrong will only result in … Read more

How to encode a WAV to a mp3 on a Android device

Pure Java Look into Tritonus’s clean room implementation of javasound which offers an MP3 encoder plugin here: http://www.tritonus.org/plugins.html Secondly, I would suggest looking into jzoom’s libraries JLayer or JLayerME: http://www.javazoom.net/javalayer/javalayer.html (this may only be decode, not sure) If those doesn’t suit your need you can look at this article from 2000 about adding MP3 capabilities … Read more

How to handle Uncaught (in promise) DOMException: The play() request was interrupted by a call to pause()

For Chrome they changed autoplay policy, so you can read about here: var promise = document.querySelector(‘audio’).play(); if (promise !== undefined) { promise.then(_ => { // Autoplay started! }).catch(error => { // Autoplay was prevented. // Show a “Play” button so that user can start playback. }); }