{
   "labels" : [],
   "code" : "(\r\ns.waitForBoot({\r\n    Routine({\r\n        var duration = 60; // Duration in seconds\r\n        var filePath = \"~/Desktop/360_Soundscape.wav\".standardizePath;\r\n\r\n        // 1. Define the Synth for a spatialized sound source\r\n        SynthDef(\\SpatialSource, { |out=0, freq=440, az=0, amp=0.2, gate=1|\r\n            var signal, w, x, y, z;\r\n            \r\n            // Generate a placeholder sound (using noise/filters to mimic your list)\r\n            signal = HPF.ar(PinkNoise.ar(amp), freq) * EnvGen.kr(Env.asr(2, 1, 2), gate, doneAction: 2);\r\n            \r\n            // Encode into Ambisonics (B-format)\r\n            #w, x, y, z = PanB.ar(signal, az, 0, 1); \r\n            \r\n            Out.ar(out, [w, x, y, z]);\r\n        }).add;\r\n\r\n        s.sync;\r\n\r\n        // 2. Start Recording\r\n        s.prepareForRecord(filePath, 4); // 4 channels for B-format\r\n        s.record;\r\n\r\n        // 3. Instantiate the 5 Sounds at different angles\r\n        // [Sound Type, Frequency, Azimuth (-1 to 1)]\r\n        // -1 = Rear, -0.5 = Left, 0 = Front, 0.5 = Right, 1 = Rear\r\n        \r\n        ~wind  = Synth(\\SpatialSource, [\\freq, 100,  \\az, -0.8, \\amp, 0.1]);  // Back-Left\r\n        ~birds = Synth(\\SpatialSource, [\\freq, 2000, \\az, 0.4,  \\amp, 0.05]); // Front-Right\r\n        ~car   = Synth(\\SpatialSource, [\\freq, 50,   \\az, 0.0,  \\amp, 0.15]); // Center-Front\r\n        ~chime = Synth(\\SpatialSource, [\\freq, 800,  \\az, 0.8,  \\amp, 0.1]);  // Back-Right\r\n        ~water = Synth(\\SpatialSource, [\\freq, 500,  \\az, -0.3, \\amp, 0.08]); // Front-Left\r\n\r\n        duration.wait;\r\n\r\n        // 4. Cleanup and Save\r\n        [~wind, ~birds, ~car, ~chime, ~water].do(_.set(\\gate, 0));\r\n        2.wait;\r\n        s.stopRecording;\r\n        \"File saved to Desktop as 360_Soundscape.wav\".postln;\r\n    }).play;\r\n});\r\n)",
   "is_private" : null,
   "id" : "1-5iJ",
   "name" : "360 audio",
   "author" : "mailtoabhirambabu",
   "ancestor_list" : [],
   "description" : ""
}
