Squeak Class Documentation category index | class index  
 
PluckedSound
  category: Sound-Synthesis
  superclass: AbstractSound
  subclasses:

The Karplus-Strong plucked string algorithm: start with a buffer full of random noise and repeatedly play the contents of that buffer while averaging adjacent samples. High harmonics damp out more quickly, transfering their energy to lower ones. The length of the buffer corresponds to the length of the string. Fractional indexing is used to allow precise tuning; without this, the pitch would be rounded to the pitch corresponding to the nearest buffer size.

instance methods
  accessing
  duration
duration:

  copying
  copy
copyRing

  initialization
  setPitch:dur:loudness:

  sound generation
  mixSampleCount:into:startingAt:leftVol:rightVol:
reset
samplesRemaining
stopAfterMSecs:

class methods
  instruments
  default

instance methods
  accessing top  
 

duration

Answer the duration of this sound in seconds.


 

duration:

Scale my envelopes to the given duration. Subclasses overriding this method should include a resend to super.


  copying top  
 

copy

A sound should copy all of the state needed to play itself, allowing two copies of a sound to play at the same time. These semantics require a recursive copy but only down to the level of immutable data. For example, a SampledSound need not copy its sample buffer. Subclasses overriding this method should include a resend to super.


 

copyRing

Private! Support for copying


  initialization top  
 

setPitch:dur:loudness:

Initialize my envelopes for the given parameters. Subclasses overriding this method should include a resend to super.


  sound generation top  
 

mixSampleCount:into:startingAt:leftVol:rightVol:

The Karplus-Strong plucked string algorithm: start with a buffer full of random noise and repeatedly play the contents of that buffer while averaging adjacent samples. High harmonics damp out more quickly, transfering their energy to lower ones. The length of the buffer corresponds to the length of the string.


 

reset

Fill the ring with random noise.


 

samplesRemaining

Answer the number of samples remaining until the end of this sound. A sound with an indefinite ending time should answer some large integer such as 1000000.


 

stopAfterMSecs:

Terminate this sound this note after the given number of milliseconds.


class methods
  instruments top  
 

default

PluckedSound default play