Join us in Outworldz at www.outworldz.com:9000 or follow us:

Search dozens of selected web sites for OpenSim and LSL script

New! Script Meta-Search will search thousands of scripts here and at other sites for LSL or Opensim scripts.
Loading

Want to add a script or a project? Upload it and a half million people will see it and your name here this year.

Home   Show All
Category: Contributor: Creator
Music Radio Buttoned Sound Player  

Radio Buttoned Sound Player

Music player for radios or paianos with multupole buttons and sounds..
Can play many 9-second clips in sequence.
Put this script in multile proims., Each prim gets unique wav files. Click a prim to play a music clip.
************************************************************************************
You MUST add a channel number unique to the music in this prim to the description to use with the slave script..
You can use as many slave scripts in a region as you like. Change the channel number
to play more than one sound.
************************************************************************************

Category: Music
By : Ferd Frederix
Created: 2014-09-08 Edited: 2014-09-24
Worlds: Second Life

the Zip file

Download all files for Radio Buttoned Sound Player
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. [146421 bytes] photo.jpg
Get file # 2. Master.lsl
Get file # 3. Master.lsl
Get file # 4. Slave Script.lsl
Get file # 5. stop button.lsl

This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1 // Rev 1.1: 09-18-2014 used llTriggerSOund instead of llPlaySOund for skipping in Firestorm
2
3 // May be triggered to run continually, start it by touching it or use the sensor script when someone gets nearby.
4
5 // This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
6 // http://creativecommons.org/licenses/by-nc/3.0/deed.en_US
7 // This script cannot be sold even as part of another object, it must always remain free and fully modifiable.
8
9 // 10-09-2012 first released by Ferd Frederix
10 // 01-05-2014 ev 1.1 change order of vars and set it to 9.0 seconds length files. added touch on/offRT
11 // 9-27-2014 Rev 1.2 optimized for Opensim
12 //
13 // Drop 9 second song clips in the inventory of the obect, and touch to play. You an set the lenngth in timer_interval variable.
14 // 9 seems to work well.
15 // A great free tool to make these files is the slice audio file splitter at http://www.nch.com.au/splitter/index.html
16 // Set the variable loop = TRUE to loop after reaching the end, set it to FALSE to play once.
17
18 // Scriptable Control:
19 // Send a link message string of 'play' and 'stop' for use with external control scripts.
20 // Or just touch the prim to play
21
22
23 // tunable bumbers follow:
24 integer debugflag = FALSE; // chat debug info to owner if TRUE
25 float timer_interval = 8.9; // how long you sliced your wave files, must be less than 10. 9.0 is typical.
26 float set_text_alpha = 1; //Set this to 0 to disable hovertext the text transparency fo alpha text.
27 integer play_at_master = TRUE; // if TRUE, the master will play sounds, too. Set to FALSE and the Master will only broadcast to slaves.
28 float VOLUME = 1.0; // 1.0 = full volume
29
30 // Stuff that you should not mess with:
31
32 integer preloadchannel ;
33 integer playchannel ;
34
35 integer running = TRUE; // flag to say we are on
36 vector set_text_colour = <1,1,1>; // colour of floating text label ( white)
37
38
39 integer total_wave_files; // number of wave files
40 integer i_playcounter; // used by timer() player
41
42
43 DEBUG (string msg)
44 {
45 if(debugflag) llSay(0,msg);
46 }
47
48
49 go(integer play) {
50
51 if(play)
52 {
53 Preload();
54 llSetTimerEvent(timer_interval);
55 running = TRUE;
56 llSetColor(<0,1,0>,ALL_SIDES);
57 } else {
59 running = FALSE;
60 llSetTimerEvent(0.0);
61 //llStopSound();
62 DEBUG("Stopped");
63 llSetText(llGetInventoryName(INVENTORY_SOUND,0), <0,1,0>, set_text_alpha);
64
65 llSetColor(<0,0,1>,ALL_SIDES);
66 }
67 }
68
69
70
71 Preload()
72 {
73 string preloading_wave_name = llGetInventoryName(INVENTORY_SOUND, i_playcounter);
74
75 llRegionSay(preloadchannel,preloading_wave_name); // tell slaves to preload a file
76 DEBUG("Preloading wav: " + (string)i_playcounter + " " + (string) preloading_wave_name);
77 llSetTimerEvent(2.0);
78 // start playing
79 }
80
81 Loadnext()
82 {
83
84 i_playcounter ++;
85 if(i_playcounter >= total_wave_files)
86 i_playcounter = 0;
87
88 integer next = i_playcounter +1;
89 if(next > total_wave_files)
90 next = 0;
91
92 string preloading_wave_name = llGetInventoryName(INVENTORY_SOUND, i_playcounter);
93
94 llRegionSay(preloadchannel,preloading_wave_name); // tell slaves to preload a file
95 DEBUG("Preloading wav: " + (string)i_playcounter + " " + (string) preloading_wave_name);
96 llSetTimerEvent(timer_interval);
97 }
98
99 default
100 {
102 {
103 llMessageLinked(LINK_SET,0,"stop","");
104 total_wave_files = llGetInventoryNumber(INVENTORY_SOUND);
105 llSetSoundQueueing(TRUE); // only works on llPlaySound not llTriggerSound, so we can queue these silently
106 preloadchannel = (integer) llGetObjectDesc();
107 playchannel = preloadchannel +1;
108 //set text above object to the name of the object
109 llSetText(llGetInventoryName(INVENTORY_SOUND,0), <0,1,0>, set_text_alpha);
110 go(TRUE);
111 }
112
113 touch_start(integer total_number)
114 {
115 if(!running) {
116 llMessageLinked(LINK_SET,0,"stop","");
117 llSetText("Starting\n" + llGetInventoryName(INVENTORY_SOUND,0), <0,1,0>, set_text_alpha);
118 go(TRUE);
119 } else {
120 go(FALSE);
121 }
122 }
123
124 timer()
125 {
126 string playing_wave_name = llGetInventoryName(INVENTORY_SOUND, i_playcounter);
127 DEBUG("llPlaySound wav: " + (string)i_playcounter + " " + playing_wave_name );
128
129 llRegionSay(playchannel,playing_wave_name); // tell slaves to play a file
130 if(play_at_master)
131 llTriggerSound(playing_wave_name,VOLUME);
132
133
134
135 string toplay = llGetInventoryName(INVENTORY_SOUND, i_playcounter );
136 llSetText(toplay + "\n"
137 +"Playing " + (string)(i_playcounter +1)
138 + " of " + (string)(total_wave_files) , set_text_colour, set_text_alpha);
139
140 DEBUG("Playing wav:"
141 + (string)(i_playcounter )
142 + ":"
143 + (string) toplay);
144
145
146 Loadnext();
147 }
148
149 link_message(integer sender_number, integer number, string message, key id)
150 {
151 DEBUG("Sender num " + (string) sender_number);
152 DEBUG("Link num " + (string) llGetLinkNumber());
153 if(sender_number == llGetLinkNumber())
154 return;
155
156 if(message == "play")
157 {
158 go(TRUE);
159 }
160 else if(message == "stop")
161 {
162 go(FALSE);
163 }
164 }
165
166 on_rez(integer param)
167 {
169 }
170 }

