diff options
| author | Matthias Geier <Matthias.Geier@gmail.com> | 2016-08-05 10:01:06 +0200 |
|---|---|---|
| committer | Matthias Geier <Matthias.Geier@gmail.com> | 2016-08-05 10:01:06 +0200 |
| commit | fd9f706b90d5c64d9c7a6903e62724c251da012f (patch) | |
| tree | 15f5363cfe018b4e0cba49d1d2f623b9d3b9b682 /examples/spectrogram.py | |
| parent | 5408733e7f7b3ed1f350bbae8d74e758a00f0be7 (diff) | |
Round to integers in plot_input and spectrogram examples
See #21.
Diffstat (limited to 'examples/spectrogram.py')
| -rwxr-xr-x | examples/spectrogram.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/spectrogram.py b/examples/spectrogram.py index d0d5026..3c378f3 100755 --- a/examples/spectrogram.py +++ b/examples/spectrogram.py @@ -2,6 +2,7 @@ """Show a text-mode spectrogram using live microphone data.""" import argparse import logging +import math import numpy as np import shutil @@ -63,8 +64,8 @@ try: samplerate = sd.query_devices(args.device, 'input')['default_samplerate'] delta_f = (high - low) / (args.columns - 1) - fftsize = np.ceil(samplerate / delta_f).astype(int) - low_bin = np.floor(low / delta_f) + fftsize = math.ceil(samplerate / delta_f) + low_bin = math.floor(low / delta_f) cumulated_status = sd.CallbackFlags() |
