Revision 6:fd0f9d0615b2 1-wavread.py
| 1-wavread.py | ||
|---|---|---|
| 1 | 1 |
from scikits.audiolab import wavread |
| 2 |
from scikits.audiolab import play |
|
| 2 | 3 |
|
| 3 | 4 |
# specify a file name |
| 4 | 5 |
filename = "viola.wav" |
| 5 | 6 |
|
| 6 | 7 |
# extract audio from file |
| 7 |
x, fs, enc = wavread(filename)
|
|
| 8 |
samples, fs, enc = wavread(filename)
|
|
| 8 | 9 |
|
| 9 | 10 |
# print out the first 50 samples |
| 10 |
print x[0:50]
|
|
| 11 |
print samples[0:50]
|
|
| 11 | 12 |
|
| 12 | 13 |
|
| 14 |
################################################# |
|
| 15 |
############# PLAYING AN AUDIO FILE ############# |
|
| 16 |
################################################# |
|
| 17 |
|
|
| 18 |
# play the audio file data in 'data' at 44100Hz |
|
| 19 |
play(samples,fs=44100) |
|
| 20 |
|
|
| 21 |
|
|
| 22 |
################################################# |
|
| 23 |
################################################# |
|
| 24 |
################################################# |
|
Also available in: Unified diff