Questions tagged [wave]

WAVE - this tag refers to the python module for the WAV sound format.

The wave module provides a convenient interface to the WAV sound format. It does not support compression/decompression, but it does support mono/stereo.

It's recommended to use this tag in connection with , due to the colloquial meaning of wave (ex. in math or physics)

507 questions
97
votes
12 answers

Reading *.wav files in Python

I need to analyze sound written in a .wav file. For that I need to transform this file into set of numbers (arrays, for example). I think I need to use the wave package. However, I do not know how exactly it works. For example I did the…
Roman
  • 97,757
  • 149
  • 317
  • 426
27
votes
2 answers

ffmpeg to convert from flac to wav

I need to convert a flac file to a wav file without changing sample rate and bit depth. As far as I know changing these properties may distort the audio, so how do i specify them not to be changed? Also, is there any way to prevent metadata to be…
user3580089
  • 349
  • 1
  • 3
  • 7
26
votes
2 answers

Generating waveform from any music file ios

I'm looking for how to draw the sound waves according to music. I want waves like this image here is some discussion about displaying Waves from music WaveForm on IOS rendering a waveform on an iphone audio waveform visualisation with…
Vishal Khatri
  • 944
  • 2
  • 12
  • 32
25
votes
2 answers

How to split a .wav file into multiple .wav files?

I have a .wav file several minutes long that I would like to split into different 10 second .wav files. This is my python code so far: import wave import math def main(filename, time): read = wave.open(filename, 'r') #get sample rate …
jdsto
  • 285
  • 1
  • 3
  • 11
24
votes
3 answers

How to create a numpy array from a pydub AudioSegment?

I'm aware of the following question: How to create a pydub AudioSegment using an numpy array? My question is the right opposite. If I have a pydub AudioSegment how can I convert it to a numpy array? I would like to use scipy filters and so on. It…
J_Zar
  • 1,334
  • 1
  • 15
  • 27
23
votes
2 answers

Pass Blob through ajax to generate a file

I'm trying to capture audiorecorder (https://github.com/cwilso/AudioRecorder) and send the blob through Ajax a php file, which will receive the blob content and create the file(the wave file in this case). Ajax…
João Correia
  • 245
  • 1
  • 2
  • 7
21
votes
6 answers

Downsampling wav audio file

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…
d3cr1pt0r
  • 351
  • 1
  • 3
  • 9
19
votes
1 answer

Error on say when output format is wave

I am trying to create wave files using mac's say command, however, I get the following error: $ say "hello" -o hi.wav Opening output file failed: fmt? although, $ say --file-format=? WAVE WAVE (.wav) [lpcm,ulaw,alaw] Is there some way I can get…
simbara
  • 193
  • 1
  • 4
18
votes
3 answers

Convert OutputStream to ByteArrayOutputStream

I am trying to convert an OutputStream to a ByteArrayOutput Stream. I was unable to find any clear simple answers on how to do this. This question was asked in the title of the question on StackOverflow, but the body of the question aske how to…
Bill Smith
  • 187
  • 1
  • 1
  • 8
15
votes
4 answers

Change the volume of a wav file in python

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…
Ricard Bou
  • 449
  • 1
  • 3
  • 11
14
votes
7 answers

Sine Wave Sound Generator in Java

What's the simplest way to generate a sine wave sound at any frequency in Java? A sample size more than 2 bytes would help, but it doesn't really matter.
milo
  • 505
  • 2
  • 7
  • 13
14
votes
3 answers

How to write stereo wav files in Python?

The following code writes a simple sine at frequency 400Hz to a mono WAV file. How should this code be changed in order to produce a stereo WAV file. The second channel should be in a different frequency. import math import wave import struct freq…
Jonathan
  • 84,911
  • 94
  • 244
  • 345
14
votes
3 answers

Any good C/C++ DSP library?

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.
Viet
  • 16,604
  • 31
  • 94
  • 134
13
votes
6 answers

Detect a specific frequency/tone from raw wave-data

I am reading a raw wave stream coming from the microphone. (This part works as I can send it to the speaker and get a nice echo.) For simplicity lets say I want to detect a DTMF-tone in the wave data. In reality I want to detect any frequency, not…
Tedd Hansen
  • 11,020
  • 14
  • 57
  • 93
13
votes
4 answers

What is returned by wave.readframes?

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…
Roman
  • 97,757
  • 149
  • 317
  • 426
1
2 3
33 34