annotate dsp/synth/sonify_formant.m @ 61:eff6bddf82e3
tip
Finally implemented perceptual brightness thing.
author |
samer |
date |
Sun, 11 Oct 2015 10:20:42 +0100 |
parents |
beb8a3f4a345 |
children |
|
rev |
line source |
samer@34
|
1 % sonify_formant - sonify using formant synthesis
|
samer@34
|
2 function Y=sonify_formant(Controllers,S,varargin)
|
samer@34
|
3
|
samer@37
|
4 opts=options('bpm',240,'fs',11025,'buffer',0.125,'q',0.05,'cfilter',[],varargin{:});
|
samer@34
|
5
|
samer@34
|
6 CC = cellmap(@(f)f/opts.fs,Controllers);
|
samer@34
|
7 f0 = window(map(@getf0,S));
|
samer@34
|
8 fx = window(map(@getfx,S));
|
samer@34
|
9
|
samer@34
|
10 if ~isempty(opts.cfilter)
|
samer@34
|
11 f0 = filter(opts.cfilter{1},opts.cfilter{2},f0);
|
samer@34
|
12 fx = filter(opts.cfilter{1},opts.cfilter{2},fx,[],2);
|
samer@34
|
13 end
|
samer@34
|
14 Y = formant_synth(256,opts.q,0.2,f0,fx);
|
samer@34
|
15
|
samer@34
|
16 % rebuffer to constant size
|
samer@34
|
17 if ~isempty(opts.buffer)
|
samer@34
|
18 Y=windowdata(Y,ceil(opts.buffer*opts.fs));
|
samer@34
|
19 end
|
samer@34
|
20
|
samer@34
|
21 function z=getf0(s),z=CC{s}(:,1)'; end
|
samer@34
|
22 function z=getfx(s),z=CC{s}(:,2:end)'; end
|
samer@34
|
23 end
|