feature/cnnfeature/crepefeature/timestretchfix/ffmpeg5
Last change
on this file since 9279ba0 was
6d8db80,
checked in by Paul Brossier <piem@piem.org>, 9 years ago
|
python/demos/demo_pysoundcard_*: update to pysoundcard 0.5.2 (closes #42)
|
-
Property mode set to
100755
|
File size:
537 bytes
|
Rev | Line | |
---|
[4013382c] | 1 | #! /usr/bin/env python |
---|
| 2 | |
---|
| 3 | def play_source(source_path): |
---|
| 4 | """Play an audio file using pysoundcard.""" |
---|
| 5 | |
---|
| 6 | from aubio import source |
---|
| 7 | from pysoundcard import Stream |
---|
| 8 | |
---|
| 9 | hop_size = 256 |
---|
| 10 | f = source(source_path, hop_size = hop_size) |
---|
| 11 | samplerate = f.samplerate |
---|
| 12 | |
---|
[6d8db80] | 13 | s = Stream(samplerate = samplerate, blocksize = hop_size) |
---|
[4013382c] | 14 | s.start() |
---|
| 15 | read = 0 |
---|
| 16 | while 1: |
---|
| 17 | vec, read = f() |
---|
| 18 | s.write(vec) |
---|
| 19 | if read < hop_size: break |
---|
| 20 | s.stop() |
---|
| 21 | |
---|
| 22 | if __name__ == '__main__': |
---|
| 23 | import sys |
---|
| 24 | play_source(sys.argv[1]) |
---|
Note: See
TracBrowser
for help on using the repository browser.