wav

Find duration of wav file in r

♀尐吖头ヾ 提交于 2019-12-23 16:56:49
问题 I know the equation to find the duration of a wav file is: fileLength/(sampleRate*channel*bits per sample/8) But I've failed to retrieve all the necessary information to fill this equation in R. Here is an example of what I've come up with: sound <- readWave(sound.wav) sampleRate <- sound@samp.rate #44100 bit <- sound@bit #16 So from the information above I have: fileLength/(44100*channel*16/8) The channel will either be 1 or 2, so that I'm not bothered about, but what about the file length?

C++ read wav file, subchunk1size = 18

怎甘沉沦 提交于 2019-12-23 15:44:04
问题 Usually the subchunk1size of a wav file is 16. However, I have some wav files that have subchunk1size = 18. I have c++ code to read wav file that has subchunk1size = 16. Now I want to read wav files that have subchunk1size = 18. Any help would be appreciated. typedef struct header_file { char chunk_id[4]; int chunk_size; char format[4]; char subchunk1_id[4]; int subchunk1_size; short int audio_format; short int num_channels; int sample_rate; int byte_rate; short int block_align; short int

Can't play a reversed .wav file with MediaPlayer

主宰稳场 提交于 2019-12-23 15:34:51
问题 I've created an app that records audio, saves the sample to the sd card then plays it back, using the record and play buttons. I need to reverse this sample. I can do all this and the the reversed sample is saved on the SD card under a different name. The original sample is test.wav and the same sample reversed is save as revFile.wav . when i try play revFile.wav android says it can't play this format. I've litterally put the sample in an array then reversed the contents, something is telling

Unexpected end of file wavfile.read python

半世苍凉 提交于 2019-12-23 13:05:25
问题 I am trying to read .wav audio file by following code from scipy.io import wavfile file = 'PC1_20090513_050000_0010.wav' rate, audio = wavfile.read(file) but it is showing following error : raise ValueError("Unexpected end of file.") ValueError: Unexpected end of file. Any idea ?? 回答1: It seems that you got incorrect data in the head of wav file (http://soundfile.sapp.org/doc/WaveFormat/). VLC sometimes can handle that. Try to resave this file with any soft. For example use sox (http://sox

How to do text to speech with python on a Toshiba laptop and Windows 7?

你说的曾经没有我的故事 提交于 2019-12-23 10:55:56
问题 I am trying to find a way to create text to speech in python (I am on windows 7). I am using pyinstaller to compile this program. I have tried a large number of approaches, including using Google's unofficial text to speech program accessed through the urllib2 module. This ends up creating an mp3 file. For details on the code, much of this code is from http://glowingpython.blogspot.com/2012/11/text-to-speech-with-correct-intonation.html. I have then needed to play the mp3 file that this

apply for .pcm file as sox

青春壹個敷衍的年華 提交于 2019-12-23 05:28:16
问题 I want to exchange 16kHz pcm --> 48kHz wav using sox. however, pcm file isn't applied in sox. so, I just changed pcm to raw, and then sox -r 16000 -e signed -b 16 -c 1 test.raw -r 48000 out.wav Can I apply for pcm file not convert raw? 回答1: For the PCM file, since PCM's are headerless, you need to add '-t raw' as the first argument. sox -t raw -r 16000 -e signed -b 16 -c 1 test.raw -r 48000 out.wav Try that out. Also try the different Endian settings; -L; -B; -x though only use one at a time,

Is there anything special I have to do to create a 24-bit WAV file?

空扰寡人 提交于 2019-12-23 03:47:08
问题 I can successfully create a 16-bit wav file, but when creating a 24-bit file, all I hear is white noise. I'm setting 24-bit signed integer data chunks. Do I have to set some special audio format at byte 20 in the wav file header? I'm currently using format 1. Edit #1 The wBitsPerSample field is set to 24. The wAvgBytesPerSec (byte rate) field is set to // 44100 * (2 * 3) sampleRate * blockAlign and wBlockAlign is set to // 2 * 3 numChannels * bytesPerSampe Assuming you already did, the data

how to record voice in browser and save it into .wav file using php?

混江龙づ霸主 提交于 2019-12-23 03:44:10
问题 my PHP application wants to record users voice in browser and save it as a .Wav file or .mp3 file in local disk.How to do this? Guide me to get out of this problem... Thanks & Regards, P.SARAVANAN 回答1: Not PHP. PHP runs on the server. There is however a solution for what you want to do: https://wiki.mozilla.org/Labs/Jetpack/JEP/18 This will only work in firefox. If you need something more universal, you will need flash. Going the paid route, look at http://www.javasonics.com/ 回答2: Here's an

From Amplitude or FFT to dB

假如想象 提交于 2019-12-23 00:26:49
问题 I've a Python code which performs FFT on a wav file and plot the amplitude vs time / amplitude vs freq graphs. I want to calculate dB from these graphs (they are long arrays). I do not want to calculate exact dBA, I just want to see a linear relationship after my calculations. I've dB meter, I will compare it. Here is my code: #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import scipy.io.wavfile as wavfile import scipy import scipy.fftpack import numpy as

From Amplitude or FFT to dB

老子叫甜甜 提交于 2019-12-23 00:26:41
问题 I've a Python code which performs FFT on a wav file and plot the amplitude vs time / amplitude vs freq graphs. I want to calculate dB from these graphs (they are long arrays). I do not want to calculate exact dBA, I just want to see a linear relationship after my calculations. I've dB meter, I will compare it. Here is my code: #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import print_function import scipy.io.wavfile as wavfile import scipy import scipy.fftpack import numpy as