0

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.

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.

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

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
user1349933
  • 11
  • 1
  • 2
  • 1
    *"Can you help me with the math aspect of making this happen?"* You most likely won't find a tutor on SO, since that is not what it is for. You'll have better luck showing what you have tried and asking a specific question. Also, don't forget to add a question mark to questions. As it stands, I am voting to close this as 'not a real question'. – Andrew Thompson Aug 30 '12 at 00:39

1 Answers1

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 :)

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
Parallelis
  • 699
  • 3
  • 6