在指定范围内创建单个正弦波

时间:2022-02-07 07:16:57

I am trying to imitate a string instrument. I have a ring buffer implemented as a Linked List with all of the values initialized at 0 to represent a sine wave at rest.

我想模仿弦乐器。我有一个环形缓冲区实现为链接列表,所有值初始化为0表示静止时的正弦波。

I am writing a pluck() method that replaces the N elements(all values currently at 0) in the buffer with N samples of a single sine wave with values between -.5 and +5.

我正在编写一个pluck()方法,它用缓冲区中的N个元素(当前为0的所有值)替换单个正弦波的N个样本,其值介于-.5和+5之间。

Can you help me with the math aspect of making this happen?

你能帮我解决这个问题吗?

1 个解决方案

#1


0  

You have to create a sine function for your fundamental frequency, and others if you want to introduce harmonics (with sqrt(2) frequencies ratio), then add an attack slope and duration, idem for sustain and release. This is the basics of old-school electronic music :)

您必须为您的基频创建正弦函数,如果您想要引入谐波(具有sqrt(2)频率比),则必须为其他频率创建正弦函数,然后添加攻击斜率和持续时间,用于维持和释放。这是老式电子音乐的基础知识:)

#1


0  

You have to create a sine function for your fundamental frequency, and others if you want to introduce harmonics (with sqrt(2) frequencies ratio), then add an attack slope and duration, idem for sustain and release. This is the basics of old-school electronic music :)

您必须为您的基频创建正弦函数,如果您想要引入谐波(具有sqrt(2)频率比),则必须为其他频率创建正弦函数,然后添加攻击斜率和持续时间,用于维持和释放。这是老式电子音乐的基础知识:)