annotate toolboxes/MIRtoolbox1.3.2/AuditoryToolbox/FMPoints.m @ 0:cc4b1211e677 tip

initial commit to HG from Changeset: 646 (e263d8a21543) added further path and more save "camirversion.m"
author Daniel Wolff
date Fri, 19 Aug 2016 13:07:06 +0200
parents
children
rev   line source
Daniel@0 1 function points=FMPoints(len, freq, fmFreq, fmAmp, fs)
Daniel@0 2 % points=FMPoints(len, freq, fmFreq, fmAmp, fs)
Daniel@0 3 % Generates (fractional) sample locations for frequency-modulated impulses
Daniel@0 4 % len = number of samples
Daniel@0 5 % freq = pitch frequency (Hz)
Daniel@0 6 % fmFreq = vibrato frequency (Hz) (defaults to 6 Hz)
Daniel@0 7 % fmAmp = max change in pitch (defaults to 5% of freq)
Daniel@0 8 % fs = sample frequency (defaults to 22254.545454 samples/s)
Daniel@0 9 %
Daniel@0 10 % Basic formula: phase angle = 2*pi*freq*t + (fmAmp/fmFreq)*sin(2*pi*fmFreq*t)
Daniel@0 11 % k-th zero crossing approximately at sample number
Daniel@0 12 % (fs/freq)*(k - (fmAmp/(2*pi*fmFreq))*sin(2*pi*k*(fmFreq/freq)))
Daniel@0 13
Daniel@0 14 % (c) 1998 Interval Research Corporation
Daniel@0 15
Daniel@0 16 if nargin<2,
Daniel@0 17 fprintf('Format: sig=fmPoints(len, freq [, fmAmp, fmFreq, sampleRate])\n');
Daniel@0 18 return;
Daniel@0 19 end;
Daniel@0 20 if nargin<5,
Daniel@0 21 fs=22254.545454;
Daniel@0 22 end;
Daniel@0 23 if nargin<4,
Daniel@0 24 fmAmp=0.05*freq;
Daniel@0 25 end;
Daniel@0 26 if nargin<3,
Daniel@0 27 fmFreq=6;
Daniel@0 28 end;
Daniel@0 29
Daniel@0 30 kmax=fix(freq*(len/fs));
Daniel@0 31 points=0:kmax-1;
Daniel@0 32 points=1+(fs/freq)*(points-(fmAmp/(2*pi*fmFreq))* ...
Daniel@0 33 sin(2*pi*(fmFreq/freq)*points));