We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › Newb Help...need to play sound when key is press
Page Index Toggle Pages: 1
Newb Help...need to play sound when key is press (Read 429 times)
Newb Help...need to play sound when key is press
Mar 2nd, 2006, 8:55pm
 
first post here - -

hi everyone, i'm just learning processing and i've been trying to play a sound when a specific key is press, i can't seem to find any examples... heres what i got so far

PSound soundA;
PSound soundB;
PSound soundC;

void setup()
{
 soundA = loadSound("1.wav");
 soundB = loadSound("2.wav");
 soundC = loadSound("3.wav");
 size(300,300);
}

void draw()
{
 if(keyPressed) {
   soundA.play();
 
 }
}

any help will be gladly appriciated
Re: Newb Help...need to play sound when key is pre
Reply #1 - Mar 3rd, 2006, 1:41pm
 
please don't double post.
Page Index Toggle Pages: 1