Python scipy 读取wav文件
【摘要】 环境信息ModelArtsNotebook - pytorch1.4-cuda10.1-cudnn7-ubuntu18.04JupyterLab - Notebook - Conda-python3 scipy 读取wav文件from scipy.io import wavfile------------------------------------------------------...
环境信息
- ModelArts
- Notebook - pytorch1.4-cuda10.1-cudnn7-ubuntu18.04
- JupyterLab - Notebook - Conda-python3
- Notebook - pytorch1.4-cuda10.1-cudnn7-ubuntu18.04
scipy 读取wav文件
from scipy.io import wavfile
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-11-d8cfb95a15c0> in <module>
----> 1 from scipy.io import wavfile
ModuleNotFoundError: No module named 'scipy'
!pip install scipy
Looking in indexes: http://repo.myhuaweicloud.com/repository/pypi/simple
Collecting scipy
Downloading http://repo.myhuaweicloud.com/repository/pypi/packages/7d/e8/43ffca541d2f208d516296950b25fe1084b35c2881f4d444c1346ca75815/scipy-1.6.3-cp37-cp37m-manylinux1_x86_64.whl (27.4 MB)
|████████████████████████████████| 27.4 MB 20.5 MB/s eta 0:00:01 | 8.7 MB 20.5 MB/s eta 0:00:01��████████ | 15.4 MB 20.5 MB/s eta 0:00:01 eta 0:00:01
Requirement already satisfied: numpy<1.23.0,>=1.16.5 in /home/ma-user/modelarts-sdk (from scipy) (1.21.0)
Installing collected packages: scipy
Successfully installed scipy-1.6.3
from scipy.io import wavfile
wav_file = wavfile.read("1.wav")
wav_file
(48000,
array([[ 0, 0],
[ 0, 0],
[ 0, 0],
...,
[ -4, -7],
[ 6, -7],
[-17, -34]], dtype=int16))
help
help(wavfile.read)
Help on function read in module scipy.io.wavfile:
read(filename, mmap=False)
Open a WAV file.
Return the sample rate (in samples/sec) and data from an LPCM WAV file.
Parameters
----------
filename : string or open file handle
Input WAV file.
mmap : bool, optional
Whether to read data as memory-mapped (default: False). Not compatible
with some bit depths; see Notes. Only to be used on real files.
.. versionadded:: 0.12.0
......
相关链接
备注
- 欢迎各位同学一起来交流学习心得^_^
- 在线课程、沙箱实验、认证、论坛和直播,其中包含了许多优质的内容,推荐了解与学习。
【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)