I'm trying to read and manipulate audio file , how to read and manipulate the waves value of a wave file using python?
Asked
Active
Viewed 434 times
-3
-
Does `import wave` not work for you? https://docs.python.org/2/library/wave.html – Mark Ransom Feb 18 '15 at 15:56
-
Mr. Kmeixner , I looking for sound steganography , using python :) – Abdullah Hamdan Feb 18 '15 at 19:08
1 Answers
0
The SciPy libraries have great resources for this:
Writing and Reading:
import numpy as np
from scipy.io import wavfile
fs = 44.1e3
t = np.arange(0, 1.0, 1.0/fs)
f1 = 440
f2 = 600
x = 0.5*np.sin(2*np.pi*f1*t) + 0.5*np.sin(2*np.pi*f2*t)
fname = 'output.wav'
wavfile.write( fname, fs, x )
fs, data = wavfile.read( fname )
print fs, data[:10]
Documentation: http://docs.scipy.org/doc/scipy-0.14.0/reference/io.html#module-scipy.io.wavfile
- Reading: http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.io.wavfile.read.html#scipy.io.wavfile.read
- Writing: http://docs.scipy.org/doc/scipy-0.14.0/reference/generated/scipy.io.wavfile.write.html#scipy.io.wavfile.write
This question has been asked before: Reading *.wav files in Python
-
feel free to accept this answer if you think it properly answers your question. – Alex B. Feb 18 '15 at 18:19