Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

music format for SL upload?

Michelle Culcomp
Registered User
Join date: 26 Aug 2005
Posts: 6
11-11-2005 15:19
hi,

i'm using garageband on my mac to create some sounds that i want to upload into secondlife. but i can't use the garageband format it seems in SL. what format do i need to convert my files to so that they work in SL?

thanks!!!
Laukosargas Svarog
Angel ?
Join date: 18 Aug 2004
Posts: 1,304
11-11-2005 15:22
Mono, 16 bit WAVE ( .wav ), 44100Hz

Each audio clip must be less than 10 seconds long or it won't upload.

To join them together you need a script.
Michelle Culcomp
Registered User
Join date: 26 Aug 2005
Posts: 6
11-11-2005 15:26
ah, ok cool. thanks so much!
ArchTx Edo
Mystic/Artist/Architect
Join date: 13 Feb 2005
Posts: 1,993
11-18-2005 08:46
From: Laukosargas Svarog
Mono, 16 bit WAVE ( .wav ), 44100Hz

Each audio clip must be less than 10 seconds long or it won't upload.

To join them together you need a script.


You can join them together?!?!?

Wow, that would be great. Do you possibly have a script example of how to do this that you could share? I have several musician friends that would love to be able to share thier music clips in SL.
_____________________

VRchitecture Model Homes at http://slurl.com/secondlife/Shona/60/220/30
http://www.slexchange.com/modules.php?name=Marketplace&MerchantID=2240
http://shop.onrez.com/Archtx_Edo
Thili Playfair
Registered User
Join date: 18 Aug 2004
Posts: 2,417
11-18-2005 09:03
one thats pretty much all over SL now, no you dont need to change anything on this script, just drop the wavs in a prim, drop the script touch it, will preload it, it loads files alphabetical or numerical, wav001, wav002 , abc bcd cde efg , ect,

Mono/stereo work, but stereo is a waste really, SL make music and it plays from your current position , and if someone stand to your right, it will be left on their speakers, ( if they face same way as you anyway )

It even works with hud, you you can make a row of buttons with diffrent sounds/music.

CODE
//By BuhBuhCuh
//modified by Psyke Phaeton in an attempt to stop skipping
//Drop 10 second song clips in reverse order into the Inv of the obect, and touch to play.

//user variables

integer waves_to_preload = 999; //wave files to Preload ahead of the wav being played.
integer preload_load_time = 1; // seconds pause between each preloaded wave file attempt b4 play comnences
vector set_text_colour = <1,0,0>; // colour of floating text label
float set_text_alpha = 1; //no idea what this is LOL

// program variables
list invlist;
integer total_wave_files; //number of wave files
integer last_wave_file_number; //final wave sequence number (note: sequence starts at zero
//- so this is 1 less than total wave files)
integer i; //used by timer() player
integer c; //user by sound() bufferer
string preloading_wave_name; //the name of the wave file being preloaded
string playing_wave_name; //the name of the wave being played
integer play = FALSE; //toggle for music playing or stopped

sound()
{
total_wave_files = llGetInventoryNumber(INVENTORY_SOUND);
last_wave_file_number = total_wave_files - 1; // because wav files are numbered from zero
float length = total_wave_files*9.0;
//llSay(0, "preloading " + (string)tottrack + " wavs. Play length " + (string)llFloor(length) + "secs");
integer c = 0;
//do full preload of sound
llSetSoundQueueing(TRUE); //ONLY WORKS ON llPlaySound not llTriggerSound
integer x = waves_to_preload;
if ( total_wave_files < waves_to_preload ) { x = total_wave_files; }
llSay(0, "(" + llGetScriptName() + ") " + (string)(x * preload_load_time) + " sec buffering..");
for (c = 0 ; c <= (x - 1) ; c++) { //preload X wave files b4 we play
//since wavs are numbered from 0 we minus 1
preloading_wave_name = llGetInventoryName(INVENTORY_SOUND, c);
llSetText(llGetObjectName() +
"\n(preloading " + (string)((x - c)* preload_load_time) + " secs)"
//////debug lines
//+ "\n--debug--\n"
//+ "Preload wav: " + (string)c
//+ " name: " + preloading_wave_name
//+ "\nkey: " + (string)llGetInventoryKey(preloading_wave_name)
//////end debug line
, set_text_colour, set_text_alpha);

//Attempt to preload first x wave files to local machines cache!
llTriggerSound(preloading_wave_name, 0.0);
llPreloadSound(preloading_wave_name);
//llWhisper(0, (string)c + " of " + (string)tottrack);
//llWhisper(0,"Preloading wav: " + (string)c + (string)llGetInventoryKey(preloading_wave_name));
llSleep(preload_load_time);
}
i=0; c=0;
llSay(0, "Done! Playing.. (" + (string)llFloor(length) + " secs) Click to stop.");
llSetTimerEvent(8.8);
}


