[sdiy] FM spectrum question
ASSI
Stromeko at compuserve.de
Fri May 5 22:31:52 CEST 2006
On Freitag, 5. Mai 2006 17:29, jbv wrote:
> Don't know if it's the right place to ask but this is a question
> I wanted to ask for a long time : is there a way (simple or not
> - but I guess there's plenty of maths involved... may be is there
> a piece of software than can compute that), a way to know which
> parameters to use in FM synthesis (freqs, waveshapes...) in order
> to obtain a specific spectrum, in which the freq & amp of each
> partial is known in advance...
You really want to model a defined spectrum with a minimum number of FM
operators? This is almost certainly an NP-hard problem in the general
case, but if you skip the "minimum" requirement it should be amenable
to heuristic search methods or genetic optimization. The forward
problem of computing the spectrum from a known FM operator is solved by
the following Octave function following the method from the book "FM
Theory & Applications" by Chowning and Bristow (remove the comments to
modify the plotting commands to suit your needs).
function [freqs,scale] = simplefm( fc, fm, mi, n )
# usage: fm( fc, fm, mi, n)
cm=fc/fm;
if (nargin < 4)
n=mi+4;
endif
freqs=[(1-n*cm):cm:(1+n*cm)];
scale=[fliplr(besselj((1:n),mi).*(-1).^(1:n)),besselj((0:n),mi)];
[s,idx]=sort(abs(freqs(1,:)));
fs=[
fc*abs(freqs(:,idx));
(-2*(freqs(:,idx)<0).+1).*scale(:,idx);
];
[nr,nc]=size(fs);
i=2;
j=1;
while (i<=nc)
if (fs(1,i)==fs(1,i-1))
fs(2,i)+=fs(2,i-1);
fs(:,j)=fs(:,i++);
else
fs(:,++j)=fs(:,i++);
endif
endwhile
fs=fs(:,1:j)';
# plot( fc*freqs, scale, "^" );
# hold on
# gplot "0"
# hold on
# gplot fs with impulses;
# hold on
fs=abs(fs);
gplot fs with impulses;
hold off
endfunction
Achim.
--
+<[Q+ Matrix-12 WAVE#46 Neuron microQkb Andromeda XTk sonic heaven]>+
Factory and User Sound Singles for Waldorf Q, microQ and rackAttack:
http://Stromeko.Synth.net/Downloads.html#WaldorfSounds
More information about the Synth-diy
mailing list