Jump to content

Problems system reading sound files


VirtualKitten
 Share

You are about to reply to a thread that has been inactive for 1311 days.

Please take a moment to consider if this thread is worth bumping.

Recommended Posts

Hi everyone my sound system worked well until added [123] etc for bpm on the file name as songname [bpm]-01 now the files do not sort in order  an do not play reporting an error stating they cannot be found presumable as the Sound system cannot read items out of order . I really wanted the bpm on and tried songname -01 [bpm] which failed even more as it could not locate he song with somethng on the end of the song name has anyone come across this as I am starting to believe I have to create more storage with this in  a note card as nothing seems to work adding this to file names.

I think the problem is the preloaded  as in here 

 for( c = 0; c < total; c ++) {
        //llOwnerSay("Starting preload total lines :"+(string)total);
        preloading_wave_name  = llGetSubString(_llGetPlayListItem(PLAYLIST_NAME,  c),0,llSubStringIndex(_llGetPlayListItem(PLAYLIST_NAME,  c),")"));
        //llOwnerSay("Preloading : " +preloading_wave_name);
        llSetText(llGetObjectName() + 
                    "\n(preloading " + llGetSubString((string)((total - c)*preload_load_time),0,3) + " secs)" 
                        +"\n.", <1,0,0>, set_text_alpha);

            //Attempt to preload first x wave files to local machines cache!                                              
            llTriggerSound(_llGetPlayListItem(PLAYLIST_NAME,  c), 0.0);
            llPreloadSound(_llGetPlayListItem(PLAYLIST_NAME,  c));
            //start play sound timer in 'timer_interval' seconds when we are less than 'timer_interval' seconds from
            // finishing preloading. 
            if ( ((total_wave_files - c) * preload_load_time) < timer_interval && !timer_started) { 
                //llWhisper(0, "Starting timer:" + (string)timer_interval);
                llSetTimerEvent(timer_interval);
                timer_started = TRUE;
            }
            
            llSleep(preload_load_time);
        }
        i=0; c=0;

 

 

and or in timer here

            if(i + waves_to_preload <= last_wave_file_number)  
            {
                preloading_wave_name = _llGetPlayListItem(PLAYLIST_NAME,  i + waves_to_preload);
                 llTriggerSound(_llGetPlayListItem(PLAYLIST_NAME,  i + waves_to_preload), 0.0);
                 llPreloadSound(_llGetPlayListItem(PLAYLIST_NAME, i + waves_to_preload));
            } 

 

Is there something i am missing or have i really got to waste more storage?

Link to comment
Share on other sites

Thanks @Fritigern GothlyThe list is only imports  15 lines before giving this message   the lines only contain () and tab 09 character  as well as text which is song name number with  (Piano Arrangement)-0 after it  then tab 09 and then a number.

I really am unsure why the sound system will only work with soundname-01  etc to soundname-255. IT seems to sort differently if you introduce soundname[074]-01 or if you use songname -01  [074] it states it cant find the file name  songname -01  [074] as an error

 

Link to comment
Share on other sites

It is possible that your script was saved as LSL2, try saving it as Mono if possible, this should give your script access to more memory.

P.S. It can be helpful to mention that you are using Psyke's Music Script 

From http://forums-archive.secondlife.com/15/67/10576/1.html

//Modified by Psyke Phaeton... this script is free for anyone to use or copy.. please make it copyable from your "CD"

//Drop 9 second song clips in reverse order into the Inv of the obect, and touch to play.

//user variables

integer waves_to_preload = 3;       //wave files to Preload ahead of the wav being played.
float preload_load_time = 0.5;     // seconds pause between each preloaded wave file attempt b4 play comnences
//vector set_text_colour = <,0,0>;   // colour of floating text label
float set_text_alpha = 1;           //no idea what this is LOL
float timer_interval = 8.9;        //time interval between requesting server to play the next 9 second wave
                                    //   times just below 9 seconds are suitable as we use sound queueing
integer timer_started;

// 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; }
        ////////////////
        integer x = total_wave_files;
        llSay(0, "(" + llGetScriptName() + ") " + llGetSubString((string)(x * preload_load_time),0,3) + " sec buffering..");
        timer_started = FALSE;
        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 " + llGetSubString((string)((x - c)*preload_load_time),0,3) + " secs)" 
                    //////debug lines
                    //+ "\n--debug--\n"
                    //+ "Preload wav: " + (string)c 
                    //+ " name: " + preloading_wave_name 
                    //+ "\nkey: " + (string)llGetInventoryKey(preloading_wave_name)
                    //////end debug line
                        +"\n.", <1,0,0>, 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));
            
            //start play sound timer in 'timer_interval' seconds when we are less than 'timer_interval' seconds from
            // finishing preloading. 
            if ( ((total_wave_files - c) * preload_load_time) < timer_interval && !timer_started) { 
                //llWhisper(0, "Starting timer:" + (string)timer_interval);
                llSetTimerEvent(timer_interval);
                timer_started = TRUE;
            }
            
            llSleep(preload_load_time);
        }
        i=0; c=0;
        llSay(0, "Done! Playing..  (" + (string)llFloor(length) + " secs) Click to stop.");
        //llSetTimerEvent(8.85); 
}

