Skip to content

解决 Audio data must be floating-point - #29

Merged
R1ckShi merged 1 commit into
modelscope:mainfrom
zhouzhenneng:main
May 1, 2024
Merged

R1ckShi merged 1 commit into
modelscope:mainfrom
zhouzhenneng:main

Conversation

@zhouzhenneng

Copy link
Copy Markdown

在魔塔在线体验和本地部署之后,上传wav音频,均遇到如下报错:
File "funclip/launch.py", line 21, in audio_recog
return audio_clipper.recog(audio_input, sd_switch, hotwords=hotwords)
File "/root/FunClip/FunClip/funclip/videoclipper.py", line 30, in recog
data = librosa.resample(data, orig_sr=sr, target_sr=16000)
File "/root/miniconda3/envs/funclip/lib/python3.8/site-packages/librosa/core/audio.py", line 627, in resample
util.valid_audio(y, mono=False)
File "/root/miniconda3/envs/funclip/lib/python3.8/site-packages/librosa/util/utils.py", line 298, in valid_audio
raise ParameterError("Audio data must be floating-point")
librosa.util.exceptions.ParameterError: Audio data must be floating-point
这段报错,主要是librosa 在处理音频数据时期望浮点型数据,但接收到的可能是整型数据(例如int16)。librosa 处理音频时,音频数据需要是浮点数格式,通常范围在 -1.0 到 1.0,所以增加了convert_pcm_to_float 函数将音频转成浮点数

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


zhouzhenneng seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants