annotate nonExposed/randomColormap.m @ 51:ebf92ed7d680 tip master

Added -fd (--full-duration) argument.
author Emmanouil Theofanis Chourdakis <e.t.chourdakis@qmul.ac.uk>
date Sun, 30 Sep 2018 13:21:49 +0100
parents 39399de892ef
children
rev   line source
mathieu@34 1 function cmap = randomColormap (sceneObjects)
mathieu@34 2 % returns a colormap with randomly chosen colors somewhat evenly spread in
mathieu@34 3 % the color spectrum, to be used for the graphical representations of a
mathieu@34 4 % synthesized scene.
mathieu@34 5
mathieu@34 6 % Background sounds will have a saturation of .3, foreground sounds of 1
mathieu@34 7 % Value is always let to .5, since modifying it would erroneously suggest
mathieu@34 8 % a difference of intensity
mathieu@34 9
mathieu@34 10 % This program was written by Mathias Rossignol & Grégoire Lafay
mathieu@34 11 % is Copyright (C) 2015 IRCAM <http://www.ircam.fr>
mathieu@34 12 %
mathieu@34 13 % This program is free software: you can redistribute it and/or modify it
mathieu@34 14 % under the terms of the GNU General Public License as published by the Free
mathieu@34 15 % Software Foundation, either version 3 of the License, or (at your option)
mathieu@34 16 % any later version.
mathieu@34 17 %
mathieu@34 18 % This program is distributed in the hope that it will be useful, but
mathieu@34 19 % WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
mathieu@34 20 % or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
mathieu@34 21 % for more details.
mathieu@34 22 %
mathieu@34 23 % You should have received a copy of the GNU General Public License along
mathieu@34 24 % with this program. If not, see <http://www.gnu.org/licenses/>.
mathieu@34 25
mathieu@34 26 nbTracks = length(sceneObjects);
mathieu@34 27
mathieu@34 28 % Colors for figures
mathieu@34 29 % Choosing color hues evenly spread in the color spectrum, then randomizing their order
mathieu@34 30 hues = (0:1/nbTracks:1);
mathieu@34 31 hues = hues(1:nbTracks);
mathieu@34 32 hues = hues(randperm(nbTracks));
mathieu@34 33 % Generate a colormap:
mathieu@34 34 for c=1:nbTracks
mathieu@34 35 if (sceneObjects(c).isBackground)
mathieu@34 36 cmap(c,:) = hsl2rgb([hues(c), .3, .5]);
mathieu@34 37 else
mathieu@34 38 cmap(c,:) = hsl2rgb([hues(c), 1, .5]);
mathieu@34 39 end
mathieu@34 40 end
mathieu@34 41 end