Bug 208 : PSound.play() won't play the sound a 2nd time
Last modified: 2006-09-25 10:22



Assigned To:

Attachment Type Created Size Actions
Sample program with bug: bug_208.zip application/zip 2005-11-11 10:08 25.28 KB
Example code/file showing change in action of PSound application/octet-stream 2005-12-21 03:01 160.17 KB

Description:   Opened: 2005-11-10 19:06
Example: Pressing the mouse will not re-trigger the sound. If mySound.stop
is called on mouseReleased() the sound will play again on mousePressed.


PSound mySound;

void setup() {
mySound = loadSound("arigato.wav");

void draw() { }

void mousePressed() {
Additional Comment #1 From fry 2005-11-11 09:35
can you use "archive sketch" and attach a copy of the example sketch to the
bug? extra points if you also rename the sketch bug_208 :)
Additional Comment #2 From REAS 2005-11-11 10:08
Sample program with bug: bug_208.zip
Additional Comment #3 From fry 2005-11-30 10:39
fixed in the repository for 0098. some api issues came up in the interim,
which i'll email you about.
Additional Comment #4 From REAS 2005-12-09 00:12
I'm running the original example (the one attached) with v98 and the same
problem persists.
Additional Comment #5 From JohnG 2005-12-20 18:14
I've had something similar to this with 98 and 99, from within processing
the sounds play repeatedly fine, but when exported to a sketch/application
the sounds only play once.

This might be related, but when running the applet I get an error with
"Master Gain" which has been on the boards before. I think this might be
related, and would be a Java 1.5 issue. even if the applet is built with
the java included with processing, when run in a 1.5 JRE the error shows up.
Additional Comment #6 From JohnG 2005-12-21 03:01
Example code/file showing change in action of PSound
Additional Comment #7 From JohnG 2005-12-21 03:02
Actually, as an addendum to the previous post, I've done a bit more
investigating as to why I was having problems with playing a sound a second
time, even though I was calling stop() then play().

What I was doing was starting playing the sound, waiting a frame, then
checking mySound.time(); to see how long had elapsed, and within
Processing, time becomes 0 when the sample has finished playing. However in
an applet, the time doesn't return to 0 when it's finished playing. This
may be just a consequence of a deeper rooted bug, or a cause of others, I'm
not sure which.

example code/data in attachment to this bug.

Output in Processing:

Frame: 1 Sound time: 0.0
Frame: 2 Sound time: 0.0
Frame: 3 Sound time: 0.069705
Frame: 4 Sound time: 0.069705
Frame: 5 Sound time: 0.139365
Frame: 6 Sound time: 0.139365
Frame: 7 Sound time: 0.209024
Frame: 8 Sound time: 0.278684
Frame: 9 Sound time: 0.278684
Frame: 10 Sound time: 0.348344
Frame: 11 Sound time: 0.0
Frame: 12 Sound time: 0.0
Frame: 13 Sound time: 0.0
Frame: 14 Sound time: 0.0

Output when an applet: (not including Master Gain stuff)
Frame: 1 Sound time: 0.0
Frame: 2 Sound time: 0.018548
Frame: 3 Sound time: 0.05365
Frame: 4 Sound time: 0.098594
Frame: 5 Sound time: 0.135691
Frame: 6 Sound time: 0.181587
Frame: 7 Sound time: 0.21873
Frame: 8 Sound time: 0.250929
Frame: 9 Sound time: 0.290975
Frame: 10 Sound time: 0.34077
Frame: 11 Sound time: 0.368163
Frame: 12 Sound time: 0.372743
Frame: 13 Sound time: 0.372743
Frame: 14 Sound time: 0.372743

As you can see, in processing the time returns to 0, but in an applet it
stops at the end time of the wav file.
Additional Comment #8 From fry 2005-12-21 08:05
yeah, that's prolly a java 1.4 vs java 1.5 issue with the applet stuff.

the status on this bug is that the PSound stuff needs to be ripped out and i have to start
over. there are too many incompatibilities between mac and pc as well as between java
releases. so i'll be looking to completely rework things.
Additional Comment #9 From REAS 2006-09-25 09:04
PSound is a part of the current Processing API.
Additional Comment #10 From fry 2006-09-25 09:15
that should be is *not* a current part of the api ;-)
Additional Comment #11 From REAS 2006-09-25 10:22
Yes, what Ben said. PSound is not a part of the current Processing API.