# Sound objects and setVolume question

**URL:** <https://forum.kirupa.com/t/sound-objects-and-setvolume-question/8341>\
**Category:** Uncategorized\
**Created:** [November 19, 2002, 1:56am UTC](https://forum.kirupa.com/t/sound-objects-and-setvolume-question/8341 "2002-11-19T01:56:56Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dr\_ew](https://avatars.discourse-cdn.com/v4/letter/d/c89c15/32.png) [@dr\_ew](https://forum.kirupa.com/u/dr_ew)\
**Post date:** [November 19, 2002, 1:56am UTC](https://forum.kirupa.com/t/sound-objects-and-setvolume-question/8341/1 "2002-11-19T01:56:56Z")

</div>

Hi,  
I am trying to make a beat machine for a school project. It consists of 5 movie clip animations, controlled by buttons (on/off…)  
I have 5 tracks of music loops, which i want to sync up, and then have each of the movie clip buttons control the volume of each respective track. (so that pressing the button will result in 1 of the 5 track’s volume to be 100, or 0) That way, the tracks will never come un-synced, but will give the sense of turning the individual tracks on or off. I know that I must define the sound objects like so:

s1 = new Sound();  
s1.attachSound(“drum1”);  
s1.start();

for each sound.

Where should this code go? and how do I make each button setVolume for each particular audio track?

I’ve been reading lots of stuff, but I am still really confused. Does anyone have any suggestions that might help me out?  
Thanks very much!🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 19, 2002, 2:37am UTC](https://forum.kirupa.com/t/sound-objects-and-setvolume-question/8341/2 "2002-11-19T02:37:40Z")

</div>

well, as for volume, just use:

s1.setVolume(value between 0 and 100);

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 19, 2002, 3:41am UTC](https://forum.kirupa.com/t/sound-objects-and-setvolume-question/8341/3 "2002-11-19T03:41:48Z")

</div>

Ok, thanks for the reply. I’m still having many troubles separating the tracks in terms of volume control. But at least I have buttons activating sound tracks now at least… the problem is all the buttons are controlling the volume for all of the tracks…Here is what I have so far:

sound objects s1 thru s5:

s1 = new Sound();  
s1.attachSound(“drum1”);  
s1.start(0,99999);

then at the end:

s1.setVolume(o);

on the button which is supposed to control s1: (each button is in a movie clip, so \_root…)

on (press) {  
\_root.s1.setVolume(10o)(“drum1”);

and another button that sets volume back to 0.

So…I thought that by specifying the actual sound export instance “drum1” it would not act globally…I am so very wrong, hehe.  
Any idea why? or better yet, how to isolate the sound clips in terms of volume control?  
I could post my fla, but I must warn that the sound clips are wickid huge.

Thanks a lot!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 19, 2002, 8:27pm UTC](https://forum.kirupa.com/t/sound-objects-and-setvolume-question/8341/4 "2002-11-19T20:27:07Z")

</div>

Well, I’ve managed to isolate the tracks, but I am no longer using setVolume, i just have it set to play true or false. While this is good for sounds that aren’t synced up rhythmically, it kinda sux for syncing up tracks, like I originally wanted to. If anyone has any suggestions, I would love to hear it!  
Thanks lots!
