<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jim Hill</title>
    <description>The latest articles on DEV Community by Jim Hill (@jimhill).</description>
    <link>https://dev.to/jimhill</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2582679%2F68974f0e-0aef-47c4-a1f4-746e110135ca.jpeg</url>
      <title>DEV Community: Jim Hill</title>
      <link>https://dev.to/jimhill</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jimhill"/>
    <language>en</language>
    <item>
      <title>How to build reactive voice avatars in React with GlasatarJS</title>
      <dc:creator>Jim Hill</dc:creator>
      <pubDate>Sun, 14 Sep 2025 10:54:43 +0000</pubDate>
      <link>https://dev.to/jimhill/how-to-build-reactive-voice-avatars-in-react-with-glasatarjs-4pjm</link>
      <guid>https://dev.to/jimhill/how-to-build-reactive-voice-avatars-in-react-with-glasatarjs-4pjm</guid>
      <description>&lt;p&gt;More and more I am designing voice and speech interfaces for AI applications. The way they look and move, as well as the way they sound, plays a big part in how they make the user &lt;em&gt;feel&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;So I decided to build a little React (and vanilla JS) library called Glasatar (&lt;a href="https://www.npmjs.com/package/@jimhill/glasatarjs" rel="noopener noreferrer"&gt;glasatarjs&lt;/a&gt;) which turns a plain audio stream into a living, breathing voice avatar. Avatars have 3 states: &lt;code&gt;speaking&lt;/code&gt;, &lt;code&gt;thinking&lt;/code&gt;, &lt;code&gt;listening&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Think of it like “privacy glass” that ripples and refracts whenever you talk into the mic. It’s weird, kind of artsy, and honestly pretty fun to play with.&lt;/p&gt;

&lt;h2&gt;
  
  
  In a nutshell:
&lt;/h2&gt;

&lt;p&gt;Glasatar is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;WebGL powered → runs in the browser with nice GPU effects&lt;/li&gt;
&lt;li&gt;React-friendly → drop it in as a component&lt;/li&gt;
&lt;li&gt;Configurable → change textures, blur, refraction, colors, backgrounds, you name it&lt;/li&gt;
&lt;li&gt;Open source → MIT licensed, so go wild&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It works both inside React and as a plain JavaScript library if you don’t want React in your life.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it live
&lt;/h2&gt;

&lt;p&gt;👉 &lt;a href="https://www.glasatar.com" rel="noopener noreferrer"&gt;Glasatar.com&lt;/a&gt; has a demo that lets you play around with it. You can even share your designs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff28whv7ozi8vaz6g7owf.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ff28whv7ozi8vaz6g7owf.jpeg" alt="This shows an image of a round avatar with a pink rippled shape that reflects the waveform being spoken." width="800" height="683"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pro tip: wear headphones, hit “allow mic,” and say something.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting started (React)
&lt;/h2&gt;

&lt;p&gt;Install it from npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; @jimhill/glasatarjs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then import the component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Glasatar&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@jimhill/glasatarjs&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;VoiceAvatar&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;audioStream&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setAudioStream&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;startMic&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;stream&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nb"&gt;navigator&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;mediaDevices&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getUserMedia&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;audio&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="nf"&gt;setAudioStream&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;stream&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;startMic&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Start&lt;/span&gt; &lt;span class="nx"&gt;Voice&lt;/span&gt; &lt;span class="nx"&gt;Avatar&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;audioStream&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Glasatar&lt;/span&gt;
          &lt;span class="nx"&gt;audioStream&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;audioStream&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;400&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="nx"&gt;texture&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cathedral&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;refractionStrength&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="nx"&gt;blurAmount&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="nx"&gt;glassOpacity&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="mf"&gt;0.9&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
          &lt;span class="nx"&gt;avatarColor&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#ff9900&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;backgroundType&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;linear-gradient&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
          &lt;span class="nx"&gt;backgroundGradient&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt;
            &lt;span class="na"&gt;centerColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#ff9900&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;edgeColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#0000ff&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;angle&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;45&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="p"&gt;}}&lt;/span&gt;
        &lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;)}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;VoiceAvatar&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Designing your avatar
&lt;/h2&gt;

&lt;p&gt;The fun part is tweaking. A few knobs you can play with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;texture&lt;/code&gt;: "arctic", "cathedral", "autumn", "flemish"&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;refractionStrength&lt;/code&gt;: crank this up for wilder distortion&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;blurAmount&lt;/code&gt;: soften the glass or make it crisp&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;avatarColor&lt;/code&gt;: tint it however you like&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;backgroundType&lt;/code&gt;: solid color, gradient, or even custom images&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Swap textures and settings until you find something that feels right for your app. There are more props to play with!&lt;/p&gt;

&lt;h2&gt;
  
  
  Where could this be useful?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Voice chat apps (Discord-style but weirder)&lt;/li&gt;
&lt;li&gt;Podcasting tools (visualise your host while they talk)&lt;/li&gt;
&lt;li&gt;Streaming overlays (let your mic make cool effects)&lt;/li&gt;
&lt;li&gt;Virtual events / hackathons / games&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Or just because it looks cool?!&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap-up
&lt;/h2&gt;

&lt;p&gt;This is very much an indie project. I built it for fun, but I’d love to see what other folks do with it. If you try it out:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;⭐ the repo on GitHub: &lt;a href="https://github.com/jimhill/glasatarjs" rel="noopener noreferrer"&gt;github.com/jimhill/glasatarjs&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;File issues / feature requests via &lt;a href="https://x.com/jimhilluk" rel="noopener noreferrer"&gt;x.com/jimhilluk&lt;/a&gt; or &lt;a href="https://bsky.app/profile/jimhill.uk" rel="noopener noreferrer"&gt;bsky.app/profile/jimhill.uk&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Share your designs in the comments &lt;/li&gt;
&lt;li&gt;Share a demo if you make something cool!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thanks for checking it out. Hope it helps. ✌️&lt;/p&gt;

</description>
      <category>react</category>
      <category>webgl</category>
      <category>ui</category>
      <category>ai</category>
    </item>
  </channel>
</rss>
