Advertisement
Matthen

Voice Viz

Jun 26th, 2013
556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. data = Import["http://mi.eng.cam.ac.uk/~mh521/js/data.js", "Text"];
  2. x = Select[ToExpression /@ (StringSplit[data, ","][[8 ;; -2]]),
  3. NumberQ];
  4. ps = Transpose[{Range[Length[x]], x}];
  5. Needs["ComputationalGeometry`"];
  6. poly = DelaunayTriangulation[ps];
  7. Graphics[{
  8. GraphicsComplex[ps,
  9. Table[
  10. With[{p = poly[[j]],
  11. col = ColorData["StarryNightColors"][(*j/Length[poly]*)
  12. RandomReal[]]},
  13. {
  14. Opacity[
  15. Mod[RandomVariate[NormalDistribution[j/Length@poly, 0.1]],
  16. 1]],
  17. Darker@col,
  18. If[j < Length[poly], Line[{First[p], poly[[j + 1, 1]]}], {}],
  19. col,
  20. Table[
  21. Polygon[{First[p], p[[-1, i]],
  22. p[[-1, Mod[i + 1, Length@Last[p], 1]]]}]
  23. , {i, Length@Last[p]}]}
  24. ]
  25. ,
  26. {j, Length@poly}]
  27. ]
  28. }, PlotRange -> All, AspectRatio -> 0.618]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement