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
5
votes
2 answers

can the python wave module accept StringIO object

i'm trying to use the wave module to read wav files in python. whats not typical of my applications is that I'm NOT using a file or a filename to read the wav file, but instead i have the wav file in a buffer. And here's what i'm doing import…
user368005
  • 101
  • 2
  • 3
5
votes
1 answer

Python - Wave file over 4gb: struct.error: 'L' format requires 0 <= number <= 4294967295

I'm trying to create an audio wave file over 4GB in my python script but I get an error. Here is a short script reproducing the problem. Can someone tell me why I got such an error and how to fix it, or if it might be a bug? I tried with python 2.7…
marcaurele
  • 502
  • 1
  • 6
  • 14
5
votes
1 answer

Plotting wave equation

I have been trying to plot a plane wave equation in Matlab. I am trying to plot the real part of, $(1/R)E^i(kR+wT)$ i.e. $(1/R)cos(kR+wT)$. So I used the following code in Matlab (for a single instant, say…
Shaz
  • 273
  • 2
  • 6
  • 12
5
votes
3 answers

Read the data of a single channel from a stereo wave file in Python

I have to read the data from just one channel in a stereo wave file in Python. For this I tried it with scipy.io: import scipy.io.wavfile as wf import numpy def read(path): data = wf.read(path) for frame in data[1]: data =…
Richard_Papen
  • 127
  • 1
  • 1
  • 7
5
votes
3 answers

Convert 3-byte stereo WAV-file to numpy array

I have been given a large WAV-file of continuous underwater recording which I would like to convert to a numpy array for analysis. I am struggling to do this. So far I have: import numpy as np import scipy as sp import wave as wv import…
Cnoobplusplus
  • 147
  • 1
  • 2
  • 9
5
votes
3 answers

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

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…
CharlesBryan
  • 181
  • 1
  • 16
4
votes
1 answer

NAudio MeteringSampleProvider not firing events?

From all the samples I've seen using NAudio's MeteringSampleProvider to update a VolumeMeter control, I think I've got the right code, but it seems that the event for the MeteringSampleProvider as well as the SampleChannel never fire. I'm writing…
Redth
  • 5,464
  • 6
  • 34
  • 54
4
votes
2 answers

Mathematica doesn't solve wave equation when given boundary conditions

Still new to Mathematica syntax. When I do: DSolve[{ D[u[x, t], {x, 2}] == (1/(v*v))*D[u[x, t], {t, 2}], u[0, t] == 0, u[l, 0] == 0 }, u, {x, t}] it just returns what I…
Nick
  • 5,228
  • 9
  • 40
  • 69
4
votes
1 answer

Python 3: Convert wave data (byte array) to numpy array of floating point values

I am aiming to convert wave data (read from .wav file with wave module) to a numpy array. The data is currently formatted as a byte array. This means each element of the byte array is 8 bits wide. The wav file is mono, so contains only 1 channel.…
FreelanceConsultant
  • 13,167
  • 27
  • 115
  • 225
4
votes
1 answer

Missing form label in WAVE tool

I'd like to fix an error in WAVE tool on my site: http://human2.com.pl/ and the error is : [url=https://gifyu.com/image/sUbw][img]https://s1.gifyu.com/images/Przechwytywanie58ca1183ef15bd0c.jpg[/img][/url] the code which contains an error:
Michał Hał
  • 41
  • 1
  • 1
  • 4
4
votes
1 answer

Maintain a streaming microphone input in Python

I'm streaming microphone input from my laptop computer using Python. I'm currently using PyAudio and .wav to create a 2 second batches (code below) and then read out the frame representations of the newly created .wav file in a loop. However I…
knowads
  • 705
  • 2
  • 7
  • 24
4
votes
2 answers

Read the data of a single channel from a stereo wave file wave with 24-bit data in Python

I want to read the left and rigth channel. import wave origAudio = wave.open("6980.wav","r") frameRate = origAudio.getframerate() nChannels = origAudio.getnchannels() sampWidth = origAudio.getsampwidth() nbframe=origAudio.getnframes() da =…
mouride touba
  • 55
  • 1
  • 4
4
votes
3 answers

MaterializeCss - Wave/Ripple effect manually trigger

I am building my site using MaterializeCSS (http://materializecss.com/) I am wondering how can I trigger the Wave/Ripple effect manually to certain control , for example: "Trigger the wave/ripple effect of certain button." The MaterializeCSS team…
user695800
4
votes
4 answers

How to remove '\x' from a hex string in Python?

I'm reading a wav audio file in Python using wave module. The readframe() function in this library returns frames as hex string. I want to remove \x of this string, but translate() function doesn't work as I want: >>> input =…
Ebrahim Ghasemi
  • 5,850
  • 10
  • 52
  • 113
4
votes
1 answer

Reading writing WAV/RIFF Tags

I'm writing a simple audio recording utility which I want also to be able to tag the resulting files with meta data. It's pretty easy to find libraries to tag MP3 files with ID3 tags, but I'm more interested in lossless codecs like WAV and possibly…
Eric Anastas
  • 21,675
  • 38
  • 142
  • 236