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.
Page Index Toggle Pages: 1
buttons and music (Read 1159 times)
buttons and music
Apr 13th, 2009, 7:22pm
 
hey guys just wondering if anyone could help me out with the code to
load music when i click a button and if i click it again to stop it..?

i'm new to processing so am v n00b Sad

pls help!
Re: buttons and music
Reply #1 - Apr 16th, 2009, 7:56am
 
Take a look at the Minim library that comes with Processing. Open Processing and go to "File > Examples > Libraries > Minim (Sound) > LoadFile".

It's quite simple and you can easily modify it to combine it with e.g. this

http://processing.org/reference/keyPressed_.html

Good luck. Smiley
Re: buttons and music
Reply #2 - Apr 16th, 2009, 9:00am
 
first of all, please excuse my inexperience. i am a processing and minim n00b and i am having some trouble figuring out my problem.

i'm looking to do something similar to the OP except i want to use images for the buttons.

so bascially what i am trying to achieve is this:
1. to have 4 clickable buttons but i want to use images for each state: base, rollover, and pressed. each button will have a different image.

2. each button will trigger a different sample. clicking the button again will stop playback.

3. all samples will be in the same bpm. if one sample has been triggered and is playing, clicking another button will trigger its sample but it will play in synch with the sample the was already playing.

4. essentially, if all 4 buttons are clicked, all samples will play in synch.

i don't know how/if i should create an array of buttons.

any help will be appreciated and i am sorry if i hijacked this thread.

thanks!
Re: buttons and music
Reply #3 - Apr 19th, 2009, 3:54am
 
Hey richs

The image button you can find a sample of in "File > Examples > Topics > GUI > ImageButton".

I'm not sure about the timing issues but you might be able to use the time functions to solve this. I don't have much knowledge about SoundCipher but it could seem like it was made for something like this:
http://soundcipher.org/
Page Index Toggle Pages: 1