wave

Python - downsampling wav audio file

百般思念 提交于 2019-11-30 00:41:52
I have to downsample a wav file from 44100Hz to 16000Hz without using any external python libraries, so preferably wave and/or audioop . I tried just changing the wav files framerate to 16000 by using setframerate function but that just slows down the entire recording. How can I just downsample the audio file to 16kHz and maintain the same length of the audio? Thank you very much in advance You can use Librosa's load() function, import librosa y, s = librosa.load('test.wav', sr=8000) # Downsample 44.1kHz to 8kHz The extra effort to install Librosa is probably worth the peace of mind. Pro-tip:

Any good C/C++ DSP library? [closed]

我只是一个虾纸丫 提交于 2019-11-29 21:56:34
Which DSP library in C/C++ would you recommend? I will need it for real-time embedded systems. It'd be great to have sound signal processing accompany too, but not a mandatory. If you have knowledge of any DSP library, please kindly share. We are thinking of AVR, ARM and even some middle range chips Neither are particularly designed for DSP, but if your performance requirements are modest enough that may not be a problem. What do you need the DSP to do? I suggest that you choose your platform first and use the vendor's library since that will be optimised for the platform. If the vendor does

Compare voice wav in android or voice tag ( voice commands ) API

风流意气都作罢 提交于 2019-11-29 20:33:32
问题 I'm developing an app and I need some way to compare 2 voices if they' match or not, I know that Voice Recognizer is a way to do that but since (i think) it needs to translate the voice into string first, it won't be so suitable for other language apart from the lang supported by the speech recognizer....any idea? Just like old-day phone used to do, the voice tag where it just compare the voice input with the voice it recorded earlier during the setup 回答1: A relatively simple way to do this

Simultaneous record audio from mic and play it back with effect in python

旧城冷巷雨未停 提交于 2019-11-29 16:10:33
问题 My goal is to record my voice through the laptop mic and simultaneously adding an effect to it, in python. What I need is similar to a music effects pedal where you connect a guitar or mic and it adds reverb or echo or distortion, etc. I am using 'pyaudio' and 'wave' to record and play back audio. Using 'scikits.audiolab' to import audio as a array and to be able to edit this array with with functions such as invert, clip, tile, etc. This manipulation of the audio array lets me "add" effects

What is returned by wave.readframes?

邮差的信 提交于 2019-11-29 13:22:13
I assign a value to a variable x in the following way: import wave w = wave.open('/usr/share/sounds/ekiga/voicemail.wav', 'r') x = w.readframes(1) When I type x I get: '\x1e\x00' So x got a value. But what is that? Is it hexadecimal? type(x) and type(x[0]) tell me that x and x[0] a strings. Can anybody tell me how should I interpret this strings? Can I transform them into integer? The interactive interpreter echoes unprintable characters like that. The string contains two bytes, 0x1E and 0x00. You can convert it to an (WORD-size) integer with struct.unpack("<H", x) (little endian!). It's a two

NAudio playing a sine wave for x milliseconds using C#

家住魔仙堡 提交于 2019-11-29 10:39:33
I am using NAudio to play a sinewave of a given frequency as in the blog post Playback of Sine Wave in NAudio . I just want the sound to play() for x milliseconds and then stop. I tried a thread.sleep, but the sound stops straightaway. I tried a timer, but when the WaveOut is disposed there is a cross-thread exception. I tried this code, but when I call beep the program freezes. public class Beep { public Beep(int freq, int ms) { SineWaveProvider32 sineWaveProvider = new SineWaveProvider32(); sineWaveProvider.Amplitude = 0.25f; sineWaveProvider.Frequency = freq; NAudio.Wave.WaveOut waveOut =

Need a library that generates WAVE from Midi

你离开我真会死。 提交于 2019-11-29 07:33:25
I have about 80 compositions written in MIDI and I want to convert them in to WAVE using a sound library. So they can be played on all computers and sound the same. Is there a library that can automate this? Preferably in C#, but other programming languages are fine too. This is what's called a Soft Synth , you will also need a set of instrument samples if you want them the sound the same on all machines. You may find that you will save memory if you just convert them all to wave files once and ship the wave files. A high quality instrument set can be quite large, and most of them are

Saving each WAV channel as a mono-channel WAV file using Naudio

可紊 提交于 2019-11-29 07:29:26
I'm trying to convert a WAV file(PCM,48kHz, 4-Channel, 16 bit) into mono-channel WAV files. I tried splittiing the WAV file into 4 byte-arrays like this answer and created a WaveMemoryStream like shown below but does not work. byte[] chan1ByteArray = new byte[channel1Buffer.Length]; Buffer.BlockCopy(channel1Buffer, 0, chan1ByteArray, 0, chan1ByteArray.Length); WaveMemoryStream chan1 = new WaveMemoryStream(chan1ByteArray, sampleRate, (ushort)bitsPerSample, 1); Am I missing something in creating the WAVE headers ? Or is there more to splitting a WAV into mono channel WAV files ? The basic idea

Change the volume of a wav file in python

﹥>﹥吖頭↗ 提交于 2019-11-29 03:46:42
问题 I have a 2 seconds 16bit single channel 8khz wav file and I need to change its volume. It should be quite straightforward, because changing the volume is the same as changing the amplitude of the signal, and I just need to attenuate it, that is to multiply it for a number between 0 and 1. But it doesn't work: the new sound is lower but VERY full of noise. What am I doing wrong? Here is my code: import wave, numpy, struct # Open w = wave.open("input.wav","rb") p = w.getparams() f = p[3] #

how to convert wav file to float amplitude

微笑、不失礼 提交于 2019-11-28 23:23:47
问题 so I asked everything in the title: I have a wav file (written by PyAudio from an input audio) and I want to convert it in float data corresponding of the sound level (amplitude) to do some fourier transformation etc... Anyone have an idea to convert WAV data to float? 回答1: I have identified two decent ways of doing this. Method 1: using the wavefile module Use this method if you don't mind installing some extra libraries which involved a bit of messing around on my Mac but which was easy on