default
{
    on_rez(integer start_param)
    {
        //set text above object to the name of the object
        llSetText(llGetObjectName() + "\n.", <0,1,0>, 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() + "\n.", <0,1,0>, 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() + "\n.", <0,1,0>, 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 +")\n."
                            , <0,1,1>, 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!
    }
}

 

Edited by Fritigern Gothly
Link to comment
Share on other sites

If you’re getting Stack Heap Overflow, you need to pinpoint where that occurs within the script.

Add an llOwnerSay() as the first line of every event that will say the name of the event.  Also add them to any user function, and at the beginning of every loop, right after the “for”, “do” or “while” line.

if you add those everywhere, you’ll see in chat where the script was when it crashed. Insert more detailed llOwnerSays which output variables or llDumpListToString() if there’s a list.  After the next crash, you should know exactly the cause.

Link to comment
Share on other sites

I placed  a check on it and it stopped after 15 giving the error . It was llownersay each line it obtained  printing it to screen. There is no difference in the note card lines as the notecard  was calculated by a computer system MixMister to obtain BPM and exported by txt . This was taken into MS Excel to remove the columns not required and saved as tab delimited text . Line 15 is no different to line in front of it so am I am clueless why it fails.

 

Link to comment
Share on other sites

@Qie Niangao Thanks for your message and your offer to help.

You have the script above for playing which fails i believe because of naming expectation in PlaySound and Preload which only seems to function with sequential sound names  sound-01 ... sound -10.  It cannot seem to work were sound [067]-01 or sound -01 [0607] is used as name   either sound [067]-01,sound [057]-02, sound[038]-03 ... sound[026]-10 or .either sound-01 [067],sound -02 [057], sound-03 [038] ... sound-10 [026] only sound-01 , sound-02, sound-03 ... sound-10.  Seems to work well  but you cannot add anything to the song names to store data . I was left to try load this is in note card.

The note code routines are standard I my code and have not failed before :

 

Code:

note_card_finished(string card)
{
     //So next card or something with data
    
      if(card =="") llOwnerSay("No Card Loaded");
      llOwnerSay("1 of 1 Reading .." + card);
      if(card == "songs_bpm") {
         bpmList = gCard_Lines_Temp;
           gCard_Lines_Temp =[];

       }
}     

GetNotecard(string notecard, integer notify) // Get the notecard's name, if present
{
    gStrNotecard = "";
    iLine = 0;
    integer iNoteLine = 0;
    kQuery = NULL_KEY;
   // llOwnerSay("Reading Notecard: " + notecard);
    integer intNoteCount =  llGetInventoryNumber(INVENTORY_NOTECARD); // Check if there is a notecard to begin with
     if (intNoteCount)
     {  
        iNoteLine=-1;
        do 
           gStrNotecard = llGetInventoryName(INVENTORY_NOTECARD, iNoteLine ++);
        while((gStrNotecard !=  notecard) && iNoteLine <= intNoteCount); 
        if(_debug) llOwnerSay("(DEBUG) Line Count "+ (string)iNoteLine + ", NoteCard Name '" + gStrNotecard + "' @ line: "+(string)iLine);
        kQuery = llGetNotecardLine(notecard ,iLine);
     } else llOwnerSay("NOTECARD NOT FOUND: " + notecard);   
         
}

 

 

 

 

default()

{

    state_entry()
    {

        gCard_Lines_Temp=[];
        GetNotecard("songs_bpm", TRUE);

    }

    dataserver(key _QueryId, string _data)
    {
      
        if(_QueryId  == owner_name_query ) {
            // if(_debug) llOwnerSay(response);
              owner_display_name = _data;
         }
        if( kQuery == NULL_KEY) llOwnerSay("The Notecard '" + gStrNotecard  + "' Could not be read . This could be beacuse of privaliges.");
        if(_QueryId == kQuery) 
        {
  
            if(_data != EOF) {
               if ((llGetSubString(_data, 0, 1) != "!#") || (_data == "")) // Check if the line should be skipped
               {
                    integer hashIndex = llSubStringIndex(_data,"#")+1;
                    integer length = llStringLength(_data)-1;
                    gCard_Lines_Temp += llGetSubString(_data,hashIndex,length);
                    /*if(_debug )*/llOwnerSay("(DEBUG) Line : " + (string)iLine + ", DATA " +llGetSubString(_data,hashIndex,length));
               }
              
               ++iLine; // Increment the line no.
               kQuery = llGetNotecardLine(gStrNotecard ,iLine);
             
            }  else {
                  if(_debug )llOwnerSay("(DEBUG) End of notecard '" + gStrNotecard +"' reached. "+ (string)iLine + " items read...");
                   note_card_finished(gStrNotecard);
                   return; // Nothing more to be done; exit the event
            
            }
    } 
 }

}

Link to comment
Share on other sites

Okay, so the dataserver() code didn't go as far as I expected in parsing the notecard line strings, rather just appending them to the gCard_Lines_Temp list of strings. Somewhere there's other code that parses the data elements out of those strings, presumably into a strided list that's eventually sorted by bpm (or something). Based on that last post, I'm guessing that there's something about the "[" and/or "]" characters that's confusing that parse.

Meanwhile, here's a simpler version of GetNotecard() preserving the same argumentation (although, as in the original, the notify parameter is unused)

GetNotecard(string notecard, integer notify) // Get the notecard's name, if present
{
    if (INVENTORY_NOTECARD != llGetInventoryType(notecard))
        llOwnerSay("NOTECARD NOT FOUND: " + notecard);
    else
        kQuery = llGetNotecardLine(gStrNotecard = notecard, iLine = 0);
}

 

Link to comment
Share on other sites

Um

@Qie NiangaoYour GetNotecard does not seem do the same thing :) I really don't understand what you mean by that am i missing something as yours does not compile the lines to a list at all. I am unsure why "[" and/or "]" would be troublesome as his is grammatical in English language . A simple search did not throw up any exceptions of using  the "[" and/or "]" characters.