default
{
on_rez(integer start_param)
{
//set text above object to the name of the object
llSetText(llGetObjectName(), set_text_colour, set_text_alpha);
llSetSoundQueueing(FALSE); //ONLY WORKS ON llPlaySound not llTriggerSound
}
touch_start(integer total_number)
{
if (!play) {
//llTargetOmega(<0,0,1>,PI,1.0) ;
sound();
} else {
//llTargetOmega(<0,0,1>,0,0);
llSetTimerEvent(0.0);
llStopSound();
llSetSoundQueueing(FALSE); //ONLY WORKS ON llPlaySound not llTriggerSound
llSay(0, "Stopping..");
llSetText(llGetObjectName(), set_text_colour, set_text_alpha);
}

play = !play;
}

timer()
{
if( i > last_wave_file_number )
{
//llSay(0, "finished.");
play = FALSE;
llSetSoundQueueing(FALSE); //ONLY WORKS ON llPlaySound not llTriggerSound
llSetText(llGetObjectName(), set_text_colour, set_text_alpha);
//llResetScript();
llSetTimerEvent(0);
}
else
{
playing_wave_name = llGetInventoryName(INVENTORY_SOUND, i);
//llWhisper(0, "llPlaySound wav: " + (string)i + " " + (string)llGetInventoryKey(playing_wave_name) );
llPlaySound(playing_wave_name, 0.7);
llSetText( llGetObjectName() +
"\n(playing " + (string)i +" of "+ (string)last_wave_file_number +")"
, set_text_colour, set_text_alpha);

if(i + waves_to_preload <= last_wave_file_number)
{
preloading_wave_name = llGetInventoryName(INVENTORY_SOUND, i + waves_to_preload);
//llSetText( llGetObjectName() +
// "\n(playing " + (string)i +" of "+ (string)last_wave_file_number +")"
//////debug line
//+ "\n--debug--\n"
//+ "Playing key: " + (string)llGetInventoryKey(playing_wave_name) + "\n"
//+ "Preloading sequence: " + (string)(i + waves_to_preload)
//+ " name: " + preloading_wave_name
//+ "\nPreloading key: " + (string)llGetInventoryKey(preloading_wave_name)
//////end debig line
// , set_text_colour, set_text_alpha);

//llWhisper(0, "Preloading wav:" + (string)(i + waves_to_preload) + " " +
// (string)llGetInventoryKey(preloading_wave_name) +" last = " + (string)last_wave_file_number);
llTriggerSound(llGetInventoryName(INVENTORY_SOUND, i + waves_to_preload), 0.0);
llPreloadSound(llGetInventoryName(INVENTORY_SOUND, i + waves_to_preload));
}
}

i++; //increment for next wave file in sequence!
}
}


Another one , much shorter, but you need to change the files to load in this one,

CODE

//----------------------------------
//I am freely distributing this script with only three conditions:
//1: Please do not change the name of the script
//2: Please do NOT try to sell this script individually(with music is OK)
//3: If you modify my script(within reason), please distribute it freely as well
//
//Just doing my part to improve SL's music community
//Archanox Underthorn
//-----------------------------------
string stringnum(integer number, integer digits)
{
string curstring = (string)number;

while(llStringLength(curstring) < digits)
{
curstring = "0" + curstring;
}

return curstring;
}

default
{
touch_start(integer total_number)
{


//----------------------------
//You only need to setup these 7 variables

//------------
//firstsongname is the text that comes before the file number and secondsongname is what comes after it
//put "" if either of them need to be blank
//REMEMBER to include .wav if its there
//i.e.- in Gorillaz001.wav:
//firstsongname is "Gorillaz" - secondsongname is ".wav"
//-------------
string firstsongname = "";
string secondsongname = " - Nine Inch Nails - Closer.wav";

//only change curfile if you want the song to start off on a specific file
integer curfile = 1;
//digits tells the script how many digit places the file numbering is
//i.e.- Gorillaz001.wav : there are 3 digits
integer digits = 2;

integer totalfiles = 38;
float volume = 2;

//---------------------------


llSetSoundQueueing(TRUE);
llPreloadSound(firstsongname + stringnum(1,digits) + secondsongname);
llPreloadSound(firstsongname + stringnum(2,digits) + secondsongname);
llSleep(10);

integer preloadfile = 3;

while(curfile <= totalfiles)
{
llPlaySound(firstsongname + stringnum(curfile,digits) + secondsongname, volume);
if(preloadfile <= totalfiles)
{
llPreloadSound(firstsongname + stringnum(preloadfile,digits) + secondsongname);
}
llSleep(9.7);
curfile += 1;
preloadfile += 1;
}
}

on_rez(integer param)
{
llResetScript();
}
}