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 42_minute_Music_Box  

42_minute_Music_Box

Sensor Script - Put this in a prim along with the Music script and as many 10 second sound clips as you want. This will detect any avatar coming nearby and trigger the music from the beginning. You can leave this script out and just use the music player. Start the music by touching the prim

Category: Music
By : Ferd Frederix
Created: 2012-10-09 Edited: 2015-04-27
Worlds: Second Life

the Zip file

Download all files for 42_minute_Music_Box
Contents are in zip format, with .LSL (text) source code and LSLEdit (text + Solution) formats.
Get file # 1. 42_minute_Music_Box.lsl
Get file # 2. authors.txt
Get file # 3. night_stream_sasquatch 1.wav
Get file # 4. night_stream_sasquatch 2.wav
Get file # 5. night_stream_sasquatch 3.wav
Get file # 6. ocean_waves_sasquatch 1.wav
Get file # 7. ocean_waves_sasquatch 2.wav
Get file # 8. ocean_waves_sasquatch 3.wav
Get file # 9. ocean_waves_sasquatch 4.wav
Get file # 10. ocean_waves_sasquatch 5.wav
Get file # 11. Optional Sensor.lsl
Get file # 12. remote slave script.lsl
Get file # 13. Jungle sound sequence 01.wav
Get file # 14. Jungle sound sequence 02.wav
Get file # 15. Jungle sound sequence 03.wav
Get file # 16. Jungle sound sequence 04.wav
Get file # 17. Jungle sound sequence 05.wav
Get file # 18. Jungle sound sequence 06.wav
Get file # 19. Jungle sound sequence 07.wav
Get file # 20. Jungle sound sequence 08.wav
Get file # 21. Jungle sound sequence 09.wav
Get file # 22. Jungle sound sequence 10.wav
Get file # 23. Jungle sound sequence 11.wav
Get file # 24. Jungle sound sequence 12.wav
Get file # 25. Jungle sound sequence 13.wav
Get file # 26. Jungle sound sequence 14.wav
Get file # 27. Jungle sound sequence 15.wav
Get file # 28. Jungle sound sequence 16.wav
Get file # 29. Jungle sound sequence 17.wav
Get file # 30. Jungle sound sequence 18.wav
Get file # 31. Jungle sound sequence 19.wav
Get file # 32. Jungle sound sequence 20.wav
Get file # 33. Jungle sound sequence 21.wav
Get file # 34. Jungle sound sequence 22.wav
Get file # 35. Jungle sound sequence 23.wav
Get file # 36. Jungle sound sequence 24.wav
Get file # 37. Jungle sound sequence 25.wav
Get file # 38. Jungle sound sequence 26.wav
Get file # 39. Jungle sound sequence 27.wav
Get file # 40. Jungle sound sequence 28.wav
Get file # 41. 03 Tropical Jungle 01.wav
Get file # 42. 03 Tropical Jungle 02.wav
Get file # 43. 03 Tropical Jungle 03.wav
Get file # 44. 03 Tropical Jungle 04.wav
Get file # 45. 03 Tropical Jungle 05.wav
Get file # 46. 03 Tropical Jungle 06.wav
Get file # 47. 03 Tropical Jungle 07.wav
Get file # 48. 03 Tropical Jungle 08.wav
Get file # 49. 03 Tropical Jungle 09.wav
Get file # 50. 03 Tropical Jungle 10.wav
Get file # 51. 03 Tropical Jungle 11.wav
Get file # 52. 03 Tropical Jungle 12.wav
Get file # 53. 03 Tropical Jungle 13.wav
Get file # 54. 03 Tropical Jungle 14.wav
Get file # 55. 03 Tropical Jungle 15.wav
Get file # 56. 03 Tropical Jungle 16.wav
Get file # 57. 03 Tropical Jungle 17.wav
Get file # 58. 03 Tropical Jungle 18.wav
Get file # 59. 03 Tropical Jungle 19.wav
Get file # 60. 03 Tropical Jungle 20.wav
Get file # 61. 03 Tropical Jungle 21.wav
Get file # 62. 03 Tropical Jungle 22.wav
Get file # 63. 03 Tropical Jungle 23.wav
Get file # 64. 03 Tropical Jungle 24.wav
Get file # 65. 03 Tropical Jungle 25.wav
Get file # 66. 03 Tropical Jungle 26.wav
Get file # 67. 03 Tropical Jungle 27.wav
Get file # 68. 03 Tropical Jungle 28.wav
Get file # 69. 03 Tropical Jungle 29.wav
Get file # 70. 03 Tropical Jungle 30.wav
Get file # 71. 03 Tropical Jungle 31.wav
Get file # 72. 03 Tropical Jungle 32.wav
Get file # 73. 03 Tropical Jungle 33.wav
Get file # 74. 03 Tropical Jungle 34.wav
Get file # 75. 03 Tropical Jungle 35.wav
Get file # 76. 03 Tropical Jungle 36.wav
Get file # 77. 03 Tropical Jungle 37.wav
Get file # 78. 03 Tropical Jungle 38.wav
Get file # 79. 03 Tropical Jungle 39.wav
Get file # 80. 03 Tropical Jungle 40.wav
Get file # 81. 03 Tropical Jungle 41.wav
Get file # 82. 03 Tropical Jungle 42.wav
Get file # 83. 03 Tropical Jungle 43.wav
Get file # 84. 03 Tropical Jungle 44.wav
Get file # 85. 03 Tropical Jungle 45.wav

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 // general purpose avatar sensor for the music playert
2 // When someone gets in range, this starts the music sequence if a HUD or if the player is in the same prim
3 // 10-09-2012 by Ferd Frederix
4 // Rev 1.3 - made it send the Play and Stop only once and not use a sensor.
5
6 // This work is licensed under a Creative Commons Attribution 3.0 Unported License.
7 // http://creativecommons.org/licenses/by/3.0/deed.en_US
8
9
10 // Tuneable thing:
11 float range = 5.0; // how far a avatar has to be before sound plays, in meters
12 float howoften = 5.0; // how often we look for avatars. Average time before it detects is half this. The longer you make this, the less lag it causes.
13 integer debugflag = FALSE;
14
15 // best to leave these bits alone
16
17
18 DEBUG (string msg)
19 {
20 if(debugflag) llOwnerSay(msg);
21 }
22
23 integer someoneWasListening = FALSE;
24
25 default
26 {
28 {
29 llSetTimerEvent(howoften );
30 }
31
32 timer()
33 {
34 integer someoneIsListening = llGetRegionAgentCount();
35
36 if(!someoneWasListening && someoneIsListening) {
37 someoneWasListening = TRUE;
38 llMessageLinked(LINK_SET,0,"play","");
39 return ;
40 }
41
42 if(someoneWasListening && !someoneIsListening) {
43 someoneWasListening = FALSE;
44 llMessageLinked(LINK_SET,0,"stop","");
45 }
46 }
47
48 changed(integer what)
49 {
50 if(what & CHANGED_REGION_START) {
52 }
53 }
54
56 {
58 }
59 }

