mathieu@34: function cmap = randomColormap (sceneObjects) mathieu@34: % returns a colormap with randomly chosen colors somewhat evenly spread in mathieu@34: % the color spectrum, to be used for the graphical representations of a mathieu@34: % synthesized scene. mathieu@34: mathieu@34: % Background sounds will have a saturation of .3, foreground sounds of 1 mathieu@34: % Value is always let to .5, since modifying it would erroneously suggest mathieu@34: % a difference of intensity mathieu@34: mathieu@34: % This program was written by Mathias Rossignol & Grégoire Lafay mathieu@34: % is Copyright (C) 2015 IRCAM mathieu@34: % mathieu@34: % This program is free software: you can redistribute it and/or modify it mathieu@34: % under the terms of the GNU General Public License as published by the Free mathieu@34: % Software Foundation, either version 3 of the License, or (at your option) mathieu@34: % any later version. mathieu@34: % mathieu@34: % This program is distributed in the hope that it will be useful, but mathieu@34: % WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY mathieu@34: % or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License mathieu@34: % for more details. mathieu@34: % mathieu@34: % You should have received a copy of the GNU General Public License along mathieu@34: % with this program. If not, see . mathieu@34: mathieu@34: nbTracks = length(sceneObjects); mathieu@34: mathieu@34: % Colors for figures mathieu@34: % Choosing color hues evenly spread in the color spectrum, then randomizing their order mathieu@34: hues = (0:1/nbTracks:1); mathieu@34: hues = hues(1:nbTracks); mathieu@34: hues = hues(randperm(nbTracks)); mathieu@34: % Generate a colormap: mathieu@34: for c=1:nbTracks mathieu@34: if (sceneObjects(c).isBackground) mathieu@34: cmap(c,:) = hsl2rgb([hues(c), .3, .5]); mathieu@34: else mathieu@34: cmap(c,:) = hsl2rgb([hues(c), 1, .5]); mathieu@34: end mathieu@34: end mathieu@34: end