Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Triggering multiple sounds with SoundFile?

$
0
0

Hello ! I'm trying to make a simple program with multiple sound outputs using the SoundFile Library. I tried to make it so that at a particular hour, a sound file is played that lasts exactly one minute, and then at the start of the next minute, a new sound file is played to create the illusion of a continuous, but changing sound. However, when I run the program, it always plays the first sound right on time, but never plays the sound set to play when the first one ends- here is the code I've been trying to use.

import processing.sound.*;

import processing.sound.*; SoundFile file;

void setup() {

size(640, 500);

background(10,10,10);

}

void draw() {

int s = second(); // Values from 0 - 59

int m = minute(); // Values from 0 - 59

int h = hour(); // Values from 0 - 23

if(h == 21 && m == 28 && s == 0) {

noLoop();

file = new SoundFile(this, "900pm.mp3");

file.play();

}

if(h == 21 && m == 29 && s = 0) {

noLoop();

file = new SoundFile(this, "901pm.mp3");

file.play();

}

} It plays "90pm" at 9:00, but once it hits 9:01, it's silent. I am wondering if a) I should put the loading of the Soundfiles in setup, b) if this program is possible (should I be using Minim?) c) if there is some function that I am missing that will allow the program to keep sequencing a number of soundles one after the other, at the specific time. Thanks so much!


Viewing all articles
Browse latest Browse all 2896

Trending Articles