<?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: Nigisa Yamada</title>
    <description>The latest articles on DEV Community by Nigisa Yamada (@nagisa_yamada).</description>
    <link>https://dev.to/nagisa_yamada</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%2F3951799%2F6fb7670d-cae6-474d-ab27-bde02caccbb8.png</url>
      <title>DEV Community: Nigisa Yamada</title>
      <link>https://dev.to/nagisa_yamada</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/nagisa_yamada"/>
    <language>en</language>
    <item>
      <title>Building a Browser-Based Focus Timer with Web Audio API and Picture-in-Picture</title>
      <dc:creator>Nigisa Yamada</dc:creator>
      <pubDate>Sun, 31 May 2026 07:27:24 +0000</pubDate>
      <link>https://dev.to/nagisa_yamada/building-a-browser-based-focus-timer-with-web-audio-api-and-picture-in-picture-3fae</link>
      <guid>https://dev.to/nagisa_yamada/building-a-browser-based-focus-timer-with-web-audio-api-and-picture-in-picture-3fae</guid>
      <description>&lt;p&gt;I built Pomoria, a browser-based focus timer that combines custom work and break sequences, ambient sound generation, notes, and Picture-in-Picture.&lt;/p&gt;

&lt;p&gt;At first glance, it may look like another Pomodoro timer. But the part I found most interesting was not the countdown itself. It was building a small focus environment directly inside the browser.&lt;/p&gt;

&lt;p&gt;Most Pomodoro apps are based on a fixed 25/5 loop. That works for some tasks, but not for everything. Studying for an exam, writing, coding, or reviewing a long project often has a different rhythm.&lt;/p&gt;

&lt;p&gt;For example, a study session might look like this:&lt;/p&gt;

&lt;p&gt;setup&lt;br&gt;
60-minute attempt&lt;br&gt;
short break&lt;br&gt;
review&lt;br&gt;
correction&lt;br&gt;
cooldown&lt;/p&gt;

&lt;p&gt;I wanted a timer where each step could have its own duration, notes, and sound context.&lt;/p&gt;

&lt;p&gt;The audio engine&lt;/p&gt;

&lt;p&gt;The core audio system is built with the Web Audio API.&lt;/p&gt;

&lt;p&gt;Instead of only playing background audio files, Pomoria generates and mixes several sound layers locally in the browser:&lt;/p&gt;

&lt;p&gt;white noise&lt;br&gt;
pink noise&lt;br&gt;
brown noise&lt;br&gt;
rain-like ambience&lt;br&gt;
binaural tones&lt;br&gt;
metronome sounds&lt;br&gt;
premium soundscape loops&lt;/p&gt;

&lt;p&gt;The app creates an AudioContext and builds a simple mastering chain with gain, EQ, compression, an analyser, and output nodes.&lt;/p&gt;

&lt;p&gt;Conceptually, the audio graph looks like this:&lt;/p&gt;

&lt;p&gt;sound layers&lt;br&gt;
-&amp;gt; atmosphere / binaural / generative buses&lt;br&gt;
-&amp;gt; master gain&lt;br&gt;
-&amp;gt; EQ&lt;br&gt;
-&amp;gt; compressor&lt;br&gt;
-&amp;gt; output gain&lt;br&gt;
-&amp;gt; analyser&lt;br&gt;
-&amp;gt; speakers&lt;/p&gt;

&lt;p&gt;This makes it possible to control the whole sound environment from one place while still letting each layer behave independently.&lt;/p&gt;

&lt;p&gt;Noise colors&lt;/p&gt;

&lt;p&gt;White noise is generated by filling an audio buffer with random values.&lt;/p&gt;

&lt;p&gt;Pink noise and brown noise need a little more shaping.&lt;/p&gt;

&lt;p&gt;Pink noise feels softer and more balanced than white noise. Brown noise is deeper and warmer. This difference matters because in a focus app, sound is not just decoration. It changes how aggressive or calm the work environment feels.&lt;/p&gt;

&lt;p&gt;I wanted users to be able to choose the kind of masking that fits the session.&lt;/p&gt;

&lt;p&gt;Smooth transitions&lt;/p&gt;

&lt;p&gt;One thing I learned quickly: sudden audio changes are distracting.&lt;/p&gt;

&lt;p&gt;So volume changes are scheduled gradually instead of jumping immediately. For longer soundscape loops, I also used crossfading so the loop does not restart in an obvious way.&lt;/p&gt;

&lt;p&gt;This is a small detail, but it matters a lot for an app that is supposed to help people stay focused.&lt;/p&gt;

&lt;p&gt;Picture-in-Picture without a real video&lt;/p&gt;

&lt;p&gt;Another feature I wanted was a timer that stays visible while working in another tab or app.&lt;/p&gt;

&lt;p&gt;To do this, Pomoria draws the timer interface to a canvas, turns that canvas into a video source, and sends the video element into Picture-in-Picture.&lt;/p&gt;

&lt;p&gt;So the PiP window is not a normal video. It is a live timer view.&lt;/p&gt;

&lt;p&gt;It can show the current step, remaining time, visual progress, and different timer styles.&lt;/p&gt;

&lt;p&gt;I also connected the timer state to the Media Session API, so play and pause controls can reflect the session state.&lt;/p&gt;

&lt;p&gt;Why build it this way?&lt;/p&gt;

&lt;p&gt;Because I think a focus timer is not only about measuring time.&lt;/p&gt;

&lt;p&gt;It is also about rhythm, sound, visibility, and flow.&lt;/p&gt;

&lt;p&gt;A normal timer asks: how much time is left?&lt;/p&gt;

&lt;p&gt;I wanted Pomoria to ask a slightly different question: what kind of environment helps you stay with the work?&lt;/p&gt;

&lt;p&gt;That is why I am trying to describe it as a focus environment rather than only a Pomodoro timer.&lt;/p&gt;

&lt;p&gt;What I learned&lt;/p&gt;

&lt;p&gt;Web Audio API is powerful enough for lightweight generative ambience.&lt;/p&gt;

&lt;p&gt;Picture-in-Picture can be useful even when the app is not a video app.&lt;/p&gt;

&lt;p&gt;Browser autoplay restrictions force you to design around user interaction.&lt;/p&gt;

&lt;p&gt;Small UX details, like fade-ins and persistent visibility, matter a lot in productivity tools.&lt;/p&gt;

&lt;p&gt;A timer becomes more interesting when time, sound, notes, and session structure are designed together.&lt;/p&gt;

&lt;p&gt;Try it&lt;/p&gt;

&lt;p&gt;Pomoria is live here:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://pomoria.app" rel="noopener noreferrer"&gt;https://pomoria.app&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I would love feedback, especially on the audio controls, the Picture-in-Picture experience, and whether “focus environment” makes sense as positioning.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>react</category>
      <category>web</category>
    </item>
  </channel>
</rss>
