Play sound at a URL?

edited November 2016 in Library Questions

Is there a way to play an audio file at a URL using the processing sound library? I tried just feeding the URL into the path but it didn't work, the console just complains that the file can't be found. I did try just putting the string into Chrome's URL bar and it changed it because there was a space (The link did work), so I tried putting the new link into the code to no avail. Any ideas/workarounds?

Answers

  • Hi

    I found out this sample and it works fine, try it and check out if it what you need

        import ddf.minim.*;
        Minim soundengine;
        AudioSample sonido1;   
    
        void setup() 
       {
            size(500, 600);
            soundengine = new Minim(this);
            sonido1 = soundengine.loadSample("http://sonidosmp3gratis.com/sounds/008844478_prev", 1024);    
       }
    
        void draw() 
       {
    
              background(255);
              textSize(16);
              fill(0, 102, 153);
              text("Press b' or 'B' to start sound ",50, 50);
        }  
        void keyPressed() 
       {
          if (key == 'b' || key == 'B') 
          {
            sonido1.trigger();
          }
        }
    
  • I was talking about the processing sound library, not minim. I've transferred to minim for the time being, although it's having a strange glitch with my AudioPlayer's position method. It stops updating after 470ms, and it complains in the console "Don't know the ID3 code GEOB" but it still works. I've made my own timer class to get around the broken position, but it's not ideal.

  • More progress (issues found). Minim appears to be maxing the file length to 575 ms. Not really sure what's going on, perhaps there's something strange with the encoding of the files?

Sign In or Register to comment.