dora-microphone 0.3.7__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ import os
2
+
3
+ # Define the path to the README file relative to the package directory
4
+ readme_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), "README.md")
5
+
6
+ # Read the content of the README file
7
+ try:
8
+ with open(readme_path, "r", encoding="utf-8") as f:
9
+ __doc__ = f.read()
10
+ except FileNotFoundError:
11
+ __doc__ = "README file not found."
@@ -0,0 +1,36 @@
1
+ import sounddevice as sd
2
+ import numpy as np
3
+ import pyarrow as pa
4
+ import time as tm
5
+ import os
6
+
7
+ from dora import Node
8
+
9
+ MAX_DURATION = float(os.getenv("MAX_DURATION", "0.1"))
10
+ SAMPLE_RATE = int(os.getenv("SAMPLE_RATE", "16000"))
11
+
12
+
13
+ def main():
14
+ # Initialize buffer and recording flag
15
+ buffer = []
16
+ start_recording_time = tm.time()
17
+ node = Node()
18
+
19
+ # pylint: disable=unused-argument
20
+ def callback(indata, frames, time, status):
21
+ nonlocal buffer, node, start_recording_time
22
+
23
+ if tm.time() - start_recording_time > MAX_DURATION:
24
+ audio_data = np.array(buffer).ravel().astype(np.float32) / 32768.0
25
+ node.send_output("audio", pa.array(audio_data))
26
+ buffer = []
27
+ start_recording_time = tm.time()
28
+ else:
29
+ buffer.extend(indata[:, 0])
30
+
31
+ # Start recording
32
+ with sd.InputStream(
33
+ callback=callback, dtype=np.int16, channels=1, samplerate=SAMPLE_RATE
34
+ ):
35
+ while True:
36
+ sd.sleep(int(100 * 1000))
@@ -0,0 +1,31 @@
1
+ Metadata-Version: 2.1
2
+ Name: dora-microphone
3
+ Version: 0.3.7
4
+ Summary: Dora dora-microphone
5
+ Home-page: https://github.com/dora-rs/dora.git
6
+ License: MIT
7
+ Author: Haixuan Xavier Tao
8
+ Author-email: tao.xavier@outlook.com
9
+ Requires-Python: >=3.7,<4.0
10
+ Classifier: License :: OSI Approved :: MIT License
11
+ Classifier: Programming Language :: Python :: 3
12
+ Classifier: Programming Language :: Python :: 3.7
13
+ Classifier: Programming Language :: Python :: 3.8
14
+ Classifier: Programming Language :: Python :: 3.9
15
+ Classifier: Programming Language :: Python :: 3.10
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Requires-Dist: dora-rs (>=0.3.6,<0.4.0)
20
+ Requires-Dist: numpy (<2.0.0)
21
+ Requires-Dist: pyarrow (>=5.0.0)
22
+ Requires-Dist: sounddevice (>=0.4.6,<0.5.0)
23
+ Project-URL: Documentation, https://github.com/dora-rs/dora/blob/main/node-hub/dora-microphone/README.md
24
+ Description-Content-Type: text/markdown
25
+
26
+ # Dora Node for recording data from microphone
27
+
28
+ This node will send data as soon as the microphone volume is higher than a threshold.
29
+
30
+ Check example at [examples/speech-to-text](examples/speech-to-text)
31
+
@@ -0,0 +1,6 @@
1
+ dora_microphone/__init__.py,sha256=Gy4qL4vCeTyA5HR1Yp3ioL4-ClJyW8oi_38CzMuMsBM,358
2
+ dora_microphone/main.py,sha256=V_ig3WoKbdTDLJ4rGvGMSAb_AjGZw-Z-2DY9Je-Z9XI,1006
3
+ dora_microphone-0.3.7.dist-info/METADATA,sha256=ajoWnMFml64tgKayFcTg-eeKPC7-q0bk8zt6yo3oPko,1191
4
+ dora_microphone-0.3.7.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
5
+ dora_microphone-0.3.7.dist-info/entry_points.txt,sha256=T7lmS26gTsxKwY0UAyR6GkjNDGYbyAFVzl94yMSePKc,61
6
+ dora_microphone-0.3.7.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: poetry-core 1.9.1
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,3 @@
1
+ [console_scripts]
2
+ dora-microphone=dora_microphone.main:main
3
+