wav
How to convert any mp3 file to .wav 16khz mono 16bit
kdazzle’s solution is almost there – it still output a stereo wav, here is a slightly modified version that generate mono: ffmpeg -i 111.mp3 -acodec pcm_s16le -ac 1 -ar 16000 out.wav also, if this is for pre-processing speech data for sphinx 4 see here: Convert audio files for CMU Sphinx 4 input
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. }); }
Get length of .wav from sox output
There is a better way: soxi -D out.wav
Can ffmpeg convert audio from raw PCM to WAV?
The wav container just adds a simple header to the raw PCM data. The header includes the format, sample rate, and number of channels. Since the raw PCM data does not include this information, you will need to specify it on the command line. Options are specified before the file they apply to, so options … Read more
What do the bytes in a .wav file represent?
You will have heard, that audio signals are represented by some kind of wave. If you have ever seen this wave diagrams with a line going up and down — that’s basically what’s inside those files. Take a look at this file picture from http://en.wikipedia.org/wiki/Sampling_rate You see your audio wave (the gray line). The current … Read more
Writing musical notes to a wav file
You’re on the right track. Let’s take a look at your example: for(int i = 0; i < data.Length; i++) data[i] = (byte)(256 * Math.Sin(i)); OK, you’ve got 11025 samples per second. You’ve got 60 seconds worth of samples. Each sample is a number between 0 and 255 which represents a small change in air … Read more
How to play .wav files with java
Finally I managed to do the following and it works fine import java.io.File; import java.io.IOException; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; import javax.sound.sampled.AudioSystem; import javax.sound.sampled.DataLine; import javax.sound.sampled.LineUnavailableException; import javax.sound.sampled.SourceDataLine; public class MakeSound { private final int BUFFER_SIZE = 128000; private File soundFile; private AudioInputStream audioStream; private AudioFormat audioFormat; private SourceDataLine sourceLine; /** * @param filename the name … Read more
Playing .mp3 and .wav in Java?
Java FX has Media and MediaPlayer classes which will play mp3 files. Example code: String bip = “bip.mp3”; Media hit = new Media(new File(bip).toURI().toString()); MediaPlayer mediaPlayer = new MediaPlayer(hit); mediaPlayer.play(); You will need the following import statements: import java.io.File; import javafx.scene.media.Media; import javafx.scene.media.MediaPlayer;