Fixed the pyaudio example can not run issue.

Update the related packages.
This commit is contained in:
GengYuchao
2024-09-11 00:41:49 +08:00
parent 46f94b7d60
commit d0139d94d9

View File

@@ -31,11 +31,11 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"#!pip install numpy==1.20.2\n", "#!pip install numpy==2.0.2\n",
"#!pip install torch==1.9.0\n", "#!pip install torch==2.4.1\n",
"#!pip install matplotlib==3.4.2\n", "#!pip install matplotlib==3.9.2\n",
"#!pip install torchaudio==0.9.0\n", "#!pip install torchaudio==2.4.1\n",
"#!pip install soundfile==0.10.3.post1\n", "#!pip install soundfile==0.12.1\n",
"#!pip install pyaudio==0.2.11" "#!pip install pyaudio==0.2.11"
] ]
}, },
@@ -61,7 +61,6 @@
"import torchaudio\n", "import torchaudio\n",
"import matplotlib\n", "import matplotlib\n",
"import matplotlib.pylab as plt\n", "import matplotlib.pylab as plt\n",
"torchaudio.set_audio_backend(\"soundfile\")\n",
"import pyaudio" "import pyaudio"
] ]
}, },
@@ -162,7 +161,7 @@
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"num_samples = 1536" "num_samples = 512"
] ]
}, },
{ {
@@ -180,6 +179,8 @@
"data = []\n", "data = []\n",
"voiced_confidences = []\n", "voiced_confidences = []\n",
"\n", "\n",
"frames_to_record = 50\n",
"\n",
"print(\"Started Recording\")\n", "print(\"Started Recording\")\n",
"for i in range(0, frames_to_record):\n", "for i in range(0, frames_to_record):\n",
" \n", " \n",
@@ -296,7 +297,7 @@
], ],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 3 (ipykernel)",
"language": "python", "language": "python",
"name": "python3" "name": "python3"
}, },
@@ -310,7 +311,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.7.10" "version": "3.9.10"
}, },
"toc": { "toc": {
"base_numbering": 1, "base_numbering": 1,