[sdiy] "lunetta"/CMOS sound-making equivalents in C Programming???

dan snazelle subjectivity at hotmail.com
Fri Mar 23 22:45:39 CET 2012



On Mar 23, 2012, at 4:52 PM, Gordon JC Pearc e wrote:

> On 22/03/12 17:21, Olivier Gillet wrote:
>> Keep in mind that by doing this CMOS emulation stuff in code on a
>> micro, you'll have to decide on the time base (sample rate) at which
>> you refresh your variables ; and you'll get nasty aliasing problems
>> unless you work at a very high sample rate.
>> 
> 
> (sent to Olivier instead of the list, originally)
> 
> Some of us *like* aliasing!
> 
> You can emulate "circuit bent" sample playback, by ANDing bit patterns with the address before you read out the sample.  This simulates pulling address pins to ground.
> 
> The result sounds pretty much like this:
> http://www.gjcp.net/~gordonjcp/mp3s/glitchamen.ogg
> 
> Arduino code, pull the whole repo to get the "ROM":
> https://github.com/gordonjcp/gyoza/blob/master/looper/looper.pde
> 
> 
> -- 
> Gordonjcp MM0YEQ



is this the section responsible?

is MIX the variable which allows some realtime control over the effect?

ISR(TIMER2_OVF_vect) {
	// internal timer
	if(icnt1++ > 31) { // slightly faster than 1ms
		do_update=1;
		icnt1=0;
	}   

  out = 0;
	// calculate the sample output
	// bitmask contains the "bend"
	// mix sets the proportion of "bent" to clean output
	out += (mix*pgm_read_byte_near(wave+sample+(((s_ptr>>8) & bitmask))))>>7;
	out += ((127-mix)*pgm_read_byte_near(wave+sample+(s_ptr>>8)))>>7;

//out = pgm_read_byte_near(wave+sample+(s_ptr>>8));

/*
	// DC restore and clip output
	out += 127;
	out >>=1;
*/
	if (out<0) { out=0; digitalWrite(13, LOW); }
	if (out>0xff) { out=0xff; digitalWrite(13, LOW); }

	OCR2A = out;

	s_ptr += s_tword;
	if (s_ptr>786175) s_tword=0; 
}





More information about the Synth-diy mailing list