// SPDX-License-Identifier: MIT // Copyright (c) 2026 Incoprea // Blind A/B audio comparison // Not compiled or tested in-world // Setup: Add short sounds sample_a and sample_b. Owner-touch plays one and opens an A/B guess dialog. // Stop / restore: Select A/B or wait 30 seconds; Stop sound in this prim can silence a remaining clip. // Notes: Use licensed inventory sounds in the specified prim. Audio is nearby, not private. Simulator timers and viewer loading are approximate. A listening exercise, not a controlled scientific hearing test. Identical volume settings do not normalize source loudness. // License: see LICENSE in this distribution. // Original Incoprea. MIT. Not compiled or tested in-world. integer choice; integer channel; integer handle; close() { if(handle)llListenRemove(handle); handle=0; llSetTimerEvent(0.0); } default { touch_start(integer n) { if(llDetectedKey(0)!=llGetOwner())return; close(); if(llGetInventoryType("sample_a")!=INVENTORY_SOUND||llGetInventoryType("sample_b")!=INVENTORY_SOUND) { llOwnerSay("Add sample_a and sample_b."); return; } choice=(integer)llFrand(2.0); string sound="sample_a"; if(choice)sound="sample_b"; llPlaySound(sound,0.3); channel=-1000-(integer)llFrand(1000000.0); handle=llListen(channel,"",llGetOwner(),""); llDialog(llGetOwner(),"Was that A or B?",["A","B"],channel); llSetTimerEvent(30.0); } listen(integer ch,string name,key id,string s) { if(!handle||ch!=channel||id!=llGetOwner()||(s!="A"&&s!="B"))return; close(); string actual="A"; if(choice)actual="B"; if(s==actual)llOwnerSay("Correct: "+actual); else llOwnerSay("This was "+actual); } timer() { close(); } }