View this PageEdit this PageUploads to this PageHistory of this PageTop of the SwikiRecent ChangesSearch the SwikiHelp Guide

composing saw, pulse and triangle waves by adding sine waves

Home   How To   Code Pool   Public Library   Theory   Events


// saw
(
{
	sum(
	{|i|
		var j = i + 1;
		SinOsc.ar(300 * j, 0, 1/j)
	
	} ! 20)

}.plot
)

// inverse saw
(
{
	sum(
	{|i|
		var j = i + 1 * 2;
		SinOsc.ar(300 * j, pi, 1/j)
	
	} ! 20)

}.plot
)


// pulse
(
{
	sum(
	{|i|
		var j = i * 2 + 1;
		
		SinOsc.ar(300 * j, 0, 1/j)
	
	} ! 20)

}.plot
)

// triangle
(
{
	sum(
	{|i|
		var j = i * 2 + 1;
		SinOsc.ar(300 * j, pi/2, 1 / j.squared) // cosine wave (phase shift)
	
	} ! 20)

}.plot
)





Link to this Page