Questions tagged [wave]

This tag is for questions about the Python module wave - for working with the .wav sound format. FOR GENERAL WAV QUESTIONS, not related to Python, please use the [wav] tag.

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)

498 questions
12
votes
4 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
  • 12,074
  • 14
  • 61
  • 97
12
votes
3 answers

How to read stream of .wav bytes in python

Is there a way to read frames of .wav format binary data? I am streaming .wav binary to a python server which I want to be able to read and use from processing by pyaudio, which complains about the frame size. Since I cannot use…
user7993435
11
votes
9 answers

Software to convert audio to MIDI

Does any one know if there is good software to perform conversion from (wave or mp3 or other known format) to MIDI? I understand that conversion from audio file to MIDI is a very complex process. I'm currently developing a course project for my…
aumanets
  • 3,703
  • 8
  • 39
  • 59
11
votes
3 answers

remove silence at the beginning and at the end of wave files with PyDub

How can I remove the silence from the beginning and the end of wave files with PyDub? I guess I should access segment by segment and check whether it's silent or not (but I'm not able to do it) :/ e.g. I have a wave file with silence at the…
DaniPaniz
  • 1,058
  • 2
  • 13
  • 24
10
votes
4 answers

Wave Simulation with Python

I want to simulate a propagating wave with absorption and reflection on some bodies in three dimensional space. I want to do it with python. Should I use numpy? Are there some special libraries I should use? How can I simulate the wave? Can I use…
kame
  • 20,848
  • 33
  • 104
  • 159
10
votes
2 answers

Opening a wave file in Python: unknown format: 49. What's going wrong?

I try to open a wave file with the wave module, but I keep getting the same error whatever I try. The line with the error is the following: wav = wave.open(f) This is the error message: Traceback (most recent call last): File "annotate.py", line…
Lewistrick
  • 2,649
  • 6
  • 31
  • 42
9
votes
1 answer

Adding silent frame to wav file using python

First time posting here, lets see how this goes. I trying to write a script in python which would add a second of silence in the beginning of the wav file, but so far been unsuccessfully in doing so. What I was trying to do is read in the wav header…
Madmax
  • 93
  • 1
  • 1
  • 3
8
votes
5 answers

how to convert wav file to float amplitude

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…
user995673
  • 81
  • 1
  • 1
  • 2
8
votes
1 answer

Audio Frequencies in Python

I'm writing a code to analyse a single audio frequency sung by a voice. I need a way to analyse the frequency of the note. Currently I am using PyAudio to record the audio file, which is stored as a .wav, and then immediately play it back. import…
Ollie
  • 105
  • 1
  • 1
  • 9
8
votes
7 answers

why am i getting error when importing AudioSegment?

i'm trying to use pydub, but when i import it to python with AudioSegment it will give me an error saying it doesn't recognize it. i tried using pip install and searching online. any help?? i'm using python 2.7 from pydub import AudioSegment
Sh0z
  • 127
  • 1
  • 2
  • 7
8
votes
4 answers

Python Wave byte data

I'm trying to read the data from a .wav file. import wave wr = wave.open("~/01 Road.wav", 'r') # sample width is 2 bytes # number of channels is 2 wave_data = wr.readframes(1) print(wave_data) This gives: b'\x00\x00\x00\x00' Which is the "first…
jameh
  • 1,149
  • 3
  • 12
  • 20
8
votes
8 answers

What is the easiest way to read wav-files using Python [summary]?

I want to use Python to access a wav-file and write its content in a form which allows me to analyze it (let's say arrays). I heard that "audiolab" is a suitable tool for that (it transforms numpy arrays into wav and vica versa). I have installed…
Roman
  • 124,451
  • 167
  • 349
  • 456
7
votes
4 answers

Playing an arbitrary sound on Windows?

How do I, say, play a sound with a given amplitude and a given frequency makeup (say, consisting of frequencies 2 kHz and 3 kHz) natively on Windows (32-bit and 64-bit, up to Windows 7)? (By natively I mean without using an external library.) I…
user541686
  • 205,094
  • 128
  • 528
  • 886
7
votes
2 answers

NAudio playing a sine wave for x milliseconds using C#

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…
amcashcow
  • 724
  • 1
  • 6
  • 16
7
votes
3 answers

C++ - Play back a tone generated from a sinusoidal wave

Hey everyone, I'm currently trying to figure out how to play back a tone I have generated using a sinusoidal wave. Here's my code: #include #include #include #include using namespace std; int main…
Moonlight293
  • 197
  • 1
  • 5
  • 13
1
2
3
33 34