linux + piano keyboard support
This commit is contained in:
@@ -37,7 +37,7 @@ void PianoString::noteOn(float frequency, float velocity) {
|
||||
}
|
||||
// apply the velocity impulse
|
||||
for(size_t i = 0; i < segmentCount_ + 1; i++) {
|
||||
float v0 = impulseVelocity_ * std::exp(-1.0f * (stringX_[i] - strikePosition_*L_)*(stringX_[i] - strikePosition_*L_) / ((2.0f * impulseWidth_)*(2.0f * impulseWidth_)));
|
||||
float v0 = velocity * impulseVelocity_ * std::exp(-1.0f * (stringX_[i] - strikePosition_*L_)*(stringX_[i] - strikePosition_*L_) / ((2.0f * impulseWidth_)*(2.0f * impulseWidth_)));
|
||||
stringY_current_[i] = stringY_current_[i] + dt_ * v0;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ private:
|
||||
float mu_ = crossSectionalArea_ * rho_; // linear mass density
|
||||
float waveVelocity_ = std::sqrt(stringTension_ / mu_); // transverse wave velocity
|
||||
float L_ = 1.0f; // length of string at a given frequency
|
||||
float gain_ = 0.3f;
|
||||
float gain_ = 0.5f;
|
||||
|
||||
// f0_ = waveVelocity_ / (2.0f * stringLength_); // fundamental frequency of a non-stiff string
|
||||
// f1_ = f0_ * std::sqrt(1.0f + stiffness_); // fundamental frequency of the stiff string
|
||||
|
||||
Reference in New Issue
Block a user