New color scheme for spectrogram

Anything you think is missing, or needs enhancement, goes here.
Forum rules
If you require help using Audacity, please post on the forum board relevant to your operating system:
Windows
Mac OS X
GNU/Linux and Unix-like
dofuuz
Posts: 7
Joined: Sun May 02, 2021 7:18 am
Operating System: Windows 10

New color scheme for spectrogram

Post by dofuuz » Mon May 03, 2021 11:17 am

Overview
I suggest new color scheme for audacity spectrogram, which is more pretty and better representing audio.

It looks like this:
proposal.jpg
proposal.jpg (1021.47 KiB) Viewed 1795 times
Original for comparison:
original-light.jpg
original-light.jpg (958.51 KiB) Viewed 1795 times

Motivation

To make spectrograms that are pretty, better represent audio, easier to read by those with colorblindness, and print well in gray scale.

Here is further readings:
https://bids.github.io/colormap/
https://cran.r-project.org/web/packages ... ridis.html

Audacity's default colormap is quite bad. Especilly when it's printed in grayscale.
original-grayscale.jpg
original-grayscale.jpg (324.79 KiB) Viewed 1795 times
Lightness of background and foreground is confusing.
viscm-audacity-light.jpg
viscm-audacity-light.jpg (289.34 KiB) Viewed 1795 times
As you can see, grayscale converted colorbar is chaotic. It should be simple gradient of white - black.

There is huge red bending, which makes spectrogram hard to read.

steve
Site Admin
Posts: 81955
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: New color scheme for spectrogram

Post by steve » Mon May 03, 2021 11:31 am

Thanks for the suggestion.
dofuuz wrote:
Mon May 03, 2021 11:17 am
easier to read by those with colorblindness, and print well in gray scale.
Audacity already offers greyscale rendering of the spectrogram, though it does not offer the full black to white range.
https://manual.audacityteam.org/man/spe ... ences.html

First Track000.png
First Track000.png (110 KiB) Viewed 1794 times
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

dofuuz
Posts: 7
Joined: Sun May 02, 2021 7:18 am
Operating System: Windows 10

Re: New color scheme for spectrogram

Post by dofuuz » Mon May 03, 2021 11:33 am

The new colormap
viscm-proposal.jpg
viscm-proposal.jpg (276 KiB) Viewed 1791 times
Considerings while making the new colormap (in order of priority):
- Wide range of lightness (almost full 0-255)
- Colorful, wide range of hue, chroma
- Originality, keep magenta-ish feeling
- Aim to be perceptually smooth
- Pretty

I wrote python code for generating the colormap.
https://github.com/dofuuz/audacity-colormap

Execute 'gen_wheel.py' to generate color wheel.

Change constants like ANGLE, OFFSET, CCW... and generate different color wheels.


Obstacles

There are problems for applying the colormap.


Transparency for sync-lock overlay
Currently, audacity spectrogram has transparency for sync-lock overlay
https://manual.audacityteam.org/man/syn ... roups.html

Without disabling this, spectrograms would look like this:
proposal-tp.jpg
proposal-tp.jpg (952.37 KiB) Viewed 1791 times
It will affect color even if background is (0, 0, 0) black.

→ I suggest disabling transparency of spectrogram.


Restriction of Theme
Theme is not applicable for new colormap. A theme can use only 5 colors for spectrogram, which is too small for good colormap.

I tried to make 5-color version of the colormap.
viscm-proposal-5color.jpg
viscm-proposal-5color.jpg (291.47 KiB) Viewed 1791 times
Color bendings are clearly visible.

Also, Audacity ignores the "Spectro1", "Spectro1sel" and "SpectroBackground" colors for the sync-lock overlay.

→ So another suggestion: making option to select color scheme independent from theme.
color-scheme.png
color-scheme.png (24.42 KiB) Viewed 1791 times

dofuuz
Posts: 7
Joined: Sun May 02, 2021 7:18 am
Operating System: Windows 10

Re: New color scheme for spectrogram

Post by dofuuz » Mon May 03, 2021 11:52 am

I divided posting to attach more than 4 images.... and admin replied between the posts. 😂

This is not a feature request. I already wrote the code to apply it. Here is my pull request.
https://github.com/audacity/audacity/pull/830

I wanted opinions something about artwork, so I posted this post at 'Audacity Artwork and Graphics' forum.
And... admin moved this post to 'Adding Features to Audacity'
I'm not sure where this post should go now.

Anyway, please give me your opinion about new spectrogram.

Thanks!

To admin: Please merge my PR!

steve
Site Admin
Posts: 81955
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: New color scheme for spectrogram

Post by steve » Mon May 03, 2021 12:09 pm

dofuuz wrote:
Mon May 03, 2021 11:52 am
To admin: Please merge my PR!
Pulls requests are handled by the developers. This forum is primarily for end user support.

I moved this topic here because you are proposing an enhancement to Audacity's feature set. It looks to me like a very viable enhancement and is more likely to attract the attention of the Audacity developers in this part of the forum.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

steve
Site Admin
Posts: 81955
Joined: Sat Dec 01, 2007 11:43 am
Operating System: Linux *buntu

Re: New color scheme for spectrogram

Post by steve » Mon May 03, 2021 12:17 pm

dofuuz wrote:
Mon May 03, 2021 11:52 am
I wanted opinions something about artwork, ...

Anyway, please give me your opinion about new spectrogram.
I think they look terrific.
9/10 questions are answered in the FREQUENTLY ASKED QUESTIONS (FAQ)

Tantacrul
Posts: 3
Joined: Mon May 03, 2021 12:12 pm
Operating System: macOS 10.15 Catalina or later

Re: New color scheme for spectrogram

Post by Tantacrul » Thu May 06, 2021 12:41 pm

I agree. They look great :)

Paul L
Posts: 1788
Joined: Mon Mar 11, 2013 7:37 pm
Operating System: Please select

Re: New color scheme for spectrogram

Post by Paul L » Tue Jun 01, 2021 10:29 pm

Hello dofuuz,

As one if the Audacity development team, I say we are still very interested in your contribution.

Could you rebase these changes onto a more recent master branch tip, and force-push again you your fork?

Please also see your private messages on this forum.

Thank you.

Paul Licameli

dofuuz
Posts: 7
Joined: Sun May 02, 2021 7:18 am
Operating System: Windows 10

Re: New color scheme for spectrogram

Post by dofuuz » Wed Jun 02, 2021 5:14 am

Paul L wrote:
Tue Jun 01, 2021 10:29 pm
Could you rebase these changes onto a more recent master branch tip, and force-push again you your fork?

Please also see your private messages on this forum.
I merged upstream master into changes.

BTW, I didn't received any new PM on this form. 🤔

Paul L
Posts: 1788
Joined: Mon Mar 11, 2013 7:37 pm
Operating System: Please select

Re: New color scheme for spectrogram

Post by Paul L » Wed Jun 02, 2021 11:02 am

I'm sorry, please check your inbox again now.

Do not merge master into your branch. Instead, checkout out your branch (at commit 558bf1e38be74325ee7f73a85ee9caf72d6a745b), and do

git rebase audacity/master

and then

git push -f origin spec-color

(or however you named your remote repos, substitute them for "audacity" and "origin")

I have begun to make some comments on the commits. Please watch for more.

PRL

Post Reply