如何在给定指定分贝级别的情况下在 R 中创建波形声音?
IR,借助库 sound
,我们能够创建正弦波:
s1 <- Sine(650, 1, 44100, 16, 2)
绘制波形,我们获得如下图像:
plot(s1[1:100])
波形在 [-1, +1] 区间移动。如果我播放它,它对应于多少分贝?
如何生成具有指定分贝级别的波浪声(具有相同的参数)(即波浪声,频率650Hz,持续时间1秒,采样率44100,16位,2通道,55dB)?
提前致谢!
I R, thanks to the library sound
, we are able to create a sine wave:
s1 <- Sine(650, 1, 44100, 16, 2)
Plotting the waveform we obtain an image like this:
plot(s1[1:100])
The waveform moves in the interval [-1, +1]. If I play it, to what deciBel does it correspond?
How to generate a wave sound (with the same parameters), with a specified deciBel level (i.e. a wave sound, frequency 650Hz, duration 1 sec, sampling rate 44100, 16 bits, 2 channels, 55dB)?
Thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以我猜你想改变幅度,对吗?没有直接的方法可以按照您想要的方式改变
声音
的幅度,因为它是非常基本的包。尝试tuneR
或seewave
软件包提供更高级的选项和控制(例如 afilter inseewave
可能是一个很好的解决方案,但是不幸的是我无法在 R 2.14 中运行它 - 不兼容)。您可以用一种简单的方式做的是使用
normalize
来更改音量,但它不适用于sound
包中的“默认”幅度。例如,如果您产生这个正弦波,您可以通过以下方式对其进行归一化
您可以听到(并在绘图上看到)s2 声音更大。
So I guess you want to change the amplitude right? There is no straightforward way to change amplitude in
sound
the way you want, because it's very basic package. TrytuneR
orseewave
packages for much more advanced options and control (for example afilter inseewave
could be a good solution, but unfortunately I couldn't run it in R 2.14 - not compatible).What you could do in a simple way is to use
normalize
to change the volume, but it doesn't work for the 'default' amplitude insound
package. For example, if you produce this sine waveyou can normalize it by
And you can hear (and see on the plot) that the s2 is louder.