Mercurial > hg > ishara
view dsp/synth/shepardtone.m @ 58:ba866ae124c6
Now accepts single color index for all points.
author | samer |
---|---|
date | Fri, 09 Oct 2015 13:01:37 +0100 |
parents | 9e7be347b3a0 |
children |
line wrap: on
line source
function y=shepardtone(N,C,prof,H) % shepardtone - Shepard tone by additive synthesis % % shepardtone :: % N:natural ~'size of buffers to produce', % seq(real) ~'sequence of chroma values, 0--1 is one octave', % -> seq([[1,N]]) ~'sum of components'. % % Note: the number of components must remain constant if nargin<3, prof=@(z)betapdf(2*z,2,9); elseif isvector(prof), a=prof(1); b=prof(2); prof=@(z)betapdf(2*z,a,b); end fc=0.25; if nargin<4, H=(-10:1)'; else H=H(:); end F=map(@(c)fc*2.^(H+mod(c,1)),C); % frequencies A=map(prof,F); % component amplitudes y=addsynth(N,A,F,0);