Last active
October 15, 2015 19:44
-
-
Save kasperkamperman/696a844cffdafbba81e1 to your computer and use it in GitHub Desktop.
With mimim you can directly play an mp3 from a url.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://developer.spotify.com/web-api/get-track/ | |
// http://code.compartmental.net/minim/minim_method_loadfile.html | |
import ddf.minim.*; | |
import ddf.minim.effects.*; | |
Minim minim; | |
AudioPlayer groove; | |
void setup() | |
{ | |
size(512, 200, P3D); | |
minim = new Minim(this); | |
groove = minim.loadFile("http://d318706lgtcm8e.cloudfront.net/mp3-preview/f454c8224828e21fa146af84916fd22cb89cedc6"); //, 2048); | |
groove.play(); | |
} | |
void draw() | |
{ | |
background(0); | |
stroke(255); | |
for(int i = 0; i < groove.bufferSize() - 1; i++) | |
{ | |
line(i, 50 + groove.left.get(i)*50, i+1, 50 + groove.left.get(i+1)*50); | |
line(i, 150 + groove.right.get(i)*50, i+1, 150 + groove.right.get(i+1)*50); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment