diff options
| author | Matthias Geier <Matthias.Geier@gmail.com> | 2015-06-21 13:10:40 +0200 |
|---|---|---|
| committer | Matthias Geier <Matthias.Geier@gmail.com> | 2015-07-01 15:37:03 +0200 |
| commit | 0529a60f464801f27817817b68410e5cd1e088f6 (patch) | |
| tree | 305c802b402e75e19f2a45c7cd802e80c88b849e /examples | |
| parent | 4c16c864062dacf03914f3b87cdbc91f70cd7337 (diff) | |
Remove logging, add get_status()
Diffstat (limited to 'examples')
| -rwxr-xr-x | examples/play_file.py | 6 |
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)) |
