Mercurial > hg > ishara
view dsp/synth/@blit/block.m @ 61:eff6bddf82e3 tip
Finally implemented perceptual brightness thing.
author | samer |
---|---|
date | Sun, 11 Oct 2015 10:20:42 +0100 |
parents | c75bb62b90a9 |
children |
line wrap: on
line source
function [y,phi]=block(o,phi,T,cutoff,f) % block - Generate block of blit signal data % % block :: % blit ~'blit 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(1,2*floor(cutoff/f)-1); % number of harmonics to keep y = m*f*diric(2*pi*(phi+f*(0:T-1)),m)-f; phi = mod(phi+f*T,1); % If diric is not available then use this % y=zeros(1,T); % phase = pi*(phi+f*(0:T-1)); % modcheck=mod(phase,pi); % I=modcheck>0.001 & modcheck<(pi-0.001); % y(~I) = f*m; % y(I) = f*sin(m*phase(I))./sin(phase(I));