Problem with "Sound" library

edited May 2016 in Library Questions

I'm trying to run the example in the documentation for the "Sound" library (https://processing.org/reference/libraries/sound/SoundFile.html) but I'm getting an error. I'm running v1.3.2 of the library, under Processing 3.1.1 and Windows 7 Pro. I tried both the 32-bit and 64-bit versions of Processing. The only change I made to the code was to change line 9 to point to the mp3 file on my hard drive. But when I try to open the file, I get this error message:

The constructor "SoundFile(SoundFile, String)" does not exist.

The error message doesn't make any sense, at least to me. I'm passing "this" as the first parameter, just as in the example, and a string with the full path name of the mp3 file as the second parameter. Why does it think "this" is a SoundFile?

Is the "Sound" library still working?

Here's my code, although as I said, I only changed the one line which opens the file.

import processing.sound.*;
SoundFile file;

void setup() {
  size(640, 360);
  background(255);

  // Load a soundfile from the /data folder of the sketch and play it back
  file = new SoundFile(this,"C:\\Users\\owner\\Music\\% Attac\\01 Tonino Carotone & Manu Chao - La Trampa.mp3");
  file.play();
}      

void draw() {
}
Tagged:

Answers

  • edited May 2016

    It crashes for me in Win7 for both 64-bit P3.1.1 & P3.0.2 when trying to initialize SoundFile v1.3.2. :-&

    # Internal Error (0x20474343), pid=2576, tid=0x00000000000012c4  
    # C  [KERNELBASE.dll+0xb3dd]  
    
    # JRE version: Java(TM) SE Runtime Environment (8.0_92-b14) (build 1.8.0_92-b14)
    # 64-Bit Server VM (25.92-b14 mixed mode windows-amd64 compressed oops)
    
  • edited May 2016

    @dfkettle

    try this

    import processing.video.*;

    Movie movie;

    void setup(){ size(200,200); movie = new Movie (this,"something.wav"); }

    void draw(){ background(0); noLoop(); }

    void mousePressed(){ movie.stop(); movie.play(); }

    import processing.video.* supports Sound file.

  • edited May 2016

    Thanks, but I'd like to know if the Sound library is working (in other words, what am I doing wrong?) Is this just an issue under Windows? And I want to do more than just play the file, I want to access the metadata.

  • I have processing 3.1.1. and it worked for me:

    Kf

    import processing.sound.*;
    SoundFile file;
    
    void setup() {
      size(640, 360);
      background(255);
    
      // Load a soundfile from the /data folder of the sketch and play it back    
      file = new SoundFile(this,"C:\\Users\\C\\Downloads\\Crickets.mp3");
      file.play();
    }      
    
    void draw() {
    }
    
  • edited May 2016

    @dfkettle @kfrajer

    Sound library is working. Did you install the sound library? or follow this steps.

    1.open contribution manager(캡처_2016_05_31_20_29_52_376

    2.search "sound" in filter and install sound library by the processing foundation.

    I hope this will help

  • @kfrajer: Which version of the Sound library? Which version of Windows?

  • @unnamed: Yes, I installed the library. I would have gotten a different error message otherwise, something like "missing library".

  • @dfkettle Sorry, I have no idea for that error

  • edited May 2016

    Maybe your audio file isn't supported, but why don't you use minim?

  • @redcardinal: The Sound library is supposed to support MP3, wav and aiff. Minim is another option, but I'd like to know why the Sound library isn't working, or if it is, what am I doing wrong? Nobody has either confirmed or denied that it's working under Windows. Someone said that it works, but didn't say which OS they're using.

  • Answer ✓

    @ dfkettle My specs:

    Sound Library 1.3.2.

    Windows 8.1

    processing-3.1.1-windows64

    I hope this helps,

    Kf

  • @kfrajer Thanks. I'm beginning to think it might have something to do with the version of Java on my machine. Here's what I've got:

    java version "1.7.0_60" Java(TM) SE Runtime Environment (build 1.7.0_60-b19) Java HotSpot(TM) 64-Bit Server VM (build 24.60-b09, mixed mode)

    Maybe I should upgrade to Java 8.

  • Answer ✓

    I have

    C:\windows\system32>java -version
    java version "1.8.0_77"
    Java(TM) SE Runtime Environment (build 1.8.0_77-b03)
    Java HotSpot(TM) Client VM (build 25.77-b03, mixed mode, sharing)
    

    I hope upgrading solves your problem.

    Kf

  • I fixed this problem by dragging my .mp3 file onto the Processing window, only then did the path work. It automatically added the file to the sketch folder.

  • I solved my problems with the sound library, referring to the soundFile, with 2 actions: 1) Don't forget to save your music in a "data" File, then save at the sketchbook. 2) The program only accepts mono, so, if is the case, use audacity to transform it.

Sign In or Register to comment.