// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Editable eight-step sound sequencer // Not compiled or tested in-world // Setup: Add a short tick. Owner-touch opens menu; 1-8 toggle steps, Play starts, Stop silences. // Stop / restore: Reopen the menu and choose Stop before removal. Menu timeout does not stop playback. // Notes: Use licensed sounds in this prim. Audio is nearby, not private. Timer timing and asset loading are approximate; no sample synchronization is promised. Input listener expires after thirty seconds without stopping an explicitly playing pattern. Reopen to Stop; this is approximate rhythm. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Not compiled or tested in-world. list beats=[1,0,0,0,1,0,0,0]; integer step; integer playing; integer channel; integer handle; float expiry; show() { llDialog(llGetOwner(),"Pattern "+llDumpList2String(beats,""),["1","2","3","4","5","6","7","8","Play","Stop"],channel); expiry=llGetTime()+30.0; llSetTimerEvent(0.5); } default { touch_start(integer n) { if(llDetectedKey(0)!=llGetOwner())return; if(handle)llListenRemove(handle); channel=-1000-(integer)llFrand(1000000.0); handle=llListen(channel,"",llGetOwner(),""); show(); } listen(integer ch,string name,key id,string s) { if(!handle||ch!=channel||id!=llGetOwner())return; integer p=llSubStringIndex("12345678",s); if(llStringLength(s)==1&&p>=0)beats=llListReplaceList(beats,[!llList2Integer(beats,p)],p,p); else if(s=="Play") { playing=TRUE; step=0; } else if(s=="Stop") { playing=FALSE; llStopSound(); } else return; show(); } timer() { if(handle&&llGetTime()>expiry) { llListenRemove(handle); handle=0; } if(playing) { if(llList2Integer(beats,step)&&llGetInventoryType("tick")==INVENTORY_SOUND)llPlaySound("tick",0.15); step=(step+1)%8; } else if(!handle)llSetTimerEvent(0.0); } }