view dsp/synth/@bpblit/block.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,T,cutoff,f)
% block - Generate block of bipolar blit signal data
%
% block :: 
%    bpblit     ~'bpblit object'
%    0--1       ~'initial phase (in cycles)'
%    N:natural  ~'number of samples to compute',
%    0--1       ~'normalised frequency (1=sampling freq)',
%    0--0.5     ~'cutoff harmonics above this frequency [0.5]',
% -> [[1,N]]    ~'band-limited impulse train',
%    0--1       ~'initial phase for next block'.

m = max(2,2*floor(cutoff/max(f,eps))); % number of harmonics to keep
y = m*f*diric(2*pi*(phi+f*(0:T-1)),m);
phi = mod(phi+f*T,2);