gpt4 book ai didi

java - Google 语音 API 抛出无效的音频 channel 数

转载 作者:搜寻专家 更新时间:2023-10-31 20:00:09 25 4
gpt4 key购买 nike

对于在 Mac 机器上录制的音频,Google Speech API 抛出无效的音频 channel 计数异常。

我只是在使用 Google 提供的示例应用程序。

com.google.api.gax.grpc.ApiException: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Invalid audio channel count
at com.google.api.gax.grpc.ExceptionTransformingCallable$ExceptionTransformingFuture.onFailure(ExceptionTransformingCallable.java:109)
at com.google.api.gax.core.ApiFutures$1.onFailure(ApiFutures.java:52)
at com.google.common.util.concurrent.Futures$6.run(Futures.java:1764)
at com.google.common.util.concurrent.MoreExecutors$DirectExecutor.execute(MoreExecutors.java:456)
at com.google.common.util.concurrent.AbstractFuture.executeListener(AbstractFuture.java:817)
at com.google.common.util.concurrent.AbstractFuture.complete(AbstractFuture.java:753)
at com.google.common.util.concurrent.AbstractFuture.setException(AbstractFuture.java:634)
at io.grpc.stub.ClientCalls$GrpcFuture.setException(ClientCalls.java:466)
at io.grpc.stub.ClientCalls$UnaryStreamToFuture.onClose(ClientCalls.java:442)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.close(ClientCallImpl.java:481)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl.access$600(ClientCallImpl.java:398)
at io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1StreamClosed.runInContext(ClientCallImpl.java:513)
at io.grpc.internal.ContextRunnable.run(ContextRunnable.java:52)
at io.grpc.internal.SerializingExecutor$TaskRunner.run(SerializingExecutor.java:154)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: io.grpc.StatusRuntimeException: INVALID_ARGUMENT: Invalid audio channel count
at io.grpc.Status.asRuntimeException(Status.java:545)
... 13 more

这需要任何特殊配置吗?

这个错误是什么意思?

最佳答案

在 Mac 上录制的音频很可能是立体声,但目前 API 似乎只支持单声道(单声道)音频。来自 docs 的音频编码部分:

Audio encoding of the data sent in the audio message. All encodings support only 1 channel (mono) audio.

这里最简单的解决方案可能是使用 Audacity 之类的工具将您的样本转换为单声道。

关于java - Google 语音 API 抛出无效的音频 channel 数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43247957/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com