42_minute_Music_Box

Music player script. Can play up to 254 9-second clips in sequence.
Trigger it with a link message, the sensor script, or touch the prim

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

42_minute_Music_Box

Music player slave script. Add sound clips just like the 42 minute prim has.
Put these about every 20-25 meters to spread sound through an entire region.
Add a channel number from Master script description in this prim's description.
Rev 1.2: added changed event, and the channel comes from the description.
Rev 1.3 added some diagbnostics and warnings about description and adding wav files.
This work is licensed under a Creative Commons Attribution 3.0 Unported License.
http://creativecommons.org/licenses/by/3.0/deed.en_US

Category: Music
By : Ferd Frederix
Created: 2012-10-09 Edited: 2015-04-27
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 {
13
14 if(total_wave_files == 0)
15 {
16 llOwnerSay("Add 9 second wav files to the prim and reset it");
17 return;
18 }
19
20
21 preloadchannel = (integer) llGetObjectDesc();
22 if(preloadchannel == 0) {
23 llOwnerSay("put the same number in the desription that you have in the Master prim and reset this script");
24 return;
25 }
26 playchannel = preloadchannel + 1;
27 llListen(preloadchannel,"","","");
28 llListen(playchannel,"","","");
29 llSetText("", <0,1,0>, 1.0);
30 }
31
32 listen(integer channel, string name, key id, string music)
33 {
34 if(channel == playchannel)
35 {
36 llSetText(music + "\n playing", <0,1,0>, text);
37 llPlaySound(music,1.0);
38 }
39 else
40 {
41 llSetText(music + "\npreloaded", <0,1,0>, text);
42 llPreloadSound(music);
43 }
44
45 }
46
47 changed(integer what)
48 {
49 if(what & CHANGED_INVENTORY)
51 }
52
53 on_rez(integer param)
54 {
56 }
57 }

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