Loading...
Logo
Processing Forum

Special sound effects

in General Discussion  •  Other  •  4 months ago  
Well I came up with a problem and as I still don't have enough practise with prcessing I am having trouble with some of the features. What i want to do is add 2 sound effects, one when the monste is eating the man and another for when I pull him out, a added the sound effect to the file. Please I would be very grateful if someone helped me out. It's for a school project and I want it to look and sound cool. (;

Replies(3)

I made a game recently and I used Minim for it. I'll try to help you, gonna read my code again)
For example here I have an audio file imported:
Copy code
  1. import ddf.minim.spi.*;
  2. import ddf.minim.signals.*;
  3. import ddf.minim.*;
  4. import ddf.minim.analysis.*;
  5. import ddf.minim.ugens.*;
  6. import ddf.minim.effects.*;

  7. Minim minim;
  8. AudioPlayer myAudioFile;

  9. void setup(){
  10.   minim = new Minim(this);
  11.   myAudioFile = minim.loadFile("myAudioFile.mp3");
  12. }
  13. void stop() {
  14.   minim.stop();
  15.   super.stop();
  16. }

Then I can play them, pause , mute them and unmute them them like this:
Copy code
  1. void stopMusic(){
  2. myAudioFile.close();
  3. }
  4. void playMusic(){
  5. myAudioFile.play();
  6. }
  7. void pauseMusic() {
  8.   myAudioFile.pause(); 
  9. }
  10. void muteMusic() {
  11.   myAudioFile.mute(); 
  12. }
  13. void unmuteMusic() {
  14.   myAudioFile.unmute(); 
  15. }
Reading this post might be helpful:

Good luck!

Sorry for not commenting before thanks it really helped me out (;