Edited by VirtualKitten
Link to comment
Share on other sites

Well, no, it's the dataserver() handler that builds a list of strings containing notecard lines (removing lines starting with "!#" and parts of lines preceding a "#").

The original GetNotecard looks through the notecards in inventory (indexed by the variable confusingly named "iNoteLine") for one that matches the notecard argument value, then reads the 0th line from it, and sets a couple global variables used in dataserver() to read the next line.

  • Thanks 1
Link to comment
Share on other sites

@Qie Niangao Oh lord it now gets to 8 loaded not 15 . I substituted your simpler GetNotecard  ()

[08:28] PS 1.06: (DEBUG) Line : 0, DATA Candle in the wind (Piano Arrangement)-01        98.44
[08:28] PS 1.06: (DEBUG) Line : 1, DATA Candle in the wind (Piano Arrangement)-02        97.51
[08:28] PS 1.06: (DEBUG) Line : 2, DATA Candle in the wind (Piano Arrangement)-03        91.74
[08:28] PS 1.06: (DEBUG) Line : 3, DATA Candle in the wind (Piano Arrangement)-04        99.39
[08:28] PS 1.06: (DEBUG) Line : 4, DATA Candle in the wind (Piano Arrangement)-05        93.97
[08:28] PS 1.06: (DEBUG) Line : 5, DATA Candle in the wind (Piano Arrangement)-06        100.84
[08:28] PS 1.06: (DEBUG) Line : 6, DATA Candle in the wind (Piano Arrangement)-07        93.97
[08:28] PS 1.06: (DEBUG) Line : 7, DATA Candle in the wind (Piano Arrangement)-08        93.4

 

Next line is 9 Candle in the wind (Piano Arrangement)-09        92.29 

no different copy pasted from notecard.

 

Error Copied from console

[08:28] PS 1.06 [script:_Multi-Sitter 1.04] Script run-time error
[08:28] Stack-Heap Collision

3 hours ago, Qie Niangao said:

GetNotecard(string notecard, integer notify) // Get the notecard's name, if present { if (INVENTORY_NOTECARD != llGetInventoryType(notecard)) llOwnerSay("NOTECARD NOT FOUND: " + notecard); else kQuery = llGetNotecardLine(gStrNotecard = notecard, iLine = 0); }

 

Edited by VirtualKitten
To add error
Link to comment
Share on other sites

I checked my script and memory usage my script was at 721 lines and had only 1200  left to load this list making this not possible . I opened a new script and got same routines loading from note card however the only transport is message linked this is simply not fast enough for sound wave . So I am back to original problem with this sound wave issue of non reading consecutive sound files with [bpm] in their name , Can someone in Linden look into this please ? Thank you 

Link to comment
Share on other sites

You are about to reply to a thread that has been inactive for 1311 days.

Please take a moment to consider if this thread is worth bumping.

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
 Share

×
×
  • Create New...