-3

I'm trying to read and manipulate audio file , how to read and manipulate the waves value of a wave file using python?

Serenity
  • 35,289
  • 20
  • 120
  • 115

1 Answers1

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

This question has been asked before: Reading *.wav files in Python

Community
  • 1
  • 1
Alex B.
  • 121
  • 3