summaryrefslogtreecommitdiff
path: root/README.rst
diff options
context:
space:
mode:
authorMatthias Geier <Matthias.Geier@gmail.com>2017-02-14 23:20:57 +0100
committerMatthias Geier <Matthias.Geier@gmail.com>2017-02-16 20:45:25 +0100
commit747030a8a6db88f7541f773fabae00cdb2c145b9 (patch)
treed7e29400c3d60404b76537f4b67091267df7c40e /README.rst
parent21df69e2b2be4d59b5c8257d7efbf27a75eeb8dd (diff)
DOC: A few documentation changes
Diffstat (limited to 'README.rst')
-rw-r--r--README.rst16
1 files changed, 8 insertions, 8 deletions
diff --git a/README.rst b/README.rst
index 9d62939..b9c1d99 100644
--- a/README.rst
+++ b/README.rst
@@ -140,8 +140,8 @@ To record audio data from your sound device into a NumPy array, use
.. code:: python
- duration = 10 # seconds
- myrecording = sd.rec(duration * fs, samplerate=fs, channels=2)
+ duration = 10.5 # seconds
+ myrecording = sd.rec(int(duration * fs), samplerate=fs, channels=2)
Again, for repeated use you can set defaults using `sounddevice.default`:
@@ -237,30 +237,30 @@ Callback "wire" with `sounddevice.Stream`:
.. code:: python
import sounddevice as sd
- duration = 5 # seconds
+ duration = 5.5 # seconds
def callback(indata, outdata, frames, time, status):
if status:
- print(status, flush=True)
+ print(status)
outdata[:] = indata
with sd.Stream(channels=2, callback=callback):
- sd.sleep(duration * 1000)
+ sd.sleep(int(duration * 1000))
Same thing with `sounddevice.RawStream`:
.. code:: python
import sounddevice as sd
- duration = 5 # seconds
+ duration = 5.5 # seconds
def callback(indata, outdata, frames, time, status):
if status:
- print(status, flush=True)
+ print(status)
outdata[:] = indata
with sd.RawStream(channels=2, dtype='int24', callback=callback):
- sd.sleep(duration * 1000)
+ sd.sleep(int(duration * 1000))
.. note:: We are using 24-bit samples here for no particular reason
(just because we can).