Sunday, November 13, 2016

33. Gen10 to create square wave

A Gen10 UGen uses Fourier composition of sines of harmonically related frequencies.


The fundamental frequency is based on the phasor frequency (it is 100 Hz in this example).


We try to compose a square wave which has odd frequencies only, which vary as the reciprocal of the frequency.


We have 2 periods of Gen10 as the phasor varies from 0 to 1, for 2 periods.


# chuck33.py - Gen10 to create square wave

Phasor phasor
Gen10 g10

dac = g10
g10 = phasor

g10.coefs = [1., 0, 1./3., 0., 1./5., 0., 1./7.]

phasor.freq = 100

time(20::ms)

This is the wave, after running python createWav.py chuck33, on command line:


No comments:

Post a Comment