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 / 4-lists-and-python-arrays-for-audio.py @ 6:fd0f9d0615b2

History | View | Annotate | Download (875 Bytes)

1
import array as array
2

    
3

    
4
#################################################
5
############# PYTHON LISTS FOR AUDIO? ###########
6
#################################################
7

    
8
# I am a list of audio samples
9
myAudio = [-0.25,0.0,0.25,0.5]
10

    
11
# turn it up!
12
myAudio = myAudio*2
13

    
14
# oh dear!
15
print myAudio
16

    
17
# also, look what got into our array 
18
myAudio.append("hello!")
19

    
20
# oh dear again! - Python stores type information for every entry? Do we want
21
# to do that 44100 times a second?
22
print myAudio
23

    
24
"""
25
#################################################
26
############# PYTHON ARRAYS FOR AUDIO? ##########
27
#################################################
28

29
# I am an array of audio samples
30
myAudio = array.array('d',[-0.25,0.0,0.25,0.5])
31

32
# this doesn't work, that's good
33
# myAudio.append("hello")
34

35
# but what about this!
36
myAudio = myAudio*2
37

38
# oh dear oh dear oh dear
39
print myAudio
40
"""