Mercurial > hg > pyin
annotate misc/pitchgenerator.m @ 113:a39abd44f48a
Close this sprout -- these commits are on the notes_refinement branch now
author | Chris Cannam |
---|---|
date | Mon, 26 Jan 2015 17:48:10 +0000 |
parents | 37e59aa69322 |
children |
rev | line source |
---|---|
matthiasm@92 | 1 f = 50:800; |
matthiasm@92 | 2 fs = 44100; |
matthiasm@92 | 3 t = (0:(2*fs))/fs; |
matthiasm@92 | 4 nFreq = length(f); |
matthiasm@92 | 5 |
matthiasm@92 | 6 for iFreq = 1:nFreq |
matthiasm@92 | 7 f(iFreq) |
matthiasm@92 | 8 x = zeros(size(t)); |
matthiasm@92 | 9 for iAdd = 1:100 |
matthiasm@92 | 10 x = x + cos(2*pi*f(iFreq)*t*iAdd)*0.6^(iAdd-1); |
matthiasm@92 | 11 if f(iFreq)*iAdd > fs/2 |
matthiasm@92 | 12 break |
matthiasm@92 | 13 end |
matthiasm@92 | 14 end |
matthiasm@92 | 15 x = x / max(abs(x)); |
matthiasm@92 | 16 wavwrite(x, fs, sprintf('/Users/matthiasm/data/pyin/simplewavs/%iHz.wav', f(iFreq))); |
matthiasm@92 | 17 end |