gregoire@16
|
1 function status = timeDomainVisualization(tracks,figNum,settingFigure,figuresOption,fileName)
|
mathieu@14
|
2
|
mathieu@14
|
3 % This program was written by Mathias Rossignol & Grégoire Lafay
|
mathieu@14
|
4 % is Copyright (C) 2015 IRCAM <http://www.ircam.fr>
|
mathieu@14
|
5 %
|
mathieu@14
|
6 % This program is free software: you can redistribute it and/or modify it
|
mathieu@14
|
7 % under the terms of the GNU General Public License as published by the Free
|
mathieu@14
|
8 % Software Foundation, either version 3 of the License, or (at your option)
|
mathieu@14
|
9 % any later version.
|
mathieu@14
|
10 %
|
mathieu@14
|
11 % This program is distributed in the hope that it will be useful, but
|
mathieu@14
|
12 % WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
mathieu@14
|
13 % or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
mathieu@14
|
14 % for more details.
|
mathieu@14
|
15 %
|
mathieu@14
|
16 % You should have received a copy of the GNU General Public License along
|
mathieu@14
|
17 % with this program. If not, see <http://www.gnu.org/licenses/>.
|
mathieu@14
|
18
|
mathieu@14
|
19 % Producing a time domain visualization
|
gregoire@16
|
20 step=0.5; % seconds
|
gregoire@16
|
21 wStep = round(step*settingFigure.sr);
|
gregoire@16
|
22 wSize = wStep*2;
|
gregoire@16
|
23 for t=1:size(tracks,1);
|
gregoire@16
|
24 for i=0:floor((size(tracks,2)-wSize)/wStep)
|
mathieu@14
|
25 % Not really power, but more nicely additive, better suited for
|
mathieu@14
|
26 % this representation I think
|
gregoire@16
|
27 powers(i+1,t) = norm(tracks(t,i*wStep+1:min(size(tracks,2), i*wStep+wSize)));
|
mathieu@14
|
28 end
|
mathieu@14
|
29 end
|
mathieu@14
|
30
|
mathieu@14
|
31 powers(powers<max(powers(:))/500) = 0;
|
mathieu@14
|
32
|
gregoire@16
|
33 switch figuresOption
|
gregoire@16
|
34 case 1
|
gregoire@16
|
35 f=figure('Visible', 'off');
|
gregoire@16
|
36 case 2
|
gregoire@16
|
37 f=figure(figNum);
|
gregoire@16
|
38 end
|
mathieu@14
|
39
|
mathieu@14
|
40
|
mathieu@14
|
41 clf;
|
gregoire@16
|
42 area(powers,'LineWidth', 1/1.6, 'EdgeColor', [.3, .3, .3]);
|
gregoire@16
|
43 xlim([0 size(powers,1)])
|
gregoire@16
|
44 xtick=0:round(20/step):size(powers,1); % every 20 sec
|
gregoire@16
|
45 set(gca,'YTick', [],'YTicklabel', [],'xtick',xtick,'xticklabel',xtick*step);
|
gregoire@16
|
46 xlabel('time (sec)')
|
mathieu@14
|
47
|
gregoire@16
|
48 set(f,'PaperUnits','centimeters')
|
gregoire@16
|
49 set(f,'PaperPositionMode','manual')
|
gregoire@16
|
50 set(f,'papersize',[settingFigure.width,settingFigure.height])
|
gregoire@16
|
51 set(f,'paperposition',[0,0,settingFigure.width,settingFigure.height])
|
gregoire@16
|
52 set(findall(f,'-property','FontSize'),'FontSize',settingFigure.FontSize)
|
gregoire@16
|
53 set(findall(f,'-property','FontName'),'FontName','Arial')
|
mathieu@14
|
54
|
gregoire@16
|
55 print(f,fileName,'-dpng')
|
mathieu@14
|
56
|
mathieu@14
|
57 end
|