Radio Buttoned Sound Player

A multi-selection Music Player for long lengths of music

Category: Music
By : Ferd Frederix
Created: 2014-09-08 Edited: 2014-09-24
Worlds: Second Life


This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1
2
3 default
4 {
5
6
7 touch_start(integer total_number)
8 {
9
10 llMessageLinked(LINK_SET,0,"stop","");
11
12 }
13
14 }

Radio Buttoned Sound Player

Music player for radios or paianos with multupole buttons and sounds..
Can play many 9-second clips in sequence.
Put this script in multile proims., Each prim gets unique wav files. Click a prim to play a music clip.
************************************************************************************
You MUST add a channel number unique to the music in this prim to the description to use with the slave script..
You can use as many slave scripts in a region as you like. Change the channel number
to play more than one sound.
************************************************************************************

Category: Music
By : Ferd Frederix
Created: 2014-09-08 Edited: 2014-09-24
Worlds: Second Life


This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1 // May be triggered to run continually, start it by touching it or use the sensor script when someone gets nearby.
2
3 // This work is licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.
4 // http://creativecommons.org/licenses/by-nc/3.0/deed.en_US
5 // This script cannot be sold even as part of another object, it must always remain free and fully modifiable.
6
7 // 10-09-2012 first released by Ferd Frederix
8 // 01-05-2014 ev 1.1 change order of vars and set it to 9.0 seconds length files. added touch on/offRT
9 // 9-27-2014 Rev 1.2 optimized for Opensim
10 //
11 // Drop 9 second song clips in the inventory of the obect, and touch to play. You an set the lenngth in timer_interval variable.
12 // 9 seems to work well.
13 // A great free tool to make these files is the slice audio file splitter at http://www.nch.com.au/splitter/index.html
14 // Set the variable loop = TRUE to loop after reaching the end, set it to FALSE to play once.
15
16 // Scriptable Control:
17 // Send a link message string of 'play' and 'stop' for use with external control scripts.
18 // Or just touch the prim to play
19
20
21 // tunable bumbers follow:
22 integer debugflag = FALSE; // chat debug info to owner if TRUE
23 float timer_interval = 8.9; // how long you sliced your wave files, must be less than 10. 9.0 is typical.
24 float set_text_alpha = 1; //Set this to 0 to disable hovertext the text transparency fo alpha text.
25 integer play_at_master = TRUE; // if TRUE, the master will play sounds, too. Set to FALSE and the Master will only broadcast to slaves.
26 float VOLUME = 1.0; // 1.0 = full volume
27
28 // Stuff that you should not mess with:
29
30 integer preloadchannel ;
31 integer playchannel ;
32
33 integer running = TRUE; // flag to say we are on
34 vector set_text_colour = <1,1,1>; // colour of floating text label ( white)
35
36
37 integer total_wave_files; // number of wave files
38 integer i_playcounter; // used by timer() player
39
40
41 DEBUG (string msg)
42 {
43 if(debugflag) llSay(0,msg);
44 }
45
46
47 go(integer play) {
48
49 if(play)
50 {
51 Preload();
52 llSetTimerEvent(timer_interval);
53 running = TRUE;
54 llSetColor(<0,1,0>,ALL_SIDES);
55 } else {
57 running = FALSE;
58 llSetTimerEvent(0.0);
59 //llStopSound();
60 DEBUG("Stopped");
61 llSetText(llGetInventoryName(INVENTORY_SOUND,0), <0,1,0>, set_text_alpha);
62
63 llSetColor(<0,0,1>,ALL_SIDES);
64 }
65 }
66
67
68
69 Preload()
70 {
71 string preloading_wave_name = llGetInventoryName(INVENTORY_SOUND, i_playcounter);
72
73 llRegionSay(preloadchannel,preloading_wave_name); // tell slaves to preload a file
74 DEBUG("Preloading wav: " + (string)i_playcounter + " " + (string) preloading_wave_name);
75 llSetTimerEvent(2.0);
76 // start playing
77 }
78
79 Loadnext()
80 {
81
82 i_playcounter ++;
83 if(i_playcounter >= total_wave_files)
84 i_playcounter = 0;
85
86 integer next = i_playcounter +1;
87 if(next > total_wave_files)
88 next = 0;
89
90 string preloading_wave_name = llGetInventoryName(INVENTORY_SOUND, i_playcounter);
91
92 llRegionSay(preloadchannel,preloading_wave_name); // tell slaves to preload a file
93 DEBUG("Preloading wav: " + (string)i_playcounter + " " + (string) preloading_wave_name);
94 llSetTimerEvent(timer_interval);
95 }
96
97 default
98 {
100 {
101 llMessageLinked(LINK_SET,0,"stop","");
102 total_wave_files = llGetInventoryNumber(INVENTORY_SOUND);
103 llSetSoundQueueing(TRUE); // only works on llPlaySound not llTriggerSound, so we can queue these silently
104 preloadchannel = (integer) llGetObjectDesc();
105 playchannel = preloadchannel +1;
106 //set text above object to the name of the object
107 llSetText(llGetInventoryName(INVENTORY_SOUND,0), <0,1,0>, set_text_alpha);
108 go(TRUE);
109 }
110
111 touch_start(integer total_number)
112 {
113 if(!running) {
114 llMessageLinked(LINK_SET,0,"stop","");
115 llSetText("Starting\n" + llGetInventoryName(INVENTORY_SOUND,0), <0,1,0>, set_text_alpha);
116 go(TRUE);
117 } else {
118 go(FALSE);
119 }
120 }
121
122 timer()
123 {
124 string playing_wave_name = llGetInventoryName(INVENTORY_SOUND, i_playcounter);
125 DEBUG("llPlaySound wav: " + (string)i_playcounter + " " + playing_wave_name );
126
127 llRegionSay(playchannel,playing_wave_name); // tell slaves to play a file
128 if(play_at_master)
129 llPlaySound(playing_wave_name,VOLUME);
130
131
132
133 string toplay = llGetInventoryName(INVENTORY_SOUND, i_playcounter );
134 llSetText(toplay + "\n"
135 +"Playing " + (string)(i_playcounter +1)
136 + " of " + (string)(total_wave_files) , set_text_colour, set_text_alpha);
137
138 DEBUG("Playing wav:"
139 + (string)(i_playcounter )
140 + ":"
141 + (string) toplay);
142
143
144 Loadnext();
145 }
146
147 link_message(integer sender_number, integer number, string message, key id)
148 {
149 DEBUG("Sender num " + (string) sender_number);
150 DEBUG("Link num " + (string) llGetLinkNumber());
151 if(sender_number == llGetLinkNumber())
152 return;
153
154 if(message == "play")
155 {
156 go(TRUE);
157 }
158 else if(message == "stop")
159 {
160 go(FALSE);
161 }
162 }
163
164 on_rez(integer param)
165 {
167 }
168 }

Radio Buttoned Sound Player

Radio/Music player slave script. Add the sound clips the same as in the master(s).
Put these about every 20-25 meters to spread sound through an entire region.
************************************************************************************
You MUST add a channel number unique to the music in this prim to the description.
IT MUST match thje Master player(s)
************************************************************************************

Category: Music
By : Ferd Frederix
Created: 2014-09-08 Edited: 2014-09-24
Worlds: Second Life


This script by Ferd Frederix may be used in any manner, modified, and republished.  Unless specified otherwise, my scripts are always free and open source.  Objects made with these scripts may be sold with no restrictions.  All I ask is that you point others to this location should they ask you about it and to not sell this script, unless it is for $0 L. Please help improve my work by reporting bugs and improvements.

1
2
3 integer preloadchannel ;
4 integer playchannel ;
5 float text = 1.0; // set too to see debug title text
6
7 default
8 {
9
11 {
12 preloadchannel = (integer) llGetObjectDesc();
13 playchannel = preloadchannel + 1;
14 llListen(preloadchannel,"","","");
15 llListen(playchannel,"","","");
16 llSetText("", <0,1,0>, 1.0);
17 }
18
19 listen(integer channel, string name, key id, string music)
20 {
21 if(channel == playchannel)
22 {
23 llSetText(music + "\n playing", <0,1,0>, text);
24 llPlaySound(music,1.0);
25
26 }
27 else
28 {
29 llSetText(music + "\npreloaded", <0,1,0>, text);
30 llPreloadSound(music);
31 }
32
33 }
34
35 changed(integer what)
36 {
37 if(what & CHANGED_INVENTORY)
39 }
40
41 on_rez(integer param)
42 {
44 }
45 }

Back to the Best Free Tools in Second Life and OpenSim.