@@ -74,6 +74,8 @@ def record(duration: int = 3000, rate: int = 7812) -> AudioFrame:
74
74
"""Record sound into an ``AudioFrame`` for the amount of time indicated by
75
75
``duration`` at the sampling rate indicated by ``rate``.
76
76
77
+ Example: ``my_frame = microphone.record()``
78
+
77
79
The amount of memory consumed is directly related to the length of the
78
80
recording and the sampling rate. The higher these values, the more memory
79
81
it will use.
@@ -93,6 +95,8 @@ def record_into(buffer: AudioFrame, rate: int = 7812, wait: bool = True) -> None
93
95
"""Record sound into an existing ``AudioFrame`` until it is filled,
94
96
or the ``stop_recording()`` function is called.
95
97
98
+ Example: ``microphone.record_into()``
99
+
96
100
:param buffer: An ``AudioFrame`` to record sound.
97
101
:param rate: Number of samples to capture per second.
98
102
:param wait: When set to ``True`` it blocks until the recording is
@@ -103,13 +107,16 @@ def record_into(buffer: AudioFrame, rate: int = 7812, wait: bool = True) -> None
103
107
def is_recording () -> bool :
104
108
"""Checks whether the microphone is currently recording.
105
109
106
- :return: ``True`` if the microphone is currently recording sound, or
107
- ``False`` otherwise.
110
+ Example: ``is_recording = microphone.is_recording()``
111
+
112
+ :return: ``True`` if the microphone is currently recording sound, otherwise returns ``False``.
108
113
"""
109
114
...
110
115
111
116
def stop_recording () -> None :
112
117
"""Stops a recording running in the background.
118
+
119
+ Example: ``microphone.stop_recording()``
113
120
"""
114
121
...
115
122
@@ -126,6 +133,8 @@ SENSITIVITY_HIGH: float;
126
133
def set_sensitivity (gain : float ) -> None :
127
134
"""Configure the microphone sensitivity.
128
135
136
+ Example: ``microphone.set_sensitivity(microphone.SENSITIVITY_HIGH)``
137
+
129
138
The default sensitivity is ``microphone.SENSITIVITY_MEDIUM``.
130
139
131
140
:param gain: The microphone gain. Use ``microphone.SENSITIVITY_LOW``, ``microphone.SENSITIVITY_MEDIUM``, ``microphone.SENSITIVITY_HIGH``, or a value between these levels.
0 commit comments