如何在 Octave 中播放声音? [英] How do I play a sound in Octave?

查看:34
本文介绍了如何在 Octave 中播放声音?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Octave 似乎假设特定的声音播放实用程序将在系统上可用,但似乎没有提供指定替代的能力.在下面的错误中,Octave 正在寻找 ofsndplay,它不是在所有系统上都可用的实用程序.

Octave appears to assume that a specific sound playing utility will be available on a system but doesn't seem to provide the ability to specify an alternate. In the error below, Octave is looking for ofsndplay, which is not a utility available on all systems.

八度:38>声音(beamformed_20)

octave:38> sound(beamformed_20)

sh: ofsndplay: 命令未找到

sh: ofsndplay: command not found

是否有 Octave 配置设置或代码片段可用于指定适用于系统的实用程序?

Is there an Octave configuration setting or code fragment that I can use to specify an system-appropriate utility?

推荐答案

在我的一台 Linux 机器上,我创建了以下 ofsndplay 脚本来解决硬连线依赖:

On one of my Linux machines, I created the following ofsndplay script to work around the hard-wired dependency:

$ cat /usr/bin/ofsndplay

#!/bin/sh
## Coping with stupid dependency on ofsndplay in octave
play -t au -

此特定脚本使用 SoX play 实用程序.

This particular script uses the SoX play utility.

诚然,评论对于功能来说是不必要的,但它确实让我感觉更好......

这篇关于如何在 Octave 中播放声音?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