wav

Recording a wav file from the mic in Android - problems

泪湿孤枕 提交于 2019-12-02 21:26:05
I need to be able to create a WAV file using the mic in Android. Currently, I'm having a lot of trouble. So far, this is my situation. I'm using parts of the micDroid project code to record thus: //read thread int sampleRate = 44100; int bufferSize = AudioRecord.getMinBufferSize(sampleRate,android.media.AudioFormat.CHANNEL_CONFIGURATION_MONO,android.media.AudioFormat.ENCODING_PCM_16BIT); AudioRecord ar = new AudioRecord(AudioSource.MIC,sampleRate,android.media.AudioFormat.CHANNEL_CONFIGURATION_MONO,android.media.AudioFormat.ENCODING_PCM_16BIT,bufferSize); short[] buffer = new short[bufferSize]

How to extract frequency out of WAV sample data?

醉酒当歌 提交于 2019-12-02 21:18:06
I'm developing an application in c to read simple PCM WAV files. My question is, how should I interpret the samples from the data chunk, so that I can extract the sample's frequency? Given a WAV example, how can the original data represent frequencies. E.g. this data chunk, 24 17 1e f3, for stereo, 16 bits, the left channel sample is, 0x1724 = 5924d, means 5924Hz ? How can that be, for samples that are signed or frequencies that humans can´t hear? AShelly Your assumption is incorrect. The sample data is simply a digital representation of the actual sound wave. The numbers represent wave

Generate visual (waveform) from MP3/WAV file in Windows 2008 Server?

一曲冷凌霜 提交于 2019-12-02 19:30:32
Is there (somewhere) a command-line program for Windows which will create PNG/JPEG visual from MP3/WAV? EDIT: This is a good example of how the image should look like. Wander Nauta Sox , "the Swiss Army knife of audio manipulation", can generate accurate PNG spectrograms from sound files. It plays pretty much anything, and binaries are available for Windows. At the most basic level, you'd use something like this: sox my.wav -n spectrogram If you want a spectrogram with no axes, titles, legends, and a light background that's 100px high: sox "Me, London.mp3" -n spectrogram -Y 130 -l -r -o "Me,

Web Audio API - record to MP3?

本小妞迷上赌 提交于 2019-12-02 18:20:01
I am asking because I couldn't find the answer anywhere. I have successfully implemented RecorderJS in order to record microphone input in JS. However, the recorded file is WAV which results in large files. I am looking for a way to record with JS directly to MP3, or encode the bits somehow to MP3 instead of WAV. How can it be done? Is there a Web Audio API function that can do that or JS MP3 encoder of some sort? The only Javascript MP3 encoder I've seen is https://github.com/akrennmair/libmp3lame-js , which is a port using emscripten. It's supposed to be slow, and I've never used it. I don't

How do I attenuate a WAV file by a given decibel value?

元气小坏坏 提交于 2019-12-02 17:45:52
If I wanted to reduce a WAV file's amplitude by 25%, I would write something like this: for (int i = 0; i < data.Length; i++) { data[i] *= 0.75; } A lot of the articles I read on audio techniques, however, discuss amplitude in terms of decibels. I understand the logarithmic nature of decibel units in principle, but not so much in terms of actual code. My question is: if I wanted to attenuate the volume of a WAV file by, say, 20 decibels, how would I do this in code like my above example? Update : formula (based on Nils Pipenbrinck's answer) for attenuating by a given number of decibels

How to convert any mp3 file to .wav 16khz mono 16bit

我们两清 提交于 2019-12-02 16:45:21
Please, help to choose solution for converting any mp3 file to special .wav - I'm a newbie with Linux command line tools, so It's hard for me right now. I need to get wav with 16khz mono 16bit sound properties from any mp3 file. I was trying ffmpeg -i 111.mp3 -ab 16k out.wav, but I got wav with the same rate as mp3 (22k). Please, help to construct right command line Bill 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

How do I use afconvert to convert all the files in a directory from wav to caf?

别说谁变了你拦得住时间么 提交于 2019-12-02 16:24:55
I have a directory with about 50 wav files that I need to convert to caf, because AudioServicesCreateSystemSoundID() returns an error for some of them (but not all). Here's an example of the command I've used successfully for a single file: afconvert -f caff -d LEI16@44100 -c 1 whistle.wav whistle.caf How do I do this quickly - not one-by-one for each file? lavinio On Windows, use the %~ni syntax. for %i in (*.wav) do afconvert -f caff -d LEI16@44100 -c 1 %i %~ni.caf Randall Similar approach for bash: for i in *.wav; do afconvert -f caff -d LEI16@44100 -c 1 $i ${i%.wav}.caf; done Ward found

What does a audio frame contain?

依然范特西╮ 提交于 2019-12-02 16:22:54
Im doing some research on how to compare sound files(wave). Basically i want to compare stored soundfiles (wav) with sound from a microphone. So in the end i would like to pre-store some voice commands of my own and then when Im running my app I would like to compare the pre-stored files with input from the microphone. My thought was to put in some margin when comparing because saying something two times in a row in the exatly same way would be difficult I guess. So after some googling i see that python have this module named wave and the Wave_read object. That object has a function named

Convert audio file to a byte array in matlab

无人久伴 提交于 2019-12-02 14:24:09
I want to convert an audio file (.wav/.mp3) to a byte array like in C#. Here's my code, string imageName = Guid.NewGuid().ToString() + ".mp3"; byte[] file = System.Convert.FromBase64String(Filep); File.WriteAllBytes(Server.MapPath("FILE/" + imageName), file); return imageName; If you want to read the raw audio data, use audioread . You call it like so: [y,Fs] = audioread(filename); filename would be the file name of your file (.mp3/.wav) and what is returned is a matrix of values stored in y and the sampling frequency of the file in Fs . y would be a matrix such that the number of rows tells

Workaround for UnsupportedAudioFileException?

亡梦爱人 提交于 2019-12-02 08:14:58
问题 I'm in a very early stage of writing a small music/rhythm game in Java (via Slick framework, which in turns uses OpenAL, but that's probably irrelevant here). The game needs to read (and playback) several sound files in WAV format, but some of the files are throwing [javax.sound.sampled.UnsupportedAudioFileException] exceptions. at javax.sound.sampled.AudioSystem.getAudioInputStream(AudioSystem.java:1102) at org.newdawn.slick.openal.WaveData.create(WaveData.java:123) at org.newdawn.slick