# Music is not stopping

**URL:** https://discourse.processing.org/t/music-is-not-stopping/29415
**Category:** Coding Questions
**Tags:** homework
**Created:** [April 16, 2021, 4:48pm UTC](https://discourse.processing.org/t/music-is-not-stopping/29415 "2021-04-16T16:48:46Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Mert](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@Mert](https://discourse.processing.org/u/Mert)
#### Post date: [April 16, 2021, 4:48pm UTC](https://discourse.processing.org/t/music-is-not-stopping/29415/1 "2021-04-16T16:48:46Z")

</div>

Hello everyone I added to music on my code but even if I stop playing music continue to play just wtf how can I solve that problem here is my alllllll code:

int rad = 200; // Boyut  
float xpos, ypos; // Başlayacağı yer

float xspeed = 2.8; // Hızı  
float yspeed = 2.2; // Hızı

int xdirection = 1; // Sağ or sol  
int ydirection = 1; // Aşağıdan Yukarıya

int opacity = 0;

int direction = 1;

PFont f;

MRect r3, r4;

import processing.video.\*; // Arka plan videom

Movie video;  
String[] headlines = { // Aşağıdan yukarıya yazı  
“LOOK”,  
“MORE”,  
“CLOSELY”  
};  
float x;  
float y;  
int index = 0;

import processing.sound.\*;

SoundFile file;

void setup() {  
size(700, 1000);  
video = new Movie(this, “myvideo.mp4”); //videom  
video.loop();  
video.speed(1); //video hızı

y = height;  
noStroke();  
frameRate(60); //fps  
ellipseMode(RADIUS);

// Başlangıç noktası  
xpos = width/2;  
ypos = height/2;  
smooth();  
file = new SoundFile(this, “technoposter.mp3”);  
file.play();

r3 = new MRect(2, 58.0, 0.332, 0.4_height, 10.0, 35.0); //mouse imleciyle gözüken rectler  
r4 = new MRect(1, 120.0, 0.0498, 0.9_height, 15.0, 60.0);

}

void movieEvent(Movie video) { //videom  
video.read();

}  
void draw() {  
noCursor(); // düzeni bozmasın diye imleci kapattım fakat mouse ile rectleri oynatabilirsiniz.  
background(0);  
image(video, 0, 0);

opacity += 2 \* direction;  
if ((opacity \< 0) || (opacity \> 255)) {

```
direction = -direction;

```

}  
fill(255, opacity);  
textSize(300);  
text(“FOCUS”, 340, 900); //textim

r3.display();  
r4.display();

r3.move(mouseX/4, mouseY-(height\*0.025), 40);  
r4.move(mouseX-(width/2), (height-mouseY), 50);

xpos = xpos + ( xspeed \* xdirection );  
ypos = ypos + ( yspeed \* ydirection );

if (xpos \> width-rad || xpos \< rad) {  
xdirection \*= -1;  
}  
if (ypos \> height-rad || ypos \< rad) {  
ydirection \*= -1;  
}

fill(255);  
//text((mouseX + “,” + mouseY), 13,13); //kordinat anlama kodum

fill( random(255), random(255), random(255), random(255)); // arka planda oynayan textlerin renkleri  
text(headlines[index],350,y);

y = y - 5;

float w = textWidth(headlines[index]);  
if (y \< -w) {  
y = width;  
index = (index + 1) % headlines.length;  
}

fill(255);  
ellipse(xpos, ypos, rad, rad); // hareketli ellipse  
f = createFont(“BebasNeue-Regular.ttf”, 32); //fontum  
textFont(f);  
float x = 546;  
float y = 350;  
textAlign(CENTER,BOTTOM);

pushMatrix();  
translate(x,y);  
rotate(-HALF\_PI);

fill(0, opacity);  
textSize(100);  
text(“HIDDEN IDEA”,0,0);  
popMatrix();

textSize(30);  
fill(255);  
text(“just look more carefully”, 350, 990);  
textSize(30);  
fill(255);  
text(“Interactive Poster”, 110, 50);

}

class MRect  
{  
int w;  
float xpos;  
float h;  
float ypos ;  
float d;  
float t;

MRect(int iw, float ixp, float ih, float iyp, float id, float it) {  
w = iw;  
xpos = ixp;  
h = ih;  
ypos = iyp;  
d = id;  
t = it;  
}

void move (float posX, float posY, float damping) {  
float dif = ypos - posY;  
if (abs(dif) \> 1) {  
ypos -= dif/damping;  
}  
dif = xpos - posX;  
if (abs(dif) \> 1) {  
xpos -= dif/damping;  
}  
}

void display() {  
for (int i=0; i\<t; i++) {  
rect(xpos+(i\*(d+w)), ypos, w, height\*h);  
}  
}  
}

void keyPressed() {

// Saves a TIFF file named “merterarslan.tif”  
save(“merterarslan.tif”);

}

---

<div class="post-metadata">

### Author: ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)
#### Post date: [April 16, 2021, 6:18pm UTC](https://discourse.processing.org/t/music-is-not-stopping/29415/2 "2021-04-16T18:18:38Z")

</div>

Hi! Please format your code with `</>` button!

Also please mind the language as you’re not texting your friend but here it’s a public forum 🙂
