MYFLT FM4Alg5_tick(FM4OP *p, MYFLT c1, MYFLT c2) { MYFLT temp,temp2; MYFLT lastOutput; temp = p->gains[1] * ADSR_tick(&p->adsr[1]) * Wave_tick(&p->w_time[1], (int32_t)p->waves[1]->flen, p->waves[1]->ftable, p->w_rate[1], p->w_phase[1]); temp = temp * c1; p->w_phase[0] = p->waves[0]->flen * temp; /* addPhaseOffset */ p->w_phase[3] = p->waves[0]->flen * p->twozero.lastOutput; temp = p->gains[3] * ADSR_tick(&p->adsr[3]) * Wave_tick(&p->w_time[3], (int32_t)p->waves[3]->flen, p->waves[3]->ftable, p->w_rate[3], p->w_phase[3]); TwoZero_tick(&p->twozero, temp); p->w_phase[2] = p->waves[2]->flen * temp; /* addPhaseOffset */ temp = (FL(1.0) - ( c2 * FL(0.5))) * p->gains[0] * ADSR_tick(&p->adsr[0]) * Wave_tick(&p->w_time[0], (int32_t)p->waves[0]->flen, p->waves[0]->ftable, p->w_rate[0], p->w_phase[0]); temp += c2 * FL(0.5) * p->gains[2] * ADSR_tick(&p->adsr[2]) * Wave_tick(&p->w_time[2], (int32_t)p->waves[2]->flen, p->waves[2]->ftable, p->w_rate[2], p->w_phase[2]); temp2 = Wave_tick(&p->v_time, (int32_t)p->vibWave->flen, p->vibWave->ftable, p->v_rate, FL(0.0)) * *p->modDepth; /* Calculate amplitude mod */ temp = temp * (FL(1.0) + temp2); /* and apply it to output */ lastOutput = temp * FL(0.5); return lastOutput; }
MYFLT FM4Alg4_tick(CSOUND *csound, FM4OP *p, MYFLT c1, MYFLT c2) { MYFLT temp; MYFLT lastOutput; temp = Wave_tick(&p->v_time, (int32_t)p->vibWave->flen, p->vibWave->ftable, p->v_rate, FL(0.0)) * *p->modDepth * FL(0.2); temp = p-> baseFreq * (FL(1.0) + temp)* csound->onedsr; p->w_rate[0] = p->ratios[0] * temp * p->waves[0]->flen; p->w_rate[1] = p->ratios[1] * temp * p->waves[1]->flen; p->w_rate[2] = p->ratios[2] * temp * p->waves[2]->flen; p->w_rate[3] = p->ratios[3] * temp * p->waves[3]->flen; p->w_phase[3] = p->waves[3]->flen * p->twozero.lastOutput; temp = p->gains[3] * ADSR_tick(&p->adsr[3]) * Wave_tick(&p->w_time[3], (int32_t)p->waves[3]->flen, p->waves[3]->ftable, p->w_rate[3], p->w_phase[3]); TwoZero_tick(&p->twozero, temp); p->w_phase[2] = p->waves[2]->flen * temp; temp = (FL(1.0) - (c2 * FL(0.5))) * p->gains[2] * ADSR_tick(&p->adsr[2]) * Wave_tick(&p->w_time[2], (int32_t)p->waves[2]->flen, p->waves[2]->ftable, p->w_rate[2], p->w_phase[2]); temp += c2 * FL(0.5) * p->gains[1] * ADSR_tick(&p->adsr[1]) * Wave_tick(&p->w_time[1], (int32_t)p->waves[1]->flen, p->waves[1]->ftable, p->w_rate[1], p->w_phase[1]); temp = temp * c1; p->w_phase[0] = p->waves[0]->flen * temp; temp = p->gains[0] * ADSR_tick(&p->adsr[0]) * Wave_tick(&p->w_time[0], (int32_t)p->waves[0]->flen, p->waves[0]->ftable, p->w_rate[0], p->w_phase[0]); lastOutput = temp * FL(0.5); return lastOutput; }
MYFLT FM4Alg6_tick(CSOUND *csound, FM4OPV *q) { MYFLT temp,temp2; FM4OP *p = (FM4OP*)q; temp = p->gains[3] * ADSR_tick(&p->adsr[3]) * Wave_tick(&p->w_time[3], (int32_t)p->waves[3]->flen, p->waves[3]->ftable, p->w_rate[3], p->w_phase[3]); /* Calculate frequency mod */ temp2 = Wave_tick(&p->v_time, (int32_t)p->vibWave->flen, p->vibWave->ftable, p->v_rate, FL(0.0)) * *p->modDepth * FL(0.1); temp2 = (FL(1.0) + temp2) * p->baseFreq * csound->onedsr; p->w_rate[0] = temp2 * p->ratios[0] * p->waves[0]->flen; p->w_rate[1] = temp2 * p->ratios[1] * p->waves[1]->flen; p->w_rate[2] = temp2 * p->ratios[2] * p->waves[2]->flen; p->w_rate[3] = temp2 * p->ratios[3] * p->waves[3]->flen; p->w_phase[0] = p->waves[0]->flen * temp * q->mods[0]; p->w_phase[1] = p->waves[1]->flen * temp * q->mods[1]; p->w_phase[2] = p->waves[2]->flen * temp * q->mods[2]; p->w_phase[3] = p->waves[3]->flen * p->twozero.lastOutput; TwoZero_tick(&p->twozero, temp); temp = p->gains[0] * q->tilt[0] * ADSR_tick(&p->adsr[0]) * Wave_tick(&p->w_time[0], (int32_t)p->waves[0]->flen, p->waves[0]->ftable, p->w_rate[0], p->w_phase[0]); temp += p->gains[1] * q->tilt[1] * ADSR_tick(&p->adsr[1]) * Wave_tick(&p->w_time[1], (int32_t)p->waves[1]->flen, p->waves[1]->ftable, p->w_rate[1], p->w_phase[1]); temp += p->gains[2] * q->tilt[2] * ADSR_tick(&p->adsr[2]) * Wave_tick(&p->w_time[2], (int32_t)p->waves[2]->flen, p->waves[2]->ftable, p->w_rate[2], p->w_phase[2]); return temp * FL(0.33); }
MYFLT FM4Alg8_tick(FM4OP *p, MYFLT c1, MYFLT c2) { MYFLT temp; MYFLT lastOutput; p->w_phase[3] = p->waves[3]->flen * p->twozero.lastOutput; temp = c1 * FL(2.0) * p->gains[3] * ADSR_tick(&p->adsr[3]) * Wave_tick(&p->w_time[3], (int32_t)p->waves[3]->flen, p->waves[3]->ftable, p->w_rate[3], p->w_phase[3]); TwoZero_tick(&p->twozero, temp); temp += c2 * FL(2.0) * p->gains[2] * ADSR_tick(&p->adsr[2]) * Wave_tick(&p->w_time[2], (int32_t)p->waves[2]->flen, p->waves[2]->ftable, p->w_rate[2], p->w_phase[2]); temp += p->gains[1] * ADSR_tick(&p->adsr[1]) * Wave_tick(&p->w_time[1], (int32_t)p->waves[1]->flen, p->waves[1]->ftable, p->w_rate[1], p->w_phase[1]); temp += p->gains[0] * ADSR_tick(&p->adsr[0]) * Wave_tick(&p->w_time[0], (int32_t)p->waves[0]->flen, p->waves[0]->ftable, p->w_rate[0], p->w_phase[0]); lastOutput = temp * FL(0.125); return lastOutput; }
int brass(CSOUND *csound, BRASS *p) { MYFLT *ar = p->ar; uint32_t offset = p->h.insdshead->ksmps_offset; uint32_t early = p->h.insdshead->ksmps_no_end; uint32_t n, nsmps = CS_KSMPS; MYFLT amp = (*p->amp)*AMP_RSCALE; /* Normalise */ MYFLT maxPressure = p->maxPressure = amp; int v_len = (int)p->vibr->flen; MYFLT *v_data = p->vibr->ftable; MYFLT vibGain = *p->vibAmt; MYFLT vTime = p->v_time; p->v_rate = *p->vibFreq * v_len * csound->onedsr; /* vibr->setFreq(6.137); */ /* vibrGain = 0.05; */ /* breath periodic vibrato component */ if (p->kloop>0 && p->h.insdshead->relesing) p->kloop=1; if ((--p->kloop) == 0) { ADSR_setReleaseRate(csound, &p->adsr, amp * FL(0.005)); ADSR_keyOff(&p->adsr); } if (p->frq != *p->frequency) { /* Set frequency if changed */ p->frq = *p->frequency; if (p->limit > p->frq) { p->frq =p->limit; csound->Warning(csound, Str("frequency too low, set to minimum")); } p->slideTarget = (CS_ESR / p->frq * FL(2.0)) + FL(3.0); /* fudge correction for filter delays */ /* we'll play a harmonic */ if (DLineA_setDelay(csound, &p->delayLine, p->slideTarget)) return OK; p->lipTarget = p->frq; p->lipT = FL(0.0); /* So other part is set */ } /* End of set frequency */ if (*p->liptension != p->lipT) { p->lipT = *p->liptension; LipFilt_setFreq(csound, &p->lipFilter, p->lipTarget * (MYFLT)pow(4.0,(2.0* p->lipT) -1.0)); } if (UNLIKELY(offset)) memset(ar, '\0', offset*sizeof(MYFLT)); if (UNLIKELY(early)) { nsmps -= early; memset(&ar[nsmps], '\0', early*sizeof(MYFLT)); } for (n=offset;n<nsmps;n++) { MYFLT breathPressure; MYFLT lastOutput; int temp; MYFLT temp_time, alpha; MYFLT v_lastOutput; MYFLT ans; breathPressure = maxPressure * ADSR_tick(&p->adsr); /* Tick on vibrato table */ vTime += p->v_rate; /* Update current time */ while (vTime >= v_len) /* Check for end of sound */ vTime -= v_len; /* loop back to beginning */ while (vTime < FL(0.0)) /* Check for end of sound */ vTime += v_len; /* loop back to beginning */ temp_time = vTime; #ifdef phase_offset if (p->v_phaseOffset != FL(0.0)) { temp_time += p->v_phaseOffset; /* Add phase offset */ while (temp_time >= v_len) /* Check for end of sound */ temp_time -= v_len; /* loop back to beginning */ while (temp_time < FL(0.0)) /* Check for end of sound */ temp_time += v_len; /* loop back to beginning */ } #endif temp = (int) temp_time; /* Integer part of time address */ /* fractional part of time address */ alpha = temp_time - (MYFLT)temp; v_lastOutput = v_data[temp]; /* Do linear interpolation, same as */ v_lastOutput += /*alpha*data[temp+1]+(1-alpha)data[temp] */ (alpha * (v_data[temp+1] - v_lastOutput)); /* End of vibrato tick */ breathPressure += vibGain * v_lastOutput; lastOutput = DLineA_tick(&p->delayLine, /* bore delay */ DCBlock_tick(&p->dcBlock, /* block DC */ LipFilt_tick(&p->lipFilter, FL(0.3) * breathPressure, /* mouth input */ /* and bore reflection */ FL(0.85) * p->delayLine.lastOutput))); ans = lastOutput*AMP_SCALE*FL(3.5); ar[n] = ans; } p->v_time = vTime; return OK; }
int bowed(CSOUND *csound, BOWED *p) { MYFLT *ar = p->ar; uint32_t offset = p->h.insdshead->ksmps_offset; uint32_t early = p->h.insdshead->ksmps_no_end; uint32_t n, nsmps = CS_KSMPS; MYFLT amp = (*p->amp)*AMP_RSCALE; /* Normalise */ MYFLT maxVel; int freq_changed = 0; if (amp != p->lastamp) { p->maxVelocity = FL(0.03) + (FL(0.2) * amp); p->lastamp = amp; } maxVel = p->maxVelocity; if (p->lastpress != *p->bowPress) p->bowTabl.slope = p->lastpress = *p->bowPress; /* Set Frequency if changed */ if (p->lastfreq != *p->frequency) { /* delay - approx. filter delay */ if (p->limit<=*p->frequency) p->lastfreq = *p->frequency; else { p->lastfreq = p->limit; csound->Warning(csound, Str("frequency too low, set to minimum")); } p->baseDelay = CS_ESR / p->lastfreq - FL(4.0); freq_changed = 1; } if (p->lastbeta != *p->betaRatio || freq_changed) { /* Reset delays if changed */ p->lastbeta = *p->betaRatio; DLineL_setDelay(&p->bridgeDelay, /* bow to bridge length */ p->baseDelay * p->lastbeta); DLineL_setDelay(&p->neckDelay, /* bow to nut (finger) length */ p->baseDelay *(FL(1.0) - p->lastbeta)); } p->v_rate = *p->vibFreq * p->vibr->flen * csound->onedsr; if (p->kloop>0 && p->h.insdshead->relesing) p->kloop=1; if ((--p->kloop) == 0) { ADSR_setDecayRate(csound, &p->adsr, (FL(1.0) - p->adsr.value) * FL(0.005)); p->adsr.target = FL(0.0); p->adsr.rate = p->adsr.releaseRate; p->adsr.state = RELEASE; } if (UNLIKELY(offset)) memset(ar, '\0', offset*sizeof(MYFLT)); if (UNLIKELY(early)) { nsmps -= early; memset(&ar[nsmps], '\0', early*sizeof(MYFLT)); } for (n=offset;n<nsmps;n++) { MYFLT bowVelocity; MYFLT bridgeRefl=FL(0.0), nutRefl=FL(0.0); MYFLT newVel=FL(0.0), velDiff=FL(0.0), stringVel=FL(0.0); MYFLT lastOutput; bowVelocity = maxVel * ADSR_tick(&p->adsr); /* Bridge Reflection */ bridgeRefl = - OnePole_tick(&p->reflFilt, p->bridgeDelay.lastOutput); nutRefl = - p->neckDelay.lastOutput; /* Nut Reflection */ stringVel = bridgeRefl + nutRefl; /* Sum is String Velocity */ velDiff = bowVelocity - stringVel; /* Differential Velocity */ /* Non-Lin Bow Function */ newVel = velDiff * BowTabl_lookup(csound, &p->bowTabl, velDiff); DLineL_tick(&p->neckDelay, bridgeRefl + newVel); /* Do string */ DLineL_tick(&p->bridgeDelay, nutRefl + newVel); /* propagations */ if (*p->vibAmt > FL(0.0)) { int32 temp; MYFLT temp_time, alpha; /* Tick on vibrato table */ p->v_time += p->v_rate; /* Update current time */ while (p->v_time >= p->vibr->flen) /* Check for end of sound */ p->v_time -= p->vibr->flen; /* loop back to beginning */ while (p->v_time < FL(0.0)) /* Check for end of sound */ p->v_time += p->vibr->flen; /* loop back to beginning */ temp_time = p->v_time; #ifdef phase_offset if (p->v_phaseOffset != FL(0.0)) { temp_time += p->v_phaseOffset; /* Add phase offset */ while (temp_time >= p->vibr->flen) /* Check for end of sound */ temp_time -= p->vibr->flen; /* loop back to beginning */ while (temp_time < FL(0.0)) /* Check for end of sound */ temp_time += p->vibr->flen; /* loop back to beginning */ } #endif temp = (int32) temp_time; /* Integer part of time address */ /* fractional part of time address */ alpha = temp_time - (MYFLT)temp; p->v_lastOutput = p->vibr->ftable[temp]; /* Do linear interpolation */ /* same as alpha*data[temp+1] + (1-alpha)data[temp] */ p->v_lastOutput = p->v_lastOutput + (alpha * (p->vibr->ftable[temp+1] - p->v_lastOutput)); /* End of vibrato tick */ DLineL_setDelay(&p->neckDelay, (p->baseDelay * (FL(1.0) - p->lastbeta)) + (p->baseDelay * *p->vibAmt * p->v_lastOutput)); } else DLineL_setDelay(&p->neckDelay, (p->baseDelay * (FL(1.0) - p->lastbeta))); lastOutput = BiQuad_tick(&p->bodyFilt, p->bridgeDelay.lastOutput); ar[n] = lastOutput*AMP_SCALE * amp *FL(1.8); } return OK; }
int flute(CSOUND *csound, FLUTE *p) { MYFLT *ar = p->ar; uint32_t offset = p->h.insdshead->ksmps_offset; uint32_t early = p->h.insdshead->ksmps_no_end; uint32_t n, nsmps = CS_KSMPS; MYFLT amp = (*p->amp)*AMP_RSCALE; /* Normalise */ MYFLT temp; int v_len = (int)p->vibr->flen; MYFLT *v_data = p->vibr->ftable; MYFLT v_time = p->v_time; MYFLT vibGain = *p->vibAmt; MYFLT jetRefl, endRefl, noisegain; if (amp!=p->lastamp) { /* If amplitude has changed */ /* This should be controlled by attack */ ADSR_setAttackRate(csound, &p->adsr, amp * FL(0.02)); p->maxPress = (FL(1.1) + (amp * FL(0.20))) / FL(0.8); p->outputGain = amp + FL(0.001); p->lastamp = amp; } p->v_rate = *p->vibFreq * v_len * csound->onedsr; /* Start SetFreq */ if (p->lastFreq != *p->frequency) { /* It changed */ p->lastFreq = *p->frequency; if (p->limit>p->lastFreq) { p->lastFreq = p->limit; csound->Warning(csound, Str("frequency too low, set to minimum")); } p->lastJet = *p->jetRatio; /* freq = (2/3)*p->frequency as we're overblowing here */ /* but 1/(2/3) is 1.5 so multiply for speed */ /* Length - approx. filter delay */ temp = FL(1.5)* CS_ESR / p->lastFreq - FL(2.0); DLineL_setDelay(&p->boreDelay, temp); /* Length of bore tube */ DLineL_setDelay(&p->jetDelay, temp * p->lastJet); /* jet delay shorter */ } else if (*p->jetRatio != p->lastJet) { /* Freq same but jet changed */ p->lastJet = *p->jetRatio; /* Length - approx. filter delay */ temp = FL(1.5)* CS_ESR / p->lastFreq - FL(2.0); DLineL_setDelay(&p->jetDelay, temp * p->lastJet); /* jet delay shorter */ } /* End SetFreq */ if (p->kloop>FL(0.0) && p->h.insdshead->relesing) p->kloop=FL(1.0); if ((--p->kloop) == 0) { p->adsr.releaseRate = p->adsr.value / (*p->dettack * CS_ESR); p->adsr.target = FL(0.0); p->adsr.rate = p->adsr.releaseRate; p->adsr.state = RELEASE; } noisegain = *p->noiseGain; jetRefl = *p->jetRefl; endRefl = *p->endRefl; if (UNLIKELY(offset)) memset(ar, '\0', offset*sizeof(MYFLT)); if (UNLIKELY(early)) { nsmps -= early; memset(&ar[nsmps], '\0', early*sizeof(MYFLT)); } for (n=offset;n<nsmps;n++) { int32 temp; MYFLT temf; MYFLT temp_time, alpha; MYFLT pressDiff; MYFLT randPress; MYFLT breathPress; MYFLT lastOutput; MYFLT v_lastOutput; breathPress = p->maxPress * ADSR_tick(&p->adsr); /* Breath Pressure */ randPress = noisegain*Noise_tick(csound,&p->noise); /* Random Deviation */ /* Tick on vibrato table */ v_time += p->v_rate; /* Update current time */ while (v_time >= v_len) /* Check for end of sound */ v_time -= v_len; /* loop back to beginning */ while (v_time < FL(0.0)) /* Check for end of sound */ v_time += v_len; /* loop back to beginning */ temp_time = v_time; #ifdef phase_offset if (p->v_phaseOffset != FL(0.0)) { temp_time += p->v_phaseOffset;/* Add phase offset */ while (temp_time >= v_len) /* Check for end of sound */ temp_time -= v_len; /* loop back to beginning */ while (temp_time < FL(0.0)) /* Check for end of sound */ temp_time += v_len; /* loop back to beginning */ } #endif temp = (int32) temp_time; /* Integer part of time address */ /* fractional part of time address */ alpha = temp_time - (MYFLT)temp; v_lastOutput = v_data[temp]; /* Do linear interpolation */ /* same as alpha*data[temp+1] + (1-alpha)data[temp] */ v_lastOutput += (alpha * (v_data[temp+1] - v_lastOutput)); /* End of vibrato tick */ randPress += vibGain * v_lastOutput; /* + breath vibrato */ randPress *= breathPress; /* All scaled by Breath Pressure */ temf = OnePole_tick(&p->filter, DLineL_lastOut(&p->boreDelay)); temf = DCBlock_tick(&p->dcBlock, temf); /* Block DC on reflection */ pressDiff = breathPress + randPress /* Breath Pressure */ - (jetRefl * temf); /* - reflected */ pressDiff = DLineL_tick(&p->jetDelay, pressDiff); /* Jet Delay Line */ pressDiff = JetTabl_lookup(pressDiff) /* Non-Lin Jet + reflected */ + (endRefl * temf); /* Bore Delay and "bell" filter */ lastOutput = FL(0.3) * DLineL_tick(&p->boreDelay, pressDiff); lastOutput *= p->outputGain; ar[n] = lastOutput*AMP_SCALE*FL(1.4); } p->v_time = v_time; return OK; }
int bowedbar(CSOUND *csound, BOWEDBAR *p) { MYFLT *ar = p->ar; uint32_t offset = p->h.insdshead->ksmps_offset; uint32_t early = p->h.insdshead->ksmps_no_end; uint32_t n, nsmps = CS_KSMPS; MYFLT amp = (*p->amp)*AMP_RSCALE; /* Normalise */ int32 k; int i; MYFLT maxVelocity; MYFLT integration_const = *p->integration_const; if (p->lastpress != *p->bowPress) p->bowTabl.slope = p->lastpress = *p->bowPress; if (p->freq != *p->frequency) { p->freq = *p->frequency; if (p->freq > FL(1568.0)) p->freq = FL(1568.0); p->length = (int)(CS_ESR/p->freq); p->nr_modes = NR_MODES; /* reset for frequency shift */ for (i = 0; i<NR_MODES; i++) { if ((int)(p->length/p->modes[i]) > 4) DLineN_setDelay(csound, &p->delay[i], (int)(p->length/p->modes[i])); else { p->nr_modes = i; break; } } if (p->nr_modes==0) return csound->InitError(csound, Str("Bowedbar: cannot have zero modes\n")); for (i=0; i<p->nr_modes; i++) { MYFLT R = FL(1.0) - p->freq * p->modes[i] * csound->pidsr; BiQuad_clear(&p->bandpass[i]); BiQuad_setFreqAndReson(p->bandpass[i], p->freq * p->modes[i], R); BiQuad_setEqualGainZeroes(p->bandpass[i]); BiQuad_setGain(p->bandpass[i], (FL(1.0)-R*R)*FL(0.5)); } } /* Bow position as well */ if (*p->position != p->lastpos) { MYFLT temp2 = *p->position * PI_F; p->gains[0] = FABS(SIN(temp2 * FL(0.5))) /* * pow(0.9,0))*/; p->gains[1] = FABS(SIN(temp2) * FL(0.9)); p->gains[2] = FABS(SIN(temp2 * FL(1.5)) * FL(0.9)*FL(0.9)); p->gains[3] = FABS(SIN(temp2 * FL(2.0)) * FL(0.9)*FL(0.9)*FL(0.9)); p->lastpos = *p->position; } if (*p->bowposition != p->lastBowPos) { /* Not sure what this control is? */ p->bowTarg += FL(0.02) * (*p->bowposition - p->lastBowPos); p->lastBowPos = *p->bowposition; ADSR_setTarget(csound, &p->adsr, p->lastBowPos); p->lastBowPos = *p->bowposition; } if (p->kloop>0 && p->h.insdshead->relesing) p->kloop=1; if ((--p->kloop) == 0) { ADSR_setReleaseRate(csound, &p->adsr, (FL(1.0) - amp) * FL(0.005)); p->adsr.target = FL(0.0); p->adsr.rate = p->adsr.releaseRate; p->adsr.state = RELEASE; } maxVelocity = FL(0.03) + (FL(0.5) * amp); if (UNLIKELY(offset)) memset(ar, '\0', offset*sizeof(MYFLT)); if (UNLIKELY(early)) { nsmps -= early; memset(&ar[nsmps], '\0', early*sizeof(MYFLT)); } for (n=offset; n<nsmps; n++) { MYFLT data = FL(0.0); MYFLT input = FL(0.0); if (integration_const == FL(0.0)) p->velinput = FL(0.0); else p->velinput = integration_const * p->velinput; for (k=0; k<p->nr_modes; k++) { p->velinput += *p->GAIN * p->delay[k].lastOutput; } if (*p->trackVel) { p->bowvel *= FL(0.9995); p->bowvel += p->bowTarg; p->bowTarg *= FL(0.995); } else p->bowvel = ADSR_tick(&p->adsr)*maxVelocity; input = p->bowvel - p->velinput; input = input * BowTabl_lookup(csound, &p->bowTabl, input); input = input/(MYFLT)p->nr_modes; for (k=0; k<p->nr_modes; k++) { BiQuad_tick(&p->bandpass[k], input*p->gains[k] + *p->GAIN * p->delay[k].lastOutput); DLineN_tick(&p->delay[k], p->bandpass[k].lastOutput); data += p->bandpass[k].lastOutput; } ar[n] = data * AMP_SCALE * FL(20.0); /* 20 is an experimental value */ } return OK; }