Converting sound to graphic, changing line color, exporting as dxf

edited October 2017 in Library Questions


I am pretty new to processing and trying to understand it by reading forum posts and working with existing codes. I found this one. It loads an mp3 file and while playing converts it into ellipses or circles.

I have some questions on this and maybe someone can help me out:

1.) Is there a way how I can change the color of the lines according to the volume (i.e. gradient, low volume blue to highest volume red) ?

2.) The screen size is fixed at the moment. So it only covers the first part of a song. Is there a way to let it "float" or extend in hight automatically so it covers the whole song ?

3.) I would love to export the complete graphic as a dxf after the song is finished. How could that be achieved ?

I am a bit stuck at the moment....

Thank you in advance! Tom

import ddf.minim.analysis.*;

import ddf.minim.*;

float x;
float y;
Minim minim;
AudioPlayer player;

void setup () {
// Sketch einstellen
size (1500, 1000);
stroke (0, 50);
noFill ();

// Startposition festlegen
x = 50;
y = 50;

// Audiotoolkit anlegen
minim = new Minim (this);
player =minim.loadFile ("one.mp3");
background (255); ();

void draw () {
// Kreisgröße Abhängig von Lautstärke
float dim = player.mix.level () * width * 0.3;

// Kreis x-Position verschieben
x += player.mix.level () * 30;
// Kreis zeichnen
ellipse (x, y, 30, dim);
// Liniendicke abhängig von Lautstärke
strokeWeight(player.mix.level () * 8); 

if (x > width-150) {
  x = 50;
  y += 150;


Sign In or Register to comment.