Mercurial > hg > chourdakisreiss2016
comparison experiment-reverb/code/pyaudioplay.py @ 0:246d5546657c
initial commit, needs cleanup
author | Emmanouil Theofanis Chourdakis <e.t.chourdakis@qmul.ac.uk> |
---|---|
date | Wed, 14 Dec 2016 13:15:48 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:246d5546657c |
---|---|
1 # -*- coding: utf-8 -*- | |
2 """ | |
3 Created on Tue Jun 9 16:39:46 2015 | |
4 | |
5 @author: mmxgn | |
6 """ | |
7 | |
8 | |
9 from numpy import * | |
10 from matplotlib.pyplot import * | |
11 import pyaudio | |
12 | |
13 SR = 44100 | |
14 | |
15 t = linspace(0, 1, SR) | |
16 | |
17 f0 = 440. | |
18 | |
19 y = 0.5*sin(2*pi*f0*t) | |
20 | |
21 | |
22 player = pyaudio.PyAudio() | |
23 stream = player.open(format=pyaudio.paFloat32, channels=1,rate=SR,output=True) | |
24 | |
25 stream.start_stream() | |
26 stream.write(y) | |
27 stream.close() | |
28 | |
29 #plot(t, y) |