wav

wav amplitude in java (stereo or more channels)

ⅰ亾dé卋堺 提交于 2019-12-05 19:58:57
Hi does anyone know how to find the amplitudes within a WAV file in Java? If the file was stereo (or has more channels) how can the data be put into arrays? Thanks! Jim Rush Processing a WAV file header Next trick is a bit more of a challenge as the internal data format could be a variety of data types. If you are looking at your classic windows WAV file, it is probably just PCM 16 bit or maybe 8 bit. Which, means, you can easily load the data into a byte or short array. However, you will find other formats. When you know the type you have, google it. You'll find information for most. How to

Batch measurements of .wav files with sox stats

主宰稳场 提交于 2019-12-05 18:36:19
My question is similar to a previous question about "get-mean-amplitude-of-wav-from-sox": Get Mean amplitude(only) of .wav from sox I would like to be able to use the stats sox to do batch measurements of 1,000's of .wav files in a directory, and store the results in a data frame or some similar structure I can save as a csv text file. For one sound file, the code would be: ./sox SampleSound.wav -n stat Resulting in the following output: Samples read: 72000000 Length (seconds): 3600.000000 Scaled by: 2147483647.0 Maximum amplitude: 0.778809 Minimum amplitude: -1.000000 Midline amplitude: -0

Finding the 'volume' of a .wav at a given time

非 Y 不嫁゛ 提交于 2019-12-05 17:24:51
I am working on a small example application for my fourth year project (dealing with Functional Reactive Programming). The idea is to create a simple program that can play a .wav file and then shows a 'bouncing' animation of the current volume of the playing song (like in audio recording software). I'm building this in Scala so have mainly been looking at Java libraries and existing solutions. Currently, I have managed to play a .wav file easily but I can't seem to achieve the second goal. Basically is there a way I can decode a .wav file so I can have someway of accessing the 'volume' at any

PhoneGap .wav upload from an iOS device is creating a 0k file on the server

故事扮演 提交于 2019-12-05 16:38:38
I am attempting to record audio on an iPhone using PhoneGap, then send that audio to a server. I am using PhoneGaps Media APIs to make the recording, then the PhoneGap file transfer API to send the file to the server. I am able to make the recording just fine, and playing it back works perfectly. When I try to send it to the server, however, the recording shows up on the server but it says the file is 0k big. I've done fairly extensive searching on this issue and found others that have had this problem. For example: https://groups.google.com/forum/#!topic/phonegap/zjzSs6JVokE function win(r) {

How to remove header of a wavfile in Matlab

岁酱吖の 提交于 2019-12-05 16:03:39
I need to remove first 1024 bytes of a wave file. I tried to do but I got corrupted/distorted wavfile: wavFile = fopen(fullFileName, 'r'); % Open file for reading fseek (wavFile, 1024, -1);% Skip past header, which is 1024 bytes long. wF = fread (wavFile, inf, 'int16');% 16-bit signed integers wF = wF(:)'; newWavFile = fopen(strcat('new_',fileNames(fileNo).name), 'w+');% Open file for reading fwrite(newWavFile,wF); fclose(wavFile); What can be the problem? I could manage to remove header and correct the distortion by : wavFile = fopen(fullFileName, 'r');% Open file for reading fseek (wavFile,

Increase/Decrease Play Speed of a WAV file Python

强颜欢笑 提交于 2019-12-05 14:24:04
I want to change play speed (increase or decrease) of a certain WAV audio file using python wave module. I tried below thing : Read frame rate of input file. Double the frame rate. Write a new wave file with increased frame rate using output_wave.setparams() function. But its not working out. Please suggest. Thanks in Advance, WOW! if you no matter to change the pitch when you increase or decrease the speed, you can just change the sample rate ! Can be very simple using python: import wave CHANNELS = 1 swidth = 2 Change_RATE = 2 spf = wave.open('VOZ.wav', 'rb') RATE=spf.getframerate() signal =

Convert little endian string to integer

北战南征 提交于 2019-12-05 13:56:47
问题 I have read samples out of a wave file using the wave module, but it gives the samples as a string, it's out of wave so it's little endian (for example, \x00 ). What is the easiest way to convert this into a python integer, or a numpy.int16 type? (It will eventually become a numpy.int16, so going directly there is fine). Code needs to work on little endian and big endian processors. 回答1: The struct module converts packed data to Python values, and vice-versa. >>> import struct >>> struct

Remove the headers from several WAV files, and then concatenate the remaining data into one RAW file

扶醉桌前 提交于 2019-12-05 13:02:47
I have a RAW audio file which is made up of several concatenated, smaller WAV files. I can open and play this file as 48,000, 8 bit PCM, signed, mono, in Sound Forge. What I would like to do, in C#, is programmatically overwrite each individual WAV within the file with new data of equal or smaller length, which I think I'm fairly close to being able to do. I can do a File.ReadAllBytes on the RAW file, loop through the byte array, and determine the start and end location of each WAV. I then pick the new WAV files on my PC, remove the headers, and write the remaining data into my RAW file. If

How to play WAV data right from memory?

青春壹個敷衍的年華 提交于 2019-12-05 10:38:09
I'm currently working on a sound experiment, and I've come across one issue. I save an array of wave data to a .wav file and play it, but is there a way to skip this step and simply play the sound right from memory? I'm looking for a solution that will work cross-platform. I suppose you are using the wave library , right? The docs say: wave.open(file[, mode]) If file is a string, open the file by that name, otherwise treat it as a seekable file-like object. This means that you should be able to do something along the lines of: >>> import wave >>> from StringIO import StringIO >>> file_on_disk

How to convert a spectrogram to 3d plot. Python

♀尐吖头ヾ 提交于 2019-12-05 10:32:21
I am trying to achieve waterfall graph of wav file. In my attempts I noticed that this is basically a spectogram in 3d (or as close to what I need). I am trying to do this in Python with numpy and matplotlib. My main problem is I don't know how to change the plot of specgram from matplotlib into a 3d plot. Sample of my "code": sample ,data = wavfile.read('file.wav') F = Figure() a = F.add_subplot(111,projection='3d') Spec, t, freq, im = a.specgram(data,Fs=2) I've got this far and have no clue what to do next. I wanna change already existing plot into 3d. I have no code of changing it to 3d,