To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

The primary repository for this project is hosted at https://github.com/Codasign/york-software-bootcamp-audio-day.git .
This repository is a read-only copy which is updated automatically every hour.

Statistics Download as Zip
| Branch: | Revision:

root / 1-wavread.py

History | View | Annotate | Download (615 Bytes)

1 4:2b996e1d64da adamstark
from scikits.audiolab import wavread
2 6:fd0f9d0615b2 adamstark
from scikits.audiolab import play
3 4:2b996e1d64da adamstark
4
# specify a file name
5
filename = "viola.wav"
6
7
# extract audio from file
8 6:fd0f9d0615b2 adamstark
samples, fs, enc = wavread(filename)
9 4:2b996e1d64da adamstark
10
# print out the first 50 samples
11 6:fd0f9d0615b2 adamstark
print samples[0:50]
12 4:2b996e1d64da adamstark
13
14 6:fd0f9d0615b2 adamstark
#################################################
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
#################################################