Cannot get my soundtrack to play during game

Hi, I’m totally new at this but I’ve made a game for a college project that’s centred around non-traditional interactions. It’s basically a mash-up of Flappy Bird and Chicken Scream where you use sound (or a mouseclick) to make the panda float. The issue I’m having is that it won’t play the soundtrack. I’m using both sound and minim libraries. Could that be the issue?

Here’s the code:

import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;
import processing.sound.*;


PImage backImg =loadImage("");
PImage pandaImg =loadImage("");
PImage wallImg =loadImage("");
PImage startImg=loadImage("");
PImage winImg=loadImage("");
PImage bushImg=loadImage("");
int gamestate = 1, score = 0, highScore = 0, x = -200, y, vy = 0, wx[] = new int[3], wy[] = new int[3];
float vyfloat;

Amplitude amp;
AudioIn in;
float ampt;

import ddf.minim.*;

Minim minim;
AudioPlayer player;

void setup() {
  size(1000,800);
  fill(0);
  textSize(40);
  fill(255);

  minim = new Minim(this);
  player = minim.loadFile("funnysong.mp3");
  amp = new Amplitude(this);
  in = new AudioIn(this, 0);
  in.start();
  amp.input(in);
}

void draw() { //runs 60 times a second
    if(gamestate == 0) {
    imageMode(CORNER);
    image(backImg, x, 0);
    image(backImg, x+backImg.width, 0);
    println("vy is " + vy);
    println("y is " + y);
    x -= 3;
    vyfloat = vyfloat + 0.5;
   
  
  y += vyfloat;
  if(x == -1800) x = 0;
  for(int i = 0 ; i < 3; i++) {
      imageMode(CENTER);
      image(wallImg, wx[i], wy[i] - (wallImg.height/2+100));
      image(wallImg, wx[i], wy[i] + (wallImg.height/2+100));
      if(wx[i] < 0) {
        wy[i] = (int)random(250,height-250);
        wx[i] = width;
      }
      if(wx[i] == width/2) highScore = max(++score, highScore);
      
      
      if(y>height||y<0||(abs(width/2-wx[i])<25 && abs(y-wy[i])>100)) gamestate=1;
      wx[i] -= 4;
    
    }
    
    if(score>9) gamestate=2;
    
    
    imageMode(CORNER);
    image(bushImg, x, 0);
    image(bushImg, x+backImg.width, 0);
  
    image(pandaImg, width/2, y);
    text(""+score, width/2-15, 100);
    
    ampt = amp.analyze();
    println(ampt);
    
    if (ampt > 0.030){
      vyfloat = -3.2;}
  
    else if (ampt>0.150) {
      vyfloat = -8.5;}
  }
  else if (gamestate == 1) {
    imageMode(CENTER);
    image(startImg, width/2,height/2);
    text("High Score: "+highScore, 165,725);
  }
  
  else if (gamestate == 2) {
  
    imageMode(CENTER);
    image(winImg, width/2, height/2);
  }
}
void mousePressed() {
  
  vyfloat = -8.2;
  if(gamestate==1) {
    wx[0] = 600;
    wy[0] = y = height/2;
    wx[1] = 900;
    wy[1] = y = height/2;
    wx[2] = 1200;
    wy[2] = y = height/2;
    
    x = gamestate = score = 0;
  }
  
  else if (gamestate==2)
  {
    gamestate = 1;
  }
  
}

and why you do this ?


please format your code posting by pasting it into the

</> code button

of the editor header menu ( context name: Preformatted text )
it looks like
```
type or paste code here
```

also can use the ``` manually above and below your code.

thank you.


now we need you to REPAIR your above CODE POSTING,
not make a new / better post.
( just think about the hundred people opening your topic in the future )


I tried using the sound library and it didn’t work so I thought I would try the minim library too. Again, I am super new at using this programme.

better not mix it…
anyhow start from a existing example ( of one library )
change songs … operation … until it works like you need

and then build it into your game.

I got it to work! Thanks for your help!

1 Like