annotate dsp/synth/@bpblit/block_sr.m @ 61:eff6bddf82e3
tip
Finally implemented perceptual brightness thing.
author |
samer |
date |
Sun, 11 Oct 2015 10:20:42 +0100 |
parents |
c75bb62b90a9 |
children |
|
rev |
line source |
samer@34
|
1 function [y,phi]=block_sr(o,phi,cutoff,f)
|
samer@34
|
2 % block_sr - Generate block of blit signal data
|
samer@34
|
3 %
|
samer@34
|
4 % block_sr ::
|
samer@34
|
5 % blit ~'blit object'
|
samer@34
|
6 % 0--1 ~'initial phase (in cycles)'
|
samer@34
|
7 % N:natural ~'number of samples to compute',
|
samer@34
|
8 % 0--1 ~'normalised frequency (1=sampling freq)',
|
samer@34
|
9 % 0--0.5 ~'cutoff harmonics above this frequency [0.5]',
|
samer@34
|
10 % -> [[1,N]] ~'band-limited impulse train',
|
samer@34
|
11 % 0--1 ~'initial phase for next block'.
|
samer@34
|
12
|
samer@34
|
13 m = max(2,2*floor(max(cutoff./f))); % number of harmonics to keep
|
samer@34
|
14 u = cumsum([phi,f],2);
|
samer@34
|
15 y = m*f.*diric(2*pi*u(1:end-1),m);
|
samer@34
|
16 phi = mod(u(end),2);
|
samer@34
|
17
|
samer@34
|
18
|