Sign in

username:

password:



Not a member?

Search Online Books



Search tips

Free Online Books

Sponsor

NEW! TMS320C6474: 3x the performance. 1/3 the cost. Three 1 GHz cores on 1 chip.

Chapters

Chapter Contents:

Search Physical Audio Signal Processing

  

Book Index | Global Index


Would you like to be notified by email when Julius Orion Smith III publishes a new entry into his blog?

  

SimpString.h

/* Simplified string model.               */ 
/* Compatible with STK version 4.2.1.     */

#if !defined(__SimpString_h)
#define __SimpString_h

#include "Instrmnt.h"
#include "Delay.h"
#include "DelayA.h"
#include "Filter.h"

class SimpString : public Instrmnt
{
 protected:  
  DelayA *delayLine;  // main string
  Delay *combDelay;   // pick-position simulation
  Filter *loopFilter; // string losses
  long length;
  StkFloat loopGain;
  StkFloat lastFreq;
  StkFloat lastLength;
  StkFloat pluckAmp;
  StkFloat pluckPos;
  StkFloat computeSample(StkFloat stringInput);
  StkFloat computeSample(void);
 public:
  SimpString(StkFloat lowestFreq);
  ~SimpString();
  void clear();
  void setPluckPos(StkFloat position);
  void pluck(StkFloat amplitude);
  void setFreq(StkFloat frequency);
  void pluck(StkFloat amplitude,StkFloat position);
  void noteOn(StkFloat freq, StkFloat amp);
  void noteOn(StkFloat freq, StkFloat amp, StkFloat position);
  StkFloat tick(StkFloat stringInput);
  StkFloat tick(void);
  void noteOff(StkFloat amp);
  void setBearing(StkFloat angle); /* -45 to +45 degrees */
};
#endif


Order a Hardcopy of Physical Audio Signal Processing

Previous: Listing of test main program: main.cpp
Next: SimpString.cpp

written by Julius Orion Smith III
Julius Smith's background is in electrical engineering (BS Rice 1975, PhD Stanford 1983). He is presently Professor of Music and Associate Professor (by courtesy) of Electrical Engineering at Stanford's Center for Computer Research in Music and Acoustics (CCRMA), teaching courses and pursuing research related to signal processing applied to music and audio systems. See http://ccrma.stanford.edu/~jos/ for details.


Comments


No comments yet for this page


Add a Comment
You need to login before you can post a comment (best way to prevent spam). ( Not a member? )