summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMatthias Geier <Matthias.Geier@gmail.com>2015-06-21 13:10:40 +0200
committerMatthias Geier <Matthias.Geier@gmail.com>2015-07-01 15:37:03 +0200
commit0529a60f464801f27817817b68410e5cd1e088f6 (patch)
tree305c802b402e75e19f2a45c7cd802e80c88b849e /examples
parent4c16c864062dacf03914f3b87cdbc91f70cd7337 (diff)
Remove logging, add get_status()
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/play_file.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/examples/play_file.py b/examples/play_file.py
index 7161ceb..8483777 100755
--- a/examples/play_file.py
+++ b/examples/play_file.py
@@ -5,6 +5,7 @@ PySoundFile (https://github.com/bastibe/PySoundFile/) has to be installed!
"""
import argparse
+import logging
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("filename", help="audio file to be played back")
@@ -15,7 +16,10 @@ try:
import sounddevice as sd
import soundfile as sf
data, fs = sf.read(args.filename, dtype='float32')
- sd.play(data, fs, device=args.device, blocking=True)
+ sd.play(data, fs, device=args.device)
+ status = sd.wait()
+ if status:
+ logging.warning(str(status))
except BaseException as e:
# This avoids printing the traceback, especially if Ctrl-C is used.
raise SystemExit(str(e))