wav

Why certain .wav files cannot be decoded in Firefox

陌路散爱 提交于 2019-12-01 05:52:07
I have a web page which decodes wave files for certain reasons. Chrome and Safari seem to work fine. Firefox occasionally is unable to decode the file and gives the error: "The buffer passed to decodeAudioData contains invalid content which cannot be decoded successfully." I have created a jsfiddle which illustrates the issue: var audioCtx = new (window.AudioContext || window.webkitAudioContext)(); var source; function getData() { source = audioCtx.createBufferSource(); request = new XMLHttpRequest(); request.open('GET', 'https://mpclubtest.s3.amazonaws.com/Malice_Bass.wav', true); request

Java - downsampling wav audio file

六眼飞鱼酱① 提交于 2019-12-01 05:02:34
Hi I need to downsample a wav audio file's sample rate from 44.1kHz to 8kHz. I have to do all the work manually with a byte array...it's for academic purposes. I am currently using 2 classes, Sink and Source, to pop and push arrays of bytes. Everything goes well until I reach the part where I need to downsample the data chunk using a linear interpolation. Since I'm downsampling from 44100 to 8000 Hz, how do I interpolate a byte array containing something like 128 000 000 bytes? Right now I'm popping 5, 6 or 7 bytes depending on i%2 == 0, i%2 == 1 and i%80 == 0 and push the average of these 5,

Wav audio file compression not working

偶尔善良 提交于 2019-12-01 04:16:39
问题 Is it possible to compress a wav audio file without reducing the sampling rate? I have an audio file with 256 bit rate and sampling rate - 8000Hz. I would just like to reduce the bit rate to 128/64 kbs I tried converting to mp3 and back to wav, ffmpeg -i input.wav 1.mp3 ffmpeg -i "1.mp3" -acodec pcm_s16le -ar 4000 out.wav but this reduced sampling rate as well. ffmpeg -i "1.mp3" -acodec pcm_s16le -ab 128 out.wav has default 256 bit rate 回答1: PCM ("WAV") is uncompressed, so -b:a / -ab is

Why certain .wav files cannot be decoded in Firefox

半腔热情 提交于 2019-12-01 03:59:45
问题 I have a web page which decodes wave files for certain reasons. Chrome and Safari seem to work fine. Firefox occasionally is unable to decode the file and gives the error: "The buffer passed to decodeAudioData contains invalid content which cannot be decoded successfully." I have created a jsfiddle which illustrates the issue: var audioCtx = new (window.AudioContext || window.webkitAudioContext)(); var source; function getData() { source = audioCtx.createBufferSource(); request = new

reading a WAV file from TIMIT database in python

≯℡__Kan透↙ 提交于 2019-12-01 03:34:11
问题 I'm trying to read a wav file from the TIMIT database in python but I get an error: When I'm using wave: wave.Error: file does not start with RIFF id When I'm using scipy: ValueError: File format b'NIST'... not understood. and when I'm using librosa, the program got stuck. I tried to convert it to wav using sox: cmd = "sox " + wav_file + " -t wav " + new_wav subprocess.call(cmd, shell=True) and it didn't help. I saw an old answer referencing to the package scikits.audiolab but it looks like

How to add metadata to WAV file?

隐身守侯 提交于 2019-12-01 03:06:12
问题 I'm looking for some sample code to show me how to add metadata to the wav files we create. Anyone? 回答1: Try code below private void WaveTag() { string fileName = "in.wav"; WaveReadWriter wrw = new WaveReadWriter(File.Open(fileName, FileMode.Open, FileAccess.ReadWrite)); //removes INFO tags from audio stream wrw.WriteInfoTag(null); //writes INFO tags into audio stream Dictionary<WaveInfo, string> tag = new Dictionary<WaveInfo, string>(); tag[WaveInfo.Comments] = "Comments..."; wrw

Java - downsampling wav audio file

南楼画角 提交于 2019-12-01 02:37:58
问题 Hi I need to downsample a wav audio file's sample rate from 44.1kHz to 8kHz. I have to do all the work manually with a byte array...it's for academic purposes. I am currently using 2 classes, Sink and Source, to pop and push arrays of bytes. Everything goes well until I reach the part where I need to downsample the data chunk using a linear interpolation. Since I'm downsampling from 44100 to 8000 Hz, how do I interpolate a byte array containing something like 128 000 000 bytes? Right now I'm

Extract amplitude array from a wav File using JAVA

旧城冷巷雨未停 提交于 2019-12-01 02:35:46
I am trying to extract amplitude array from an audio file(WAV file). I will be using this amplitude array to plot amplitude vs time graph for the given wav file. I am able to plot the graph myself but does not know how to extract the amplitude from given audio(wav) file in java? Here is a helper class that you can use. The getSampleInt() method is what you need to get the amplitude: File file = ...; WavFile wav = new WavFile(file); int amplitudeExample = wav.getSampleInt(140); // 140th amplitude value. for (int i = 0; i < wav.getFramesCount(); i++) { int amplitude = wav.getSampleInt(i); //

Reduce the volume of a Wav audio file using C

怎甘沉沦 提交于 2019-12-01 01:50:39
I am writing a C program for editing a Wav audio file. I have loaded all file datas in an array of unsigned integer values (UINT16_T). Now, i would like to reduce the volume of the file. I thought it was enough to decrease the value (of a certain percentage) of the single values. But if i do that, i obtain an audio file with noise (I think I understand is called "static" or "click noise") Why? Which is the right procedure? Thank You! This is the piece of code affected: FILE* fp; FILE* fp2; /*Size of my file*/ #define BUFFER_SIZE 28242852 /*Array with file data*/ unsigned char *buffer; /*Array

Record into WAV file

老子叫甜甜 提交于 2019-11-30 23:42:16
Since I've posted this question , I've been trying to write a valid WAV file myself from raw PCM data. I've managed to write the FLAC converter (tested and works), but it does not encode the WAV files I've been writing. I'm not sure what I'm doing wrong. I've been scouring the internet looking at other individuals source code and comparing it to my own, but I still can't get it to work. Here is the whittled down source code (sorry it's still a bit long, it takes a bit of code to record to a .wav on my own): // Compile with "g++ test.ccp -o test -lasound" // Use the newer ALSA API #define ALSA