Mercurial > hg > camir-aes2014
comparison toolboxes/MIRtoolbox1.3.2/AuditoryToolbox/FMPoints.m @ 0:e9a9cd732c1e tip
first hg version after svn
author | wolffd |
---|---|
date | Tue, 10 Feb 2015 15:05:51 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:e9a9cd732c1e |
---|---|
1 function points=FMPoints(len, freq, fmFreq, fmAmp, fs) | |
2 % points=FMPoints(len, freq, fmFreq, fmAmp, fs) | |
3 % Generates (fractional) sample locations for frequency-modulated impulses | |
4 % len = number of samples | |
5 % freq = pitch frequency (Hz) | |
6 % fmFreq = vibrato frequency (Hz) (defaults to 6 Hz) | |
7 % fmAmp = max change in pitch (defaults to 5% of freq) | |
8 % fs = sample frequency (defaults to 22254.545454 samples/s) | |
9 % | |
10 % Basic formula: phase angle = 2*pi*freq*t + (fmAmp/fmFreq)*sin(2*pi*fmFreq*t) | |
11 % k-th zero crossing approximately at sample number | |
12 % (fs/freq)*(k - (fmAmp/(2*pi*fmFreq))*sin(2*pi*k*(fmFreq/freq))) | |
13 | |
14 % (c) 1998 Interval Research Corporation | |
15 | |
16 if nargin<2, | |
17 fprintf('Format: sig=fmPoints(len, freq [, fmAmp, fmFreq, sampleRate])\n'); | |
18 return; | |
19 end; | |
20 if nargin<5, | |
21 fs=22254.545454; | |
22 end; | |
23 if nargin<4, | |
24 fmAmp=0.05*freq; | |
25 end; | |
26 if nargin<3, | |
27 fmFreq=6; | |
28 end; | |
29 | |
30 kmax=fix(freq*(len/fs)); | |
31 points=0:kmax-1; | |
32 points=1+(fs/freq)*(points-(fmAmp/(2*pi*fmFreq))* ... | |
33 sin(2*pi*(fmFreq/freq)*points)); |