<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Theron Pray on Medium]]></title>
        <description><![CDATA[Stories by Theron Pray on Medium]]></description>
        <link>https://medium.com/@theronpray?source=rss-eae83f1ac7b2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*1DZawSeV8-bYRhRX.</url>
            <title>Stories by Theron Pray on Medium</title>
            <link>https://medium.com/@theronpray?source=rss-eae83f1ac7b2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 20:06:58 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@theronpray/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How to use the Shadertoy and ISF Converters in Synesthesia]]></title>
            <link>https://medium.com/@theronpray/how-to-use-the-shadertoy-and-isf-converters-c529be1dc694?source=rss-eae83f1ac7b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/c529be1dc694</guid>
            <category><![CDATA[synesthesia]]></category>
            <category><![CDATA[creative-coding]]></category>
            <category><![CDATA[shaders]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Theron Pray]]></dc:creator>
            <pubDate>Tue, 21 Nov 2017 22:56:47 GMT</pubDate>
            <atom:updated>2018-01-16T19:34:56.468Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BF0AxcYWknL9A2H1PO3rKg.png" /><figcaption>The ISF and Shadertoy Converters, in the Import Panel ( + )</figcaption></figure><blockquote><strong>Important Note:</strong> The works on ISF and Shadertoy are all made by creative coders. These often take many, many hours to create and represent a significant amount of work on the part of the artist. While both of these platforms exist to share techniques and inspire others, the copyright on the creations must respected. Often times the creator will write whatever license they prefer in a comment at the beginning of the shader (as seen below). If you can’t find a license or really need a less strict one, best practice is to simply ask the creator themselves! Many of them are happy to see their works used artistically, and at the end of this article we will list a few profiles of artists who have given us explicit permission to allow our users to use and remix their public work.</blockquote><pre>//MIT License<br>or <br>// License Creative Commons Attribution-NonCommercial-ShareAlike 3.0</pre><h3>Grow Your Shader Library</h3><p>With these converters it is possible to add new scenes to your Scene Library. Both <a href="http://www.shadertoy.com/">www.shadertoy.com</a> and <a href="http://www.interactiveshaderformat.com/">www.interactiveshaderformat.com</a> have have incredible communities of artists and a ton of really cool content that can run in Synesthesia. These creations are <strong>shaders—realtime generative content created entirely in GLSL code.</strong></p><p>While they are all shaders, <em>Interactive Shader Format</em> (ISF) and the Shadertoy format are slightly different from our native format, <em>Synesthesia Shader Format</em> (SSF). So the shaders cannot run exactly copy-pasted from either website. However, the import tools in Synesthesia run conversion processes, finding and replacing variables, reformatting code, changing function names in an effort to convert the shaders to SSF. <strong>ISF scenes all have controls, while Shadertoy has a bigger library of works. </strong>There are a number of features in both ISF and Shadertoy that Synesthesia simply<em> does not support. </em>Similarly, Synesthesia has some extra features that any straight ISF or Shadertoy scene won’t automatically take advantage of. Know that after importing from one of these sites, you may get a really cool looking scene, but it wont automatically be audio-reactive or necessarily be able to use your media.</p><h3>How to Convert From Interactive Shader Format</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0oflW-sBCODFwfsKWdqn3g.png" /></figure><p>First off, head to <a href="http://www.interactiveshaderformat.com/">www.interactiveshaderformat.com</a>. Click on a shader from the front page, or browse to find one you like. Once you’re on a particular shader’s page, look for the <strong>Download </strong>button in the upper right corner.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uFfeb1tjziShfBN7_NytmA.png" /><figcaption>“Download” button in the upper right corner</figcaption></figure><p>Depending on the shader you’ve selected, you’ll either download a<strong> <em>.fs</em> file</strong> or a <strong>zipped folder</strong> containing a both a <em>.vs </em>file and a <em>.fs</em> file. If you download and get a zipped folder, it is because the ISF scene uses both a custom fragment shader (.fs) and a custom vertex shader (.vs). Synesthesia doesn’t support custom vertex shaders, so without you manually modifying the code, this particular ISF shader likely won’t run in Synesthesia.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wqcy4BRK-KtK6tRCShlcLQ.png" /></figure><p>Now go to the Import Panel in Synesthesia, and click on the Search button to select the .fs file you just downloaded.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0u33dmmQd3RgQ73qmjq_6Q.png" /></figure><p>Click “<strong>Open</strong>”. Now the file path should appear in the search bar, and the “<strong>load</strong> <strong>scene</strong>” button will be lit instead of greyed out. Click load scene and Synesthesia will attempt to convert the scene to the SSF format. You’ll see one of the following two outcomes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*de3OBh11zpfoI1lC-JvRmA.jpeg" /><figcaption>Left: Success! Right: Failure</figcaption></figure><p>On the left, a successful conversion. The scene is now running in Synesthesia!</p><p>On the right, an unsuccessful conversion. Note the red text at the bottom, reporting the error. Here we have a compilation error in the shader. Usually this means the shader is using some feature of ISF that we don’t yet support, or that it has a specific variable or function name that tripped up our converter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*3aRB4hLkb7DjL3EXYcfkwQ.png" /></figure><p>If it was successful, head to the controls page! The best part about ISF is that every shader has controls, just like Synesthesia Scenes. So go check out how these scene controls behave in Synesthesia.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*39ob4nuel6Vq2513fuxKQA.png" /></figure><p>After loading, Synesthesia now has an SSF version of this scene in temporary memory. If you’d like to save the scene and add it to your Scene Library, click on “create .synScene in library”. You’ll need to set a Custom Scene Folder if you don’t already have one set. Synesthesia will create a .synScene file in your Custom Scene Folder, and you should now see the scene in your Scene Library with the “ISF” thumbnail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0yRPErKcbUCuiY5wEEjZJA.png" /><figcaption>On the bottom right you can see our new ISF scene, added to our scene library.</figcaption></figure><p><em>Even if scene conversion fails and you get a compilation error, </em><strong><em>you can still create a .synScene.</em></strong><em> A lot of the work of converting the shader will already be done. Very likely, there are just a few more steps that need to be done manually. So although the scene won’t run, you can create .synScene, find it in the library, and click on the pencil to “edit scene”. Open the main.glsl file in a text editor and try to fix the compilation errors it gives you. Sometimes its a 3 minute fix, other times it may not be worth it.</em></p><h3>How to Convert From Shadertoy</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ROiBdCPP25Yv9fs2tBg-rA.png" /></figure><p>First, head to <a href="http://www.shadertoy.com/">www.shadertoy.com</a>. Click on a shader from the front page, or browse to find one you like. Once you’re on a particular shader’s page, copy the link at the top of the page. The URL has a special key that points to this particular shader. Synesthesia then uses the <em>Shadertoy API </em>to access the code from this shader to execute the conversion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZmEeH6uvI7T_tPX8LKMS6A.png" /><figcaption>Copy the URL at the top of the page!</figcaption></figure><p>Once you’ve copied the URL, head to the Import Panel in Synesthesia and paste the link in the Shadertoy.com search bar.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LK6xSyyI_7yY5PysG2x0wQ.png" /></figure><p>Once you have a valid URL in the bar, the “<strong>load</strong> <strong>scene</strong>” button will be lit instead of greyed out. Click load scene and Synesthesia will attempt to access the scene through the Shadertoy.com API. Then it will attempt to convert the shader to the SSF format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*at6rvW0wU5v4ubxoPcca2A.jpeg" /><figcaption>Left: Full success. Middle: Shader found, but failed conversion. Right: Shader not found.</figcaption></figure><p><em>Note: Many shaders will give you a “not found” error. This is because the author of the work decided not to publish it to the Shadertoy.com API, possibly because they didn’t want it to be used without their knowledge.</em></p><p>If you are successful loading a scene (as in the case on the left), you’ll see the scene running in the visualizer window. Synesthesia now has an SSF version of this scene in temporary memory. If you’d like to save the scene and add it to your Scene Library, click on “create .synScene in library”. You’ll need to set a Custom Scene Folder if you don’t already have one set. Synesthesia will create a .synScene file in your Custom Scene Folder, and you should now see the scene in your Scene Library with the “Shadertoy” thumbnail.</p><p>Note that many scenes from Shadertoy are optimized to run at a resolution of 768 x 432. Synesthesia automatically tries to run these shaders at 1280x720 (720p), which means that the scenes often run at less than 60 FPS. If the scene is too laggy, click the pencil to edit the scene. Open the scene.json file and change the “WIDTH”: and “HEIGHT”: variables to 768 and 432, respectively (or any other 16:9 resolution that is smaller than the default one).</p><p><em>If the shader was found, but scene conversion fails and you get a compilation error, </em><strong><em>you can still create a .synScene.</em></strong><em> A lot of the work of converting the shader will already be done. Very likely, there are just a few more steps that need to be done manually. So although the scene won’t run, you can create .synScene, find it in the library, and click on the pencil to “edit scene”. Open the main.glsl file in a text editor and try to fix the compilation errors it gives you. Sometimes its a 3 minute fix, other times it may take much longer.</em></p><h3>Differences between ISF, Shadertoy, and SSF</h3><p>First off, unless you edit them yourself, <strong>none of the scenes from ISF or Shadertoy will be audio reactive.</strong> Synesthesia uses special audio uniforms in the shader, like syn_Level, syn_BassLevel, syn_HighHits, and syn_Presence to animate certain variables in the shader. To learn more about the SSF format and for a full list of these variables, check out our documentation here: <a href="https://synesthesia.live/docs/index.html">https://synesthesia.live/docs/index.html</a> For every default Synesthesia scene, you’ll see these <strong>syn_AudioVariables </strong>littering the code. If you want to add audio reactivity yourself to a scene you just converted, just drop in these variables. They all go from 0.0 to 1.0.</p><p>Second, note that <strong>converting from ISF is generally better, because ISF shaders already have controls</strong>. If you convert from Shadertoy you’ll get a shader running in real time, but you’ll need to add controls yourself. The scene.json will be essentially empty, it’ll just have the mouse controls that only about 25% of Shadertoy shaders actually use. If you want to add more controls, you can add them in the scene.json file.</p><h4>Reasons why Conversion Fails</h4><p>Some things in ISF and Shadertoy are not supported in Synesthesia. Our Shadertoy converter can successfully deal with Multipass, Webcam, and Shadertoy.com textures<strong>. </strong>However, Synesthesia doesn’t support Shadertoy’s <strong>VR, Soundcloud or Microphone Inputs, or keyboard inputs</strong>. For sound or keyboard inputs, you’ll get an error message and you’ll have to manually cut out the code that contains the texture lookup. The offending line will look like this:</p><pre>= texture(iChannelX, vec2());</pre><p>For ISF, Synesthesia can work with imports and most controls. It fails on <strong>audio, audioFFT, and long.</strong> It also fails if the ISF scene has special vertex shader.</p><h3>Artist Profiles</h3><p>These are links to a few artist profiles on interactiveshaderformat.com and shadertoy.com who we have contacted, and who have consented to allowing our users to remix and use their work.</p><p><strong>Mojo Video Tech: </strong><a href="https://www.interactiveshaderformat.com/u/mojovideotech">https://www.interactiveshaderformat.com/u/mojovideotech</a></p><p><strong>Shane: </strong><a href="https://www.shadertoy.com/user/shane">https://www.shadertoy.com/user/shane</a></p><p><strong>Aiekick: </strong><a href="https://www.shadertoy.com/user/aiekick">https://www.shadertoy.com/user/aiekick</a></p><blockquote><strong>Acknowledgements: </strong>Shadertoy and the Shadertoy.com API are created by Inigo Quilez and Pol Jeremias. Interactive Shader Format and the ISF Website were created and maintained by the VIDVOX team. We are grateful for their work and the creative communities that they have built.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c529be1dc694" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[“Scenes Share Mappings” — How the hell does it work?]]></title>
            <link>https://medium.com/@theronpray/scenes-share-mappings-how-the-hell-does-it-work-790b57a7ed20?source=rss-eae83f1ac7b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/790b57a7ed20</guid>
            <category><![CDATA[help]]></category>
            <category><![CDATA[synesthesia]]></category>
            <dc:creator><![CDATA[Theron Pray]]></dc:creator>
            <pubDate>Sun, 22 Oct 2017 00:25:58 GMT</pubDate>
            <atom:updated>2017-10-22T00:39:53.638Z</atom:updated>
            <content:encoded><![CDATA[<p>MIDI mapping is tough in the program because each scene has its own set of controls. There is no simple fix, and it may be a while before we can really overhaul MIDI. I wanted to clear up how this setting works, so you know what it is doing behind the scenes.</p><p>First off, to turn “Scenes Share Mappings” on you have to check this box. If it is off, you have to map each scene individually. <strong>Meta controls will always only use one mapping, regardless of this setting.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/269/1*lEm0L5SYceTD2NyHDgSLtg.png" /></figure><p>Scenes share mappings attempts to let you create only one mapping and then use it across all scenes. Some of your MIDI controls won’t have a use for every scene, and some scenes may have more controls than any you’ve previously mapped, since each scene has a different number of controls. I’d recommend just finding a few of the scenes that have the largest sets of controls and doing the mapping there. Alien Cavern, Hue Review, and Tunnel Beauty 6 should get you pretty far. Okay, now here is what is going when Scenes Share Mappings is on.</p><p>First off, the red/yellow/green colored “Control Groups” don’t affect MIDI mappings at all. MIDI only cares about what type of control it is and where it is from left to right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9UOJ2ictCi0DmqQfVb7wlg.png" /><figcaption>Only cares about what type of control it is and where it is from left to right.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*HoPv7Dh4EiaeRhWsOqfmKg.png" /><figcaption>Look carefully at how the middle toggles are arranged!</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/989/1*PDpqvRnVKWX1Q7BNFvFi7A.png" /><figcaption>Left to right, top to bottom. Type of control. Groups don’t matter.</figcaption></figure><p>Whatever you have mapped to the first slider will always control the first slider in that scene, regardless of whether S-1 happens to be in the first group, second, or last.</p><p>There is currently a bug where the GUI and the MIDI mapper disagree on the order of controls in certain scenes. This may have added to the headaches! But we’ve tracked it down, and it will be fixed in v1.13. So you don’t have to spend all night mapping…</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=790b57a7ed20" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Temp Guide: Synesthesia Built-In Functions]]></title>
            <link>https://medium.com/@theronpray/temp-guide-synesthesia-built-in-functions-18639a0d19ba?source=rss-eae83f1ac7b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/18639a0d19ba</guid>
            <category><![CDATA[glsl]]></category>
            <category><![CDATA[live]]></category>
            <category><![CDATA[synesthesia]]></category>
            <category><![CDATA[vj]]></category>
            <category><![CDATA[realtime]]></category>
            <dc:creator><![CDATA[Theron Pray]]></dc:creator>
            <pubDate>Wed, 19 Jul 2017 16:56:16 GMT</pubDate>
            <atom:updated>2017-07-19T17:01:15.927Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a temporary stand-in for our <a href="https://synesthesia.live/docs/index.html">SSF Documentation</a> while it is being updated.</p><p>Here we have our Color Modifying functions:</p><pre>//Brightness can go from -1.0 to 1.0, where -1.0 is full black, 1.0 is full white</pre><pre>vec4 _brightness(vec4 colIn, float brightnessVal);</pre><pre><br>//Gamma can go from 0.001 to 3.0, where 0.001 is almost entirely black, 3.0 is very light, 1.0 is unchanged</pre><pre>vec4 _gamma(vec4 colIn, float gammaVal);<br></pre><pre>//Contrast can be used on its own, but the same math is copy-pasted in _hueSaturationContrast, because you don&#39;t want to run rgb2hsv three times, once for hue, sat, contrast each. So theres a combined function that does em all.</pre><pre>vec4 _contrast(vec4 colIn, float contrastVal);</pre><pre>vec4 _hueSaturationContrast(vec4 colIn, float hueVal, float saturationVal, float contrastVal);</pre><pre><br>/**</pre><pre>* Converts HSV values into its equivalent RGB values</pre><pre>* @name _hsv2rgb</pre><pre>* @param  {vec3} vec3(h Hue of the color, s Saturation of the color, v Value of the color)</pre><pre>* @returns  {vec3} RGB of the converted color of the form (r,g,b)</pre><pre>*/</pre><pre>vec3 _hsv2rgb(vec3 c);<br></pre><pre>/**</pre><pre>* Converts RGB values into its equivalent HSV values</pre><pre>* @name _hsv2rgb</pre><pre>* @param  {vec3} vec3(red, green, blue)</pre><pre>* @returns  {vec3} vec3(h Hue of the color, s Saturation of the color, v Value of the color)</pre><pre>*/</pre><pre>vec3 _rgb2hsv(vec3 c);</pre><p>And then we have some extra built-in functions for generating patterns earlier in the shaders, not just modifying colors at the end.</p><pre>vec2 _xy = gl_FragCoord.xy;</pre><pre>vec2 _uv = _xy / RENDERSIZE.xy;</pre><pre>vec2 _uvc = _xy / RENDERSIZE.y - vec2(RENDERSIZE.x/RENDERSIZE.y/2, 0.5);</pre><pre>const float PI = 3.14159265359;</pre><pre>/**</pre><pre>* Converts a (x,y) vector into a (radius, theta) vector.</pre><pre>* @file functions.glsl</pre><pre>* @name _toPolar</pre><pre>* @param  {vec2} uv Cartesian coordinated to covert to polar coords</pre><pre>* @returns {vec2} Polar coordinates in the form (r, t)</pre><pre>*/</pre><pre>vec2 _toPolar(vec2 v);</pre><pre>/**</pre><pre>* Converts a (x,y) vector into a (radius, theta) vector, with the quadrant correction applied, giving full range of rotation.</pre><pre>* @file functions.glsl</pre><pre>* @name _toPolarTrue</pre><pre>* @param  {vec2} uv Cartesian coordinated to covert to polar coords</pre><pre>* @returns {vec2} Polar coordinates in the form (r, t)</pre><pre>*/</pre><pre>vec2 _toPolarTrue(vec2 uv);<br></pre><pre>/**</pre><pre>* Converts a (radius, theta) vector into a (x, y) vector.</pre><pre>* @name _toRect</pre><pre>* @param  {vec2} uv Polar coords to covert to cartesian coords</pre><pre>* @returns {vec2} Cartesian coordinates in the form(x,y)</pre><pre>*/</pre><pre>vec2 _toRect(vec2 v);</pre><pre>/**</pre><pre>* Rotates a vector around the point (0, 0)</pre><pre>* @name _rotate</pre><pre>* @param  {vec2} v The vector to be rotated</pre><pre>* @param  {float} theta degrees to rotate</pre><pre>* @returns {vec2} Rotated vector</pre><pre>*/</pre><pre>vec2 _rotate(vec2 v, float t) ;</pre><pre>/**</pre><pre>* Converts an RGB color with components ranging from 0 to 255 to a vec3 ranging</pre><pre>* 0 to 1</pre><pre>* @name _normalizeRGB</pre><pre>* @param  {float} r Red component, 0-255</pre><pre>* @param  {float} g Green component, 0-255</pre><pre>* @param  {float} b Blue component, 0-255</pre><pre>* @returns {vec3} RGB vector of the form (r,g,b), 0 to 1</pre><pre>*/</pre><pre>vec3 _normalizeRGB(float r, float g, float b);<br></pre><pre>/**</pre><pre>* Similar to `min(float, float)`, but creates a smooth transition between the two</pre><pre>* @name _smin</pre><pre>* @param  {float} a First value to compare</pre><pre>* @param  {float} b Second value to compare</pre><pre>* @param  {float} k Exponent on the algorithm. Higher values means a sharper min</pre><pre>* @returns {float} smooth minimum of the two values</pre><pre>*/</pre><pre>float _smin( float a, float b, float k );<br></pre><pre>/**</pre><pre>* Clusters values into larger &quot;Pixels&quot;</pre><pre>* @name _pixelate</pre><pre>* @param  {float|vec2|vec3} a First value to compare</pre><pre>* @example</pre><pre>* // returns {0.2, 0.2}</pre><pre>* _pixelate({0.2, 0.2}, 5);</pre><pre>* _pixelate({0.3, 0.3}, 5);</pre><pre>* @example</pre><pre>* // returns {0.2, 0.2}</pre><pre>* _pixelate({0.2, 0.2}, 10);</pre><pre>* // returns {0.3, 0.3}</pre><pre>* _pixelate({0.3, 0.3}, 10);</pre><pre>* @returns {float|vec2|vec3} pixelated value</pre><pre>* @tutorial <a href="http://www.google.com/">http://www.google.com</a></pre><pre>*/</pre><pre>float _pixelate(float x, float amount);</pre><pre>vec2 _pixelate(vec2 x, float amount);</pre><pre>vec3 _pixelate(vec3 x, float amount);<br></pre><pre>/**</pre><pre>* Generates a pseudo-random value based on a seed</pre><pre>*</pre><pre>* @name _rand</pre><pre>* @param  {float|vec2} seed RNG seed</pre><pre>* @returns {float} pseudo-random value ranging from 0 to 1</pre><pre>*/</pre><pre>float _rand(float seed);</pre><pre>float _rand(vec2 seed);}<br></pre><pre>/**</pre><pre>* Normalizes an input</pre><pre>*</pre><pre>* @name _scale</pre><pre>* @param  {float} var input to be scaled</pre><pre>* @param  {float} min lower bound for scaling</pre><pre>* @param  {float} max upper bound for scaling</pre><pre>* @returns {float} pseudo-random value ranging from 0 to 1</pre><pre>*/</pre><pre>float _scale(float var, float min, float max);<br></pre><pre>/**</pre><pre>* A function that produces stateless noiselike behaviour when fed time. This noise is not random, but it is not painfully periodic.</pre><pre>* @param  {float} t Time or any steadily incrementing value</pre><pre>* @returns {float} continuous stateless psuedorandomness</pre><pre>*/</pre><pre>float _statelessContinuousChaotic(float t);<br></pre><pre>/**</pre><pre>* Function to determine if a texture exists</pre><pre>* this only works on the basis that an empty texture is a 1x1 texture, which is arbitrary</pre><pre>*/</pre><pre>bool _exists(sampler2D tex);</pre><pre>/**</pre><pre>* Iq&#39;s Pallete Function, use alongside the cosine palette generator scene!</pre><pre>* @name _palette</pre><pre>* @param  {float} t the input variable, your spot on the color gradient</pre><pre>* @param  {vec3} a RGB&#39;s biases, respectively</pre><pre>* @param  {vec3} b RGB&#39;s amplitudes</pre><pre>* @param  {vec3} c RGB&#39;s frequencies</pre><pre>* @param  {vec3} d RGB&#39;s phase offsets</pre><pre>* @returns {vec3} the output color</pre><pre>*/</pre><pre>vec3 _palette(in float t, in vec3 a, in vec3 b, in vec3 c, in vec3 d);<br></pre><pre>/**</pre><pre>* Pulse. A function useful in so many different ways.</pre><pre>* Creates a single smooth pulse with a given center and thickness</pre><pre>* @name _pulse</pre><pre>* @param  {float} variable, where on the pulse are you currently? This is the &quot;active&quot; variable.</pre><pre>* @param  {float} center, where in space or time should the pulse be centered</pre><pre>* @param  {float} width, how wide should the pulse be</pre><pre>* @returns {float} the value of the pulse at the given point</pre><pre>*/</pre><pre>float _pulse(float variable, float center, float width);<br></pre><pre>/**</pre><pre>* Square Pulse. A function useful in so many different ways.</pre><pre>* Creates a single &quot;box&quot;, or square pulse with a given center and thickness, as opposed to the smooth pulses generated by _pulse.</pre><pre>* @name _sqPulse</pre><pre>* @param  {float} variable, where on the pulse are you currently? This is the &quot;active&quot; variable.</pre><pre>* @param  {float} center, where in space or time should the pulse be centered</pre><pre>* @param  {float} width, how wide should the pulse be</pre><pre>* @returns {float} the value of the pulse at the given point</pre><pre>*/</pre><pre>float _sqPulse(float variable, float center, float width);<br></pre><pre>/**</pre><pre>* Triangle Wave</pre><pre>* Because sometimes you don&#39;t want things moving sinusoidally.</pre><pre>* @name _triWave</pre><pre>* @param  {float} var, where are you on the wave? your &quot;active&quot; variable.</pre><pre>* @param  {float} period, how wide should the wave be w/ respect to var</pre><pre>* @returns {float} the value of the wave at your given var, between 0 and 1</pre><pre>*/</pre><pre>float _triWave(float var, float period);</pre><pre>/**</pre><pre>* Transform from coordinates where (0,0) is the center of the screen (IE: _uvc) to coordinates where the origin is the bottom left.</pre><pre>* @name _center2uv</pre><pre>* @param  {vec2} out posIn, put your position variable here, it acts directly on your variable.</pre><pre>*/</pre><pre>void _center2uv(out vec2 posIn);</pre><pre>/**</pre><pre>* Transform from coordinates where (0,0) is the bottom left of the screen (IE: _uv) to coordinates where the origin is center</pre><pre>* @name _uv2center</pre><pre>* @param  {vec2} out posIn, put your position variable here, it acts directly on your variable.</pre><pre>*/</pre><pre>void _uv2center(out vec2 posIn);</pre><p>Finally, you should also know about _loadUserImage(). This function is what loads your currently selected media into any scene. So you if can find where _loadUserImage() is used in a shader, you can try to modify how it is used to change the way media interacts with the scene.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18639a0d19ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Customizing Your Scenes]]></title>
            <link>https://medium.com/@theronpray/customizing-your-scenes-3ca5bfbf8c61?source=rss-eae83f1ac7b2------2</link>
            <guid isPermaLink="false">https://medium.com/p/3ca5bfbf8c61</guid>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[how-to]]></category>
            <category><![CDATA[visual-art]]></category>
            <category><![CDATA[synesthesia]]></category>
            <dc:creator><![CDATA[Theron Pray]]></dc:creator>
            <pubDate>Fri, 21 Apr 2017 21:29:58 GMT</pubDate>
            <atom:updated>2017-04-21T21:29:58.331Z</atom:updated>
            <content:encoded><![CDATA[<p>Synesthesia lets you get up and running quickly—everything just works out of the box. But this comes at the cost of flexibility. The controls all have some set defaults, certain things about the scene you just can’t change within the GUI. <em>You are forced to color inside the lines.</em> If you’re ready to break outside those lines, there is a way, and in fact, everything about a scene can be modified. It just takes some understanding and a bit of coding. Let’s start by describing what a scene is.</p><h3>The Scene</h3><p>A scene is really just a folder containing some files, and changing these files changes anything about that scene. Every scene includes the following files: <strong>main.glsl, scene.json, and a thumbnail image.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/437/1*HWBvDmU-9nk6c_VgJHN76g.png" /></figure><p><strong>main.glsl</strong> is responsible for all of the visual output of the scene. This is the code, often pretty long and full of math, that is responsible for generating the output. Most of the colors, shapes, and motion for anything you see on screen will be defined in this file.</p><p><strong>scene.json</strong> holds all of the “meta data” about the scene. It is essentially a list of data that Synesthesia needs to know to know how to properly run the scene. It tells Synesthesia the scene’s name, the artist, what kind of controls should exist, what those default values should be, and so on. It also tells the program the name of the image to use as the thumbnail, also included in the synScene package.</p><p><em>Note: Synesthesia can load a folder containing these files OR a .synScene. They are equivalent, but .synScene is a little easier because you can double-click to open that scene in Synesthesia. It’s a bit messy as we transition from folders to .synScenes, but for now, just think of them as the same. To access the files inside a .synScene, right click on it and select “Show Package Contents”.</em></p><h3>Where are the Scenes?</h3><p>The scenes are in <strong>one of two places.</strong></p><p>If you’re looking for the <strong>default scenes</strong> we’ve included in the app, you can get to them as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*dOaXZ0x06wMq00ncoGwV1g.png" /></figure><ol><li>Click on the app and select “Show Package Contents”</li><li>Go to Contents &gt; Resources &gt; release</li><li>All the default scenes are there.</li><li>If you’d like to start modifying scenes, I’d recommend copying this folder to your Desktop, and calling it “My Custom Scenes”.</li></ol><p>If you’re looking for your <strong>imported scenes</strong>, they’re stored in the hidden “Application Support” folder on your computer. However, you can get there by using the built-in button on very bottom of the settings page “Open Scene Folder in Finder”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6ps_zEbQkI0D4t6NQ75G5A.png" /></figure><p><em>Note: If you ever want to delete a scene you’ve imported, or skip the “Importing” process, feel free to just manually manage what is in this “Scenes” folder. However, I don’t recommend making changes to the default scenes in the “release” folder inside the app package, as your changes will be lost when you update. Instead, make a copy and import it. Be sure to give it a </em><strong><em>new title</em></strong><em>, </em><strong><em>file name</em></strong><em>, and </em><strong><em>thumbnail image</em></strong><em>, so you know which one is yours and which is the default.</em></p><p>Now that we know how to manage scenes, lets customize them!</p><h3>Step 1: Open the Scene Editor</h3><p>Lets say you love a scene but just want to make a few tweaks to how it begins. Let’s say for instance on InkShot you always want “Slices” to be turned on by default, and prefer “Pulse Intensity” to always be maxed out. You can make these changes! First, you’ll need to open your modified scene in the Scene Editor.</p><p>Now, since we’re going to modify a default scene, I’m first going to make a copy of it to save my modified version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KnsjKhYFmbPA8-n1wEsRiw.png" /></figure><p>Now, I’m going to rename my custom version <em>theron_inkshot.synScene</em> so Synesthesia can tell the file apart from the original. I just added my name so I know it’s my custom version, you can add your name or call it whatever you like.</p><p>Next step, let’s get our custom scene open in the Synesthesia Scene Editor, also called the Developer Panel. Open Synesthesia and navigate to the Developer Panel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/189/1*F9QslUU_n8BDH2cYZfUO2A.png" /><figcaption>This Tab opens the Developer Panel</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/131/1*Dsmz6WtUFFua0KQOamX3AQ.png" /></figure><p>Now, in finder, simply double click your new file! It should automatically open inside of Synesthesia.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*efaCV_AheVK251Std-jZ2w.png" /><figcaption>Click the folder to manually browse for files</figcaption></figure><p><em>Instead of double clicking the scene, you can also manually select a scene to open by using the file browser. If your scene is stored as a folder instead of a .synScene, you have to use this method. Click on the “folder” icon to open the file browser and pick which scene you’d like to load. Point it to the scene’s folder, or .synScene file, not any files inside the scene!</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*sYYDc_NtZm5dAS9h3pdIIQ.png" /></figure><p><strong>Nice!</strong></p><p>The scene should immediately load, and you’ll see some output in the console saying “Ink Shot loaded successfully”.</p><p>Alright, we’ve got it open. Now we’re ready to start modifying the files <strong>inside the scene</strong>.</p><h3>Step 2: Modifying a Scene’s Files</h3><p>Now lets start modifying the files! <strong>Click on the “Show in Finder” button to open up the .synScene file and access the files inside</strong>. It should pop up a window that looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*CihOGV7L-As5ihgXHVkIig.png" /></figure><p><em>You can also do this by right clicking on the .synScene in finder and selecting “Show Package Contents”, but its easiest to just do it in Synesthesia.</em></p><p>Now open the <strong>scene.json </strong>file with whatever your favorite text editor is. Apple’s built-in “TextEdit” will work just fine, but I’m going to use Sublime Text, a free text editor I prefer for this purpose.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*Kuq9Y5nYY-MRdYChCAqtqA.png" /></figure><p>Now, after opening you should be able to see the text inside the file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*2pPtjXY2lclDbCFF1sFd4g.png" /><figcaption>May look slightly different, depending on your text editor, but all that matters is the <strong>content, </strong>not the styling<strong>.</strong></figcaption></figure><p>You can see it’s just a list of various pieces of data that control how Synesthesia will interact with this scene. First off, let’s change the “Title” so Synesthesia knows how to differentiate between this and the original Ink Shot. I’m going to call it Theron Ink Shot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/304/1*ba7z6JOZPNudSKw4VsjICQ.png" /><figcaption>Modified Title</figcaption></figure><p>In between the quotation marks, right where it currently says “Ink Shot”, you will type in your modified title, like “Theron Ink Shot”. <strong>Make sure you don’t lose a quotation mark or comma! </strong>The list’s structure must be kept carefully intact as we modify variables.</p><p>Now press Command + S to save your modifications to the scene.json file. Now, head back to the Scene Editor in Synesthesia and click the “reload” button, that looks like two spinning arrows. You can also<strong> press the key R</strong> at any time when the scene editor is open to reload the scene. It will take a fresh look at the files and any changes should be reflected in how the scene behaves. <strong>If you haven’t saved in your text editor, Synesthesia can’t view your changes yet,</strong> and it’ll just reload the older version.</p><p>Now you <strong>should</strong> see the new title after reloading! Sweet, we made our first modification.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/566/1*9qgvh41aMDwj-uY2iTj86A.png" /></figure><p>You should also see new text in the developer panel. This shows its attempting to reload it, and then prints that it was able to successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/537/1*pRs-DNUafe-XvCtdoOIYFQ.png" /></figure><p>Before we go deeper, <strong>what happens if we make an error in the scene.json file?</strong> Lets find out. Right after the title and closing quotations, let’s delete the comma. Seems innocent enough, right?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/301/1*w60hWAMvGanAmZgDNZo8UA.png" /><figcaption>No comma after the final quotation mark!</figcaption></figure><p>Now lets save (Command + S) and navigate back to Synesthesia and reload (R). Now you get this mess:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*dxJqEuOw9jbUI5fAJxZAPQ.png" /><figcaption>A compilation error!</figcaption></figure><p>It goes on, just listing the output from the file, but the important part is at the very beginning. There was an error loading the scene, and the error occurred in the JSON (ie. inside the scene.json file). It suggests the error is a “Missing ‘,’ or ‘}’ in our list, near Line 4.</p><p>In our case, we know it’s a missing comma on line 3. So let’s put that comma back in, save the file, and reload in Synesthesia once more. Now it should load successfully. <strong>If you get an error like this, it is almost always minor error with the list structure. Don’t worry, your scene is not irreparably damaged. </strong>Just look through and make sure the data is organized properly, with quotations, [] square brackets, {} curly brackets, and commas all in their proper locations. You can use other Scenes as examples if it gets really messed up.</p><h3>Step 3: Modifying the Controls</h3><p>Alright, now that we’ve made a modification and we understand how to work with the Scene Editor, let’s do what we actually wanted to: change the defaults!</p><p>Under the <strong>“CONTROLS” </strong>header, you’ll see all the data that Synesthesia uses to construct the <strong>scene control panel</strong> in the main GUI.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VvSKHHdud6bZli6O2Uy1mA.png" /></figure><p><strong>The code above is what determines everything about the controls you see below!</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/656/1*2ZcYJntiX9_YA7yTNx0gqg.png" /></figure><p>So, let’s first modify the “slices” toggle, so it always starts in the “ON” position, rather than off.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qBU-ACnwDSUDWtwU0TRA6Q.png" /></figure><p>Here, all we have to modify is the <strong>“DEFAULT”</strong> value. Simply change that zero to a one, which for most toggles represents <strong>“ON”</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YtcZlosUk9bttCvug4wsvQ.png" /></figure><p>Now save, go back to Synesthesia, and hit R to reload the scene. Slices should now default to “ON” instead of off!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/94/1*1wJStvX3fRzw55dRqc7o2w.png" /></figure><p>Now lets modify pulse intensity! It is slightly more complicated, since we’re dealing with a slider, but basically the same. Here you can see we have a “DEFAULT” defined, but also a “MAX” value defined. A slider can also have a “MIN” value defined, which means the slider will always provide a number between MIN and MAX to the main.glsl code. “MIN”, if not provided, is always zero. So the slider moves between zero and two.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kmffhOColVC11porTq8_eg.png" /></figure><p>Therefore, if we want to max out the slider by default, just change the “DEFAULT” value from 1.0 to 2.0!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e1YmflfaozTYmeBJQRVpOg.png" /></figure><p>Want to get crazier with it? Maybe you‘ve always wanted there to be even more pulse intensity in the scene. Why not increase the MAX value? Try a value like fifty! Just say “MAX”: 50.0, and your slider will now go from 0.0 to 50.0, leading to much more intense effect in the shader.</p><p>You can also rearrange controls by changing their “UI_GROUP” variable. You can even add in a whole new control! Just add another set of control data to the list of controls, like this:</p><p>,{<br> “NAME”: “my_new_control”, <br> “UI_GROUP”:”new_group”,<br> “TYPE”: “toggle”,<br> “DEFAULT”: 0.0,<br> “MIN”: 0.0,<br> “MAX”: 1.0,<br> “DESCRIPTION”: “A new control that doesn’t do anything yet, but it sure is pretty.”<br> }</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*udQveZVJLGO2EN3Y4jCZzQ.png" /></figure><p>Notice I put a comma before the first curly brace! We’re adding another element. Without this comma, you’ll get an error.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*Qit63SkNt9pDwNoRWL2Uzg.png" /><figcaption>Our brand new toggle.</figcaption></figure><p>Of course, this my_new_control doesn’t do anything yet. But in the next section, we’ll get into modifying the GLSL file, and we will use the variable attached to this control to do some sweet visual effects!</p><p><strong>NEXT SECTION ON MODIFYING THE GLSL FILE COMING SOON</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ca5bfbf8c61" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>