Skip to content

Commit 032ca21

Browse files
authored
Merge pull request #549 from snakers4/adamnsandle
Adamnsandle
2 parents 9c1eff9 + 001d57d commit 032ca21

File tree

2 files changed

+56
-30
lines changed

2 files changed

+56
-30
lines changed

examples/pyaudio-streaming/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ It has been designed as a low-level example for binary real-time streaming using
77
Currently, the notebook consits of two examples:
88
- One that records audio of a predefined length from the microphone, process it with Silero-VAD, and plots it afterwards.
99
- The other one plots the speech probabilities in real-time (using jupyterplot) and records the audio until you press enter.
10+
11+
This example does not work in google colab! For local usage only.
1012

1113
## Example Video for the Real-Time Visualization
1214

examples/pyaudio-streaming/pyaudio-streaming-examples.ipynb

Lines changed: 54 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "markdown",
5-
"id": "62a0cccb",
5+
"id": "76aa55ba",
66
"metadata": {},
77
"source": [
88
"# Pyaudio Microphone Streaming Examples\n",
@@ -12,12 +12,14 @@
1212
"I created it as an example on how binary data from a stream could be feed into Silero VAD.\n",
1313
"\n",
1414
"\n",
15-
"Has been tested on Ubuntu 21.04 (x86). After you installed the dependencies below, no additional setup is required."
15+
"Has been tested on Ubuntu 21.04 (x86). After you installed the dependencies below, no additional setup is required.\n",
16+
"\n",
17+
"This notebook does not work in google colab! For local usage only."
1618
]
1719
},
1820
{
1921
"cell_type": "markdown",
20-
"id": "64cbe1eb",
22+
"id": "4a4e15c2",
2123
"metadata": {},
2224
"source": [
2325
"## Dependencies\n",
@@ -26,33 +28,55 @@
2628
},
2729
{
2830
"cell_type": "code",
29-
"execution_count": null,
30-
"id": "57bc2aac",
31-
"metadata": {},
31+
"execution_count": 1,
32+
"id": "24205cce",
33+
"metadata": {
34+
"ExecuteTime": {
35+
"end_time": "2024-10-09T08:47:34.056898Z",
36+
"start_time": "2024-10-09T08:47:34.053418Z"
37+
}
38+
},
3239
"outputs": [],
3340
"source": [
34-
"#!pip install numpy==2.0.2\n",
35-
"#!pip install torch==2.4.1\n",
36-
"#!pip install matplotlib==3.9.2\n",
37-
"#!pip install torchaudio==2.4.1\n",
41+
"#!pip install numpy>=1.24.0\n",
42+
"#!pip install torch>=1.12.0\n",
43+
"#!pip install matplotlib>=3.6.0\n",
44+
"#!pip install torchaudio>=0.12.0\n",
3845
"#!pip install soundfile==0.12.1\n",
39-
"#!pip install pyaudio==0.2.11"
46+
"#!apt install python3-pyaudio (linux) or pip install pyaudio (windows)"
4047
]
4148
},
4249
{
4350
"cell_type": "markdown",
44-
"id": "110de761",
51+
"id": "cd22818f",
4552
"metadata": {},
4653
"source": [
4754
"## Imports"
4855
]
4956
},
5057
{
5158
"cell_type": "code",
52-
"execution_count": null,
53-
"id": "5a647d8d",
54-
"metadata": {},
55-
"outputs": [],
59+
"execution_count": 2,
60+
"id": "994d7f3a",
61+
"metadata": {
62+
"ExecuteTime": {
63+
"end_time": "2024-10-09T08:47:39.005032Z",
64+
"start_time": "2024-10-09T08:47:36.489952Z"
65+
}
66+
},
67+
"outputs": [
68+
{
69+
"ename": "ModuleNotFoundError",
70+
"evalue": "No module named 'pyaudio'",
71+
"output_type": "error",
72+
"traceback": [
73+
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
74+
"\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)",
75+
"Cell \u001b[0;32mIn[2], line 8\u001b[0m\n\u001b[1;32m 6\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\n\u001b[1;32m 7\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mmatplotlib\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mpylab\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m \u001b[38;5;21;01mplt\u001b[39;00m\n\u001b[0;32m----> 8\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mpyaudio\u001b[39;00m\n",
76+
"\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'pyaudio'"
77+
]
78+
}
79+
],
5680
"source": [
5781
"import io\n",
5882
"import numpy as np\n",
@@ -67,7 +91,7 @@
6791
{
6892
"cell_type": "code",
6993
"execution_count": null,
70-
"id": "725d7066",
94+
"id": "ac5c52f7",
7195
"metadata": {},
7296
"outputs": [],
7397
"source": [
@@ -79,7 +103,7 @@
79103
{
80104
"cell_type": "code",
81105
"execution_count": null,
82-
"id": "1c0b2ea7",
106+
"id": "ad5919dc",
83107
"metadata": {},
84108
"outputs": [],
85109
"source": [
@@ -92,7 +116,7 @@
92116
},
93117
{
94118
"cell_type": "markdown",
95-
"id": "f9112603",
119+
"id": "784d1ab6",
96120
"metadata": {},
97121
"source": [
98122
"### Helper Methods"
@@ -101,7 +125,7 @@
101125
{
102126
"cell_type": "code",
103127
"execution_count": null,
104-
"id": "5abc6330",
128+
"id": "af4bca64",
105129
"metadata": {},
106130
"outputs": [],
107131
"source": [
@@ -124,7 +148,7 @@
124148
},
125149
{
126150
"cell_type": "markdown",
127-
"id": "5124095e",
151+
"id": "ca13e514",
128152
"metadata": {},
129153
"source": [
130154
"## Pyaudio Set-up"
@@ -133,7 +157,7 @@
133157
{
134158
"cell_type": "code",
135159
"execution_count": null,
136-
"id": "a845356e",
160+
"id": "75f99022",
137161
"metadata": {},
138162
"outputs": [],
139163
"source": [
@@ -147,7 +171,7 @@
147171
},
148172
{
149173
"cell_type": "markdown",
150-
"id": "0b910c99",
174+
"id": "4da7d2ef",
151175
"metadata": {},
152176
"source": [
153177
"## Simple Example\n",
@@ -157,7 +181,7 @@
157181
{
158182
"cell_type": "code",
159183
"execution_count": null,
160-
"id": "9d3d2c10",
184+
"id": "6fe77661",
161185
"metadata": {},
162186
"outputs": [],
163187
"source": [
@@ -167,7 +191,7 @@
167191
{
168192
"cell_type": "code",
169193
"execution_count": null,
170-
"id": "3cb44a4a",
194+
"id": "23f4da3e",
171195
"metadata": {},
172196
"outputs": [],
173197
"source": [
@@ -207,7 +231,7 @@
207231
},
208232
{
209233
"cell_type": "markdown",
210-
"id": "a3dda982",
234+
"id": "fd243e8f",
211235
"metadata": {},
212236
"source": [
213237
"## Real Time Visualization\n",
@@ -220,7 +244,7 @@
220244
{
221245
"cell_type": "code",
222246
"execution_count": null,
223-
"id": "05ef4100",
247+
"id": "d36980c2",
224248
"metadata": {},
225249
"outputs": [],
226250
"source": [
@@ -230,7 +254,7 @@
230254
{
231255
"cell_type": "code",
232256
"execution_count": null,
233-
"id": "d1d4cdd6",
257+
"id": "5607b616",
234258
"metadata": {},
235259
"outputs": [],
236260
"source": [
@@ -287,7 +311,7 @@
287311
{
288312
"cell_type": "code",
289313
"execution_count": null,
290-
"id": "1e398009",
314+
"id": "dc4f0108",
291315
"metadata": {},
292316
"outputs": [],
293317
"source": [
@@ -311,7 +335,7 @@
311335
"name": "python",
312336
"nbconvert_exporter": "python",
313337
"pygments_lexer": "ipython3",
314-
"version": "3.9.10"
338+
"version": "3.10.14"
315339
},
316340
"toc": {
317341
"base_numbering": 1,

0 commit comments

Comments
 (0)