HydrogenAudio

Hosted Forums => foobar2000 => Uploads - (fb2k) => Topic started by: anaono on 2013-11-25 13:56:32

Title: [Request] New Feature: "A color for each ton of the octave"
Post by: anaono on 2013-11-25 13:56:32
@Admin: Sorry, Please delete this post! It should be under:

http://www.hydrogenaudio.org/forums/index....showtopic=97404 (http://www.hydrogenaudio.org/forums/index.php?showtopic=97404)



Dear fismineur, many thanks for your Musical Spectrum

I ask you for a new feature. I propose to give a different color for each of the 12 notes of the octave. For an example show here:

http://www.planetware.de/colormusic/iColorpiano.html (http://www.planetware.de/colormusic/iColorpiano.html)

(In this example i find it difficult to distinguish the colors for "c#, d and d#" and for "b ans c").
Title: [Request] New Feature: "A color for each ton of the octave"
Post by: romor on 2013-12-15 18:07:09
I'll show you a workaround in the meantime.
Similar to what you requested can be accomplished by choosing "Horizontal A" colormap rendering and a tiny bit of tweaking (example for Python interpreter):

1. We put the colors from your linked page to a list, and then pad those colors with "00":
Code: [Select]
cl = ["669900", "006699", "0066FF", "6600FF", "660099", "CC0066", "FF0000", "FF6600", "FF9900", "FFCC00", "FFFF00", "99CC33"]
cl = [i + "00" for i in cl]

2. Let's suppose our musical spectrum displays 8 octaves (starting from C for simplicity), thus:
Code: [Select]
number_of_octaves = 8
cl = ''.join(number_of_octaves * cl)

which we'll append as bytes to a "header":
Code: [Select]
header = '001E099F08928D40818A1619B19AA41A2C000000E86700001878' + \
        '%02X' % (number_of_octaves * 12) + \
        '03C4000D00F4013200B8011900FFFF0300C0C0C000FFFFFF002E354300F8F8F800B0B0B000'

Header contains some settings about musical spectrum configuration and important in this case - number of colors we want to introduce - 8 * 12 = 96 or in hex = 60.

3. Than we pack everything to binary file:
Code: [Select]
with open("colorpiano_8oct.cfg", "wb") as f:
    for i in range(0, len(header + cl), 2):
        f.write(chr(int((header + cl)[i:i+2], 16)))


Result:

(http://i.imgur.com/zGkyzr7.png)

So this is very simple walk-through how to get there from Python interpreter.

Cheers
Title: [Request] New Feature: "A color for each ton of the octave"
Post by: anaono on 2013-12-16 12:26:05
Thank you 

It looks good. I will test it in the next weeks, if i have more time.
It still needs some fine adjustment about color distribution: C2# is blue, but C9# is green; or B2 is light green and B8 is yellow: perhaps because you have configured [C2..C10] = 8 * 12 + 1 tones = 97 tones (i dont't know the real reason).

I am pleased to be able to see my music in colored tones ...
Title: [Request] New Feature: "A color for each ton of the octave"
Post by: romor on 2013-12-17 07:49:27
C2# is blue, but C9# is green; or B2 is light green and B8 is yellow: perhaps because you have configured [C2..C10] = 8 * 12 + 1 tones = 97 tones (i dont't know the real reason).


You are absolutely right
In above screenshot, I have chosen scale from C2 to C10, while I should have from C2 to B9.

IMHO, this is just harmless example of so common problem - indexing. Does limits include in range, does both sides share same rule, does indexing starts from 0 or 1. If you ever had a course in mathematics practicing operations with sequences I guess you'll find everything a breeze except sequence indexing
Title: [Request] New Feature: "A color for each ton of the octave"
Post by: EpicForever on 2014-02-08 08:56:32
Great preset romor !! Thanks  I only changed background to black and disabled white/black keys  looks great