After using Processing for a few projects I really wanted to explore its audio functions and make an audio visualization.
My main concern was about the fact that there are already hundres, thousands, millions of audio visualization tools out there and I didn’t want to end up doing the same thing everyone else (with a few exceptions) is doing.
This tools are usually made with algorythms like beat/frequency detection which are of course main parameters in an audio file.
However, I haven’t been able to find any project that was actually using metadata to change the visualization parameters of a song (please let me know if you have seen cool projects about this).
Metadata are always there, why not taking advantage of this?
My sketch actually creates a color map of a song, an actual footprint that can potentially be unique for each song. In fact, the sketch uses 2 main colors for the lines and these are calculated based on the metadata (title and author for example). These values will be the centre point for all the other shades that are generate accordingly. Basically I have multiple palettes and each song you put into the sketch will have its own colors with its own shades.
The song in the video can be found here
Here’s some of the code I used
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
//function to count metadata characters int[] count_chars(){ String tit = meta.title().toLowerCase(); String nm = meta.author().toLowerCase(); char[] title = tit.toCharArray(); char[] name = nm.toCharArray(); int[] a = new int[4]; a[0] = sum_chars(title, tit.length()); a[1] = tit.length()*122; a[2] = sum_chars(name, nm.length()); a[3] = nm.length()*122; return a; } ... //mySums is the array returned by count_chars() // choose_color will choose one of the main colors depending on my_tit_col/my_nm_col value /* title */ int my_tit_col = (int) map(mySums[0], min_char, mySums[1], 0, 80); choose_color(my_tit_col, 1, col); /* name */ int my_nm_col = (int)map(mySums[2], min_char, mySums[3], 0, 80); choose_color(my_nm_col, 2, col); ... //for each chosen color extract rgb values void extract_col_values(color col, int n){ if(n == 1){ myRGB[0] = col>>020 & 0xff; myRGB[1] = col>>010 & 0xff; myRGB[2] = col & 0xff; }else{ myRGB[3] = col>>020 & 0xff; myRGB[4] = col>>010 & 0xff; myRGB[5] = col & 0xff; } } ... //generate pseudo random color shades stored in my_final array for(int i=0;i<my_final.length;i++){ if(i == 2 || i == 5) my_final[i] = int(random(40,70))*(randomGaussian())+myRGB[i]+(random(avg)*0.3); else my_final[i] = int(random(40,70))*(randomGaussian())+myRGB[i]+(random(avg)*0.9); } ... //creates the color objects and call the function to create the lines color myColor = color(my_final[0], my_final[1], my_final[2], map_high); l_up(myColor); myColor = color(my_final[3], my_final[4], my_final[5], map_high); l_down(myColor); |