added more color schemes to choose from, also new grey scale

nix
Ted Moore 4 years ago
parent 7c395f7929
commit 8c02efd601

@ -25,6 +25,14 @@ FluidWaveform : FluidViewer {
win.close;
}
loadColorFile {
arg filename;
^CSVFileReader.readInterpret(FluidFilesPath("../Resources/color-schemes/%.csv".format(filename))).collect{
arg row;
Color.fromArray(row);
}
}
init {
arg audio_buf, slices_buf, feature_buf, parent_, bounds, lineWidth, waveformColor,stackFeatures = false, showSpectrogram = false, spectrogramColorScheme = 0, spectrogramAlpha = 1, showWaveform = true,normalizeFeaturesIndependently = true;
Task{
@ -59,19 +67,24 @@ FluidWaveform : FluidViewer {
var condition = Condition.new;
var colors;
// TODO: no need for this to be a switch statement.
spectrogramColorScheme.switch(
0,{
colors = 256.collect{
arg i;
Color.gray(i / 255.0);
};
colors = this.loadColorFile("CET-L02");
},
1,{
colors = CSVFileReader.readInterpret(FluidFilesPath("../Resources/color-schemes/CET-L16.csv")).collect{
arg row;
Color.fromArray(row);
};
},{
colors = this.loadColorFile("CET-L16");
},
2,{
colors = this.loadColorFile("CET-L08");
},
3,{
colors = this.loadColorFile("CET-L03");
},
4,{
colors = this.loadColorFile("CET-L04");
},
{
"% spectrogramColorScheme: % is not valid.".format(thisMethod,spectrogramColorScheme).warn;
}
);

@ -39,10 +39,13 @@ ARGUMENT:: showSpectrogram
Boolean whether or not to plot a spectrogram. The default is STRONG::false::.
ARGUMENT:: spectrogramColorScheme
An integer indicating which color scheme footnote::The non-gray-scale color schemes used are from https://colorcet.com/ Kovesi, Peter. "Good colour maps: How to design them." arXiv preprint arXiv:1509.03700 (2015). https://arxiv.org/abs/1509.03700 :: to use to distinguish magitudes in the spectrogram. The default is 0.
An integer indicating which color scheme footnote::The color schemes used are from https://colorcet.com/ Kovesi, Peter. "Good colour maps: How to design them." arXiv preprint arXiv:1509.03700 (2015). https://arxiv.org/abs/1509.03700 :: to use to distinguish magitudes in the spectrogram. The default is 0.
table::
## 0 || Gray-scale
## 0 || Grey scale with slightly reduced contrast to avoid display saturation problems
## 1 || Black - Blue - Green - Yellow - White
## 2 || Blue - Magenta - Yellow highly saturated
## 3 || Black - Red - Yellow - White
## 4 || Black - Red - Yellow
::
ARGUMENT:: spectrogramAlpha
@ -94,6 +97,18 @@ w.front;
// show spectrogram
FluidWaveform(~drums,bounds:Rect(0,0,1200,300),showSpectrogram:true);
// more colors
FluidWaveform(~drums,bounds:Rect(0,0,1200,300),showSpectrogram:true,spectrogramColorScheme:1);
// more colors
FluidWaveform(~drums,bounds:Rect(0,0,1200,300),showSpectrogram:true,spectrogramColorScheme:2);
// more colors
FluidWaveform(~drums,bounds:Rect(0,0,1200,300),showSpectrogram:true,spectrogramColorScheme:3);
// more colors
FluidWaveform(~drums,bounds:Rect(0,0,1200,300),showSpectrogram:true,spectrogramColorScheme:4);
// put in that another window
(
w = Window("FluidWaveform Test",Rect(0,0,1000,600));

Loading…
Cancel
Save