view dsp/synth/@square/block_sr.m @ 34:c75bb62b90a9

Imported audio synthesis tools.
author samer
date Sun, 20 Jan 2013 19:05:05 +0000
parents
children
line wrap: on
line source
function [y,phi]=block(o,phi,duty,f)
% block - generate square wave

u=cumsum([phi,1./ceil(1./f)]);
y=mod(u(1:end-1),1)<duty;
phi=mod(u(end),1);