I'm trying to create a visualization based on the data from the Spotify audio analysis. Here is a part of the data:
{
...
"segments": [
{
"start": 0,
"duration": 0.20934,
"confidence": 1,
"loudness_start": -60,
"loudness_max_time": 0.06898,
"loudness_max": -22.328,
"loudness_end": 0,
...
},
{
"start": 0.20934,
"duration": 0.10907,
"confidence": 0.772,
"loudness_start": -35.399,
"loudness_max_time": 0.01327,
"loudness_max": -25.11,
"loudness_end": 0,
...
},
...
],
...
}
What I want to do:
- Group these segments based on the start value. Example: All segments from second 0 to second 1 are a group, all segments from second 1 to second 2 and so on...
- Every group should be a new object with all the values combined (e.g. the median of all
loudness_maxvalues, the median of allloudness_startvalues, etc...)
I already tried using d3s group and rollup functions but I couldn't get it to work so far. How would one achieve this using js/d3?
I hope this description is comprehensible, thanks in advance for your help!