[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[sc-dev] Impulse_next_aa

 Im trying to write a Impulse calcfunc when both the
freq and phase inputs are audio rates

 First an observation that may apply to different rate
versions of this; most of these Impulse only check
when the phase >=1.f, but doesnt check when phase
<0.f. That should also produce a spike and increase
phase by one.

Anyhow, this still is far from sounding as i expect,
but i dont see the flaw in this code:

void Impulse_next_aa(Impulse *unit, int inNumSamples)
	float *out = ZOUT(0);
	float *freq = ZIN(0);
	float *phaseOffset =  ZIN(1);
	float freqmul = unit->mFreqMul;
	double phase = unit->mPhase;
	double rate_acum = 0.f;	
		float z;
		if (phase >= 1.f) {
			rate_acum -= 1.f;
			z = 1.f;
		} else if (phase < 0.f) {
		  rate_acum += 1.f;
		  z = 1.f;
                else {
			z = 0.f;
		rate_acum += (ZXP(freq) * freqmul);
                phase = rate_acum + ZXP(phaseOffset);
		ZXP(out) = z;

	unit->mPhase = phase;

 This sounds like a lot more of spikes than it should


 Note that im adding up the rate_acumulator in a
separate variable, and phase is always that number
plust the phase offset input. this phase is checked,
but the value is adjusted on rate_acum only.

 Any suggestions? im missing something obvious?


Running on:
1.5 Ghz P4
asus v800x chipset
RH9 CCRMA-patched linux


¡Llevate a Yahoo! en tu Unifón! 
Ahora podés usar Yahoo! Messenger en tu Unifón, en cualquier momento y lugar. 
Encontrá más información en: http://ar.mobile.yahoo.com/sms.html