Mercurial > hg > pyin
annotate misc/pitchgenerator.m @ 164:a7d9c6142f8f tip
Added tag v1.2 for changeset 4a97f7638ffd
author | Chris Cannam |
---|---|
date | Thu, 06 Feb 2020 15:02:47 +0000 |
parents | ac840042f5f2 |
children |
rev | line source |
---|---|
matthiasm@104 | 1 f = 50:800; |
matthiasm@104 | 2 fs = 44100; |
matthiasm@104 | 3 t = (0:(2*fs))/fs; |
matthiasm@104 | 4 nFreq = length(f); |
matthiasm@104 | 5 |
matthiasm@104 | 6 for iFreq = 1:nFreq |
matthiasm@104 | 7 f(iFreq) |
matthiasm@104 | 8 x = zeros(size(t)); |
matthiasm@104 | 9 for iAdd = 1:100 |
matthiasm@104 | 10 x = x + cos(2*pi*f(iFreq)*t*iAdd)*0.6^(iAdd-1); |
matthiasm@104 | 11 if f(iFreq)*iAdd > fs/2 |
matthiasm@104 | 12 break |
matthiasm@104 | 13 end |
matthiasm@104 | 14 end |
matthiasm@104 | 15 x = x / max(abs(x)); |
matthiasm@104 | 16 wavwrite(x, fs, sprintf('/Users/matthiasm/data/pyin/simplewavs/%iHz.wav', f(iFreq))); |
matthiasm@104 | 17 end |