Paste sounds before playing, minim library

edited October 2014 in Using Processing

Hello, good morning:

I am learning to use the minim library.

if(sound != null) {sound= sound + minim.loadFile("1.mp3") ;} 
else {sound= minim.loadFile("1.mp3") ;} 
sound.play();

I want to load and paste multiple audio files before playing the sound.

the + does not work, how can I do this?

Greetings and thanks.

Tagged:

Answers

  • Use an ArrayList.

  • Thanks for answer,

    Do you could help me with a code example?

  • There are plenty of examples in the documentation and the examples section. Google is your friend.

    I'll get you started: http://www.processing.org/reference/ArrayList.html

  • edited October 2014

    Thanks,

    I think this example can help me :D

    import ddf.minim.spi.*;
    import ddf.minim.*; 
    import ddf.minim.signals.*;
    import ddf.minim.analysis.*;
    import ddf.minim.effects.*;
    import ddf.minim.ugens.*;
    boolean play;
    boolean repeat;
    int k;
    String filename;//
    Minim minim;
    AudioPlayer player;
    
    Pics p;
    Mechs m;
    Importbt b;
    ArrayList<Songs> s;
    int i=0;
    void setup() {
    size(600, 400);
    b=new Importbt();
    m=new Mechs();
    p=new Pics();
    p.Thepics();
    
    minim=new Minim(this);
    s = new ArrayList();
    s.add(new Songs(player, "SONG 1", "SONG 1"));
    s.add(new Songs(player, "SONG 2", "SONG 2"));
    s.add(new Songs(player, "SONG 3", "SONG 3"));
    s.add(new Songs(player, "SONG 4", "SONG 4"));
    k = s.size()-1;
    }
    void draw() {
    background(0);
    p.getFunction();
    }
    
    void fileSelected(File selection) {
    if (selection == null) {
    } 
    else {
    filename = selection.getAbsolutePath();
    player = minim.loadFile(filename);//loads the file
    // s.add(k, new Songs(player, filename, "a song"));
    //s.get(k).playmusic();
    s.add(new Songs(player, filename, "ftyu"));
    s.get(k).waveform();//function from my songs class
    player.play();//plays the file
    
Sign In or Register to comment.