<?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: Jason Liang</title>
    <description>The latest articles on DEV Community by Jason Liang (@aiacstudio).</description>
    <link>https://dev.to/aiacstudio</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4263420%2F71029a99-73bb-460f-8e25-82fc6dad3d73.jpg</url>
      <title>DEV Community: Jason Liang</title>
      <link>https://dev.to/aiacstudio</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/aiacstudio"/>
    <language>en</language>
    <item>
      <title>Calibrating a Pure JavaScript ITU-R BS.1770-4 Loudness &amp; 48-Tap 4x Polyphase FIR True Peak Meter Against EBU Tech 3341</title>
      <dc:creator>Jason Liang</dc:creator>
      <pubDate>Thu, 26 Nov 2026 20:03:28 +0000</pubDate>
      <link>https://dev.to/aiacstudio/calibrating-a-pure-javascript-itu-r-bs1770-4-loudness-48-tap-4x-polyphase-fir-true-peak-meter-27m4</link>
      <guid>https://dev.to/aiacstudio/calibrating-a-pure-javascript-itu-r-bs1770-4-loudness-48-tap-4x-polyphase-fir-true-peak-meter-27m4</guid>
      <description>&lt;p&gt;Implementing an ITU-R BS.1770-4 loudness meter in pure JavaScript is straightforward to approximate and surprisingly easy to get wrong by 0.2 to 2.0 dB. Two shortcuts account for almost every broken web meter: hardcoding the 48 kHz K-weighting biquad coefficients for 44.1 kHz files, and substituting a 4-point cubic spline for the Annex 2 True Peak oversampling filter.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Why Cubic Splines Miss
&lt;/h2&gt;

&lt;p&gt;𝑓&lt;br&gt;
𝑠&lt;br&gt;
/&lt;br&gt;
4&lt;br&gt;
f&lt;br&gt;
s&lt;br&gt;
    ​&lt;/p&gt;

&lt;p&gt;/4 45-Degree Overshoots by ~2 dB&lt;/p&gt;

&lt;p&gt;Digital-to-analog converters and lossy codecs (Ogg Vorbis, AAC) reconstruct continuous waveforms between discrete PCM samples. The canonical stress test is a full-scale sine wave at f=fs​/4 sampled at a &lt;strong&gt;45-degree phase offset&lt;/strong&gt;:&lt;/p&gt;

&lt;p&gt;x[n]=2​sin(4π​+2nπ​)⟹{+1,+1,−1,−1,…}&lt;/p&gt;

&lt;p&gt;Every stored sample sits safely at 0.00 dBFS, yet the true continuous peak halfway between the consecutive +1 samples reaches 2​≈1.4142, or &lt;strong&gt;+3.01 dBTP&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Naive JavaScript meters often try to detect inter-sample peaks with cubic polynomial or spline interpolation instead of FIR oversampling. That fails mathematically because short cubic kernels suffer severe high-frequency roll-off near fs​/4:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Catmull-Rom / 4-point Lagrange cubic:&lt;/strong&gt; At the midpoint (t=0.5), the kernel &lt;code&gt;[-1/16, 9/16, 9/16, -1/16]&lt;/code&gt; evaluates &lt;code&gt;[-1, +1, +1, -1]&lt;/code&gt; to 1620​=1.25 (+1.94 dBTP)—already under-reading by &lt;strong&gt;1.07 dB&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cubic B-splines and damped/monotonic Hermite splines:&lt;/strong&gt; Widely copied from graphics libraries, a cubic B-spline attenuates fs​/4 signals by −3.77 dB at the midpoint, while monotonic splines clamp slopes to zero whenever consecutive samples tie (&lt;code&gt;+1, +1&lt;/code&gt;), reading &lt;strong&gt;0.00 dBTP&lt;/strong&gt;. Across real-world high-frequency transients and 45-degree fs​/4 bursts, spline estimators routinely under-report true peaks by &lt;strong&gt;~2 dB&lt;/strong&gt;, clearing masters that hard-clip during streaming transcoding.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2&gt;
  
  
  2. Exact BS.1770-4 K-Weighting + 48-Tap 4x Polyphase FIR in Pure JS
&lt;/h2&gt;

&lt;p&gt;JavaScript's &lt;code&gt;Number&lt;/code&gt; type is natively IEEE-754 &lt;code&gt;Float64&lt;/code&gt;, which avoids single-precision quantization drift in low-frequency IIR filters—provided you compute both K-weighting biquad stages dynamically for the buffer's actual &lt;code&gt;sampleRate&lt;/code&gt; via the bilinear transform:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Stage 1 (Pre-filter High-Shelf):&lt;/strong&gt; +4.0 dB shelf centered near 1681.97 Hz (Q≈0.707175), modeling acoustic head diffraction.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stage 2 (RLB High-Pass):&lt;/strong&gt; Second-order high-pass near 38.135 Hz (Q≈0.500327), attenuating sub-bass rumble.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Hardcoding the 48 kHz coefficients from the BS.1770-4 table onto a 44.1 kHz Red Book master shifts both corner frequencies downward by ~8.8%, introducing measurable error on bass-heavy mixes.&lt;/p&gt;

&lt;p&gt;For True Peak detection, implement the exact &lt;strong&gt;Annex 2 48-tap 4x oversampling FIR filter&lt;/strong&gt; decomposed into 4 polyphase sub-filters of 12 taps each. Each input sample yields 4 candidate peaks using only 12 multiply-adds per phase:&lt;/p&gt;

&lt;p&gt;JavaScript&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// 4x polyphase FIR True Peak inner loop (4 phases x 12 taps = 48 taps)&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;maxTruePeak&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;samples&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;delayLine&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;writeIdx&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;samples&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;acc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;POLYPHASE_48&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;acc&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;delayLine&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;writeIdx&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;]&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="n"&gt;mag&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;abs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;acc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mag&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;maxTruePeak&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;maxTruePeak&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;mag&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;writeIdx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;writeIdx&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;12&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="n"&gt;truePeakDb&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log10&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;maxTruePeak&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because phase 0 reproduces the original discrete sample and phases 1–3 evaluate the windowed-sinc fractional delays (+0.25,+0.50,+0.75 samples), passband droop stays flat through fs​/4, accurately capturing the +3.01 dBTP overshoot.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. EBU Tech 3341 Calibration Workflow (
&lt;/h2&gt;

&lt;p&gt;±&lt;br&gt;
0.011&lt;br&gt;
 LU&lt;br&gt;
±0.011 LU / &lt;br&gt;
+&lt;br&gt;
0.108&lt;br&gt;
 dBTP&lt;br&gt;
+0.108 dBTP)&lt;/p&gt;

&lt;p&gt;Before shipping a loudness meter, validate it programmatically against the official &lt;strong&gt;EBU Tech 3341&lt;/strong&gt; compliance test vectors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Two-stage gating vectors (&lt;code&gt;seq-3341-1&lt;/code&gt; to &lt;code&gt;seq-3341-7&lt;/code&gt;):&lt;/strong&gt; Verify the 400 ms block (75% overlap / 100 ms step) loudness math, the −70 LUFS absolute gate, and the Γr​=Γa​−10 LU relative gate across stepped bursts and multi-channel sums.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Frequency &amp;amp; real-program vectors (&lt;code&gt;seq-3341-8&lt;/code&gt; to &lt;code&gt;seq-3341-14&lt;/code&gt;):&lt;/strong&gt; Validate Momentary (400 ms), Short-Term (3 s), and Integrated Loudness across multiple sample rates and dynamic mixes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;True Peak vectors (&lt;code&gt;seq-3341-15&lt;/code&gt; and &lt;code&gt;seq-3341-16&lt;/code&gt;):&lt;/strong&gt; Feed phase-shifted fs​/4 sinusoids and impulses to check overshoot bounds.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;EBU Tech 3341 requires loudness accuracy within &lt;strong&gt;±0.1 LU&lt;/strong&gt; and True Peak accuracy within &lt;strong&gt;−0.4/+0.2 dBTP&lt;/strong&gt;. With &lt;code&gt;Float64&lt;/code&gt; bilinear K-weighting and the 48-tap polyphase FIR filter, measured worst-case deviation across the compliance suite tightens to &lt;strong&gt;±0.011 LU&lt;/strong&gt; on integrated loudness and &lt;strong&gt;+0.108 dBTP&lt;/strong&gt; on True Peak.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Production Delivery Targets
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Platform / Standard&lt;/th&gt;
&lt;th&gt;Integrated Target&lt;/th&gt;
&lt;th&gt;True Peak Ceiling&lt;/th&gt;
&lt;th&gt;Practical Engineering Note&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Spotify&lt;/td&gt;
&lt;td&gt;-14.0 LUFS&lt;/td&gt;
&lt;td&gt;-1.0 dBTP (-2.0 dBTP for loud masters)&lt;/td&gt;
&lt;td&gt;Normalization turns loud masters down; extra ceiling absorbs Ogg Vorbis/AAC overshoot&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Apple Music / Podcasts&lt;/td&gt;
&lt;td&gt;-16.0 LUFS (-19.0 LUFS mono podcasts)&lt;/td&gt;
&lt;td&gt;-1.0 dBTP&lt;/td&gt;
&lt;td&gt;Matches Apple Sound Check and AES TD1008 podcast guidance&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;EBU R128 Broadcast&lt;/td&gt;
&lt;td&gt;-23.0 ± 0.5 LUFS&lt;/td&gt;
&lt;td&gt;-1.0 dBTP&lt;/td&gt;
&lt;td&gt;Strict European broadcast delivery compliance&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You can inspect Integrated, Short-Term, Momentary, LRA, and 48-tap FIR True Peak locally in your browser using &lt;a href="https://aiac.app/lufs-meter/" rel="noopener noreferrer"&gt;AIAC's LUFS Meter&lt;/a&gt;, and pull version-controlled platform normalization specs for CI/CD mastering checks from &lt;a href="https://github.com/WaterJason/streaming-lufs-targets" rel="noopener noreferrer"&gt;WaterJason/streaming-lufs-targets&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Ready to turn these engineering guides into shipping assets:&lt;/p&gt;

</description>
      <category>webdevsecutypographyjavascr</category>
    </item>
    <item>
      <title>The Quiet Tax Inside AI Subscriptions: What 18 Image &amp; Video Models Actually Cost Per Output in 2026</title>
      <dc:creator>Jason Liang</dc:creator>
      <pubDate>Thu, 26 Nov 2026 19:44:33 +0000</pubDate>
      <link>https://dev.to/aiacstudio/the-quiet-tax-inside-ai-subscriptions-what-18-image-video-models-actually-cost-per-output-in-2026-50me</link>
      <guid>https://dev.to/aiacstudio/the-quiet-tax-inside-ai-subscriptions-what-18-image-video-models-actually-cost-per-output-in-2026-50me</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzlx3lefau5o3cb1ouhxd.webp" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fzlx3lefau5o3cb1ouhxd.webp" alt="The Quiet Tax Inside AI Subscriptions: What 18 Image &amp;amp; Video Models Actually Cost Per Output in 2026" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Last Tuesday, I exported three months of credit-card statements for my design studio and found an uncomfortable line item: $114 a month disappearing into four separate AI image and video subscriptions.&lt;/p&gt;

&lt;p&gt;When I cross-referenced those bills against the actual assets delivered to clients, the math got ugly fast. Across three of those platforms, roughly 70% of my monthly credits had evaporated on billing reset day.&lt;/p&gt;

&lt;p&gt;Software-as-a-service trained us to accept flat monthly tiers because server costs for text apps were predictable. Generative media breaks that contract. Every frame of 4K video and every 8K hero render carries a hard, variable compute bill, and platforms protect their margins by wrapping those costs in opaque credit pools that expire every thirty days.&lt;/p&gt;

&lt;p&gt;The industry calls this &lt;strong&gt;credit breakage&lt;/strong&gt;. You pay for capacity you never touch, or worse, you burn leftover tokens on throwaway prompts at 11:00 PM on the 30th just to feel like you got your money’s worth.&lt;/p&gt;

&lt;p&gt;To see what a single asset actually costs without the subscription fog, I benchmarked 18 leading image and video models against a transparent baseline: &lt;strong&gt;$0.01 per credit&lt;/strong&gt; (the equivalent of a $5, never-expiring 500-credit pack).&lt;/p&gt;

&lt;h2&gt;
  
  
  What Still Images Actually Cost Per Render
&lt;/h2&gt;

&lt;p&gt;Once you strip away "Pro" and "Ultra" tier marketing, still-image generation spans a 16x price gap from rough wireframe to print-ready art. Most creative workflows only need the bottom tier for 80% of the job.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Cost / Image&lt;/th&gt;
&lt;th&gt;Credit Cost&lt;/th&gt;
&lt;th&gt;Best Production Use Case&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;FLUX.2 Klein 4B&lt;/td&gt;
&lt;td&gt;~$0.01/img&lt;/td&gt;
&lt;td&gt;1 cr&lt;/td&gt;
&lt;td&gt;Fast layout &amp;amp; prompt checks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FLUX 3 Image Klein&lt;/td&gt;
&lt;td&gt;~$0.03/img&lt;/td&gt;
&lt;td&gt;3 cr&lt;/td&gt;
&lt;td&gt;Rapid concept iteration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GPT Image 2.6&lt;/td&gt;
&lt;td&gt;~$0.05/img&lt;/td&gt;
&lt;td&gt;5 cr (1K low; ~$0.10 med)&lt;/td&gt;
&lt;td&gt;Typography + up to 16 refs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Nano Banana 2.1&lt;/td&gt;
&lt;td&gt;~$0.07/img&lt;/td&gt;
&lt;td&gt;7 cr&lt;/td&gt;
&lt;td&gt;Identity/product consistency, up to 14 refs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ideogram 4.5&lt;/td&gt;
&lt;td&gt;~$0.08/img&lt;/td&gt;
&lt;td&gt;8 cr&lt;/td&gt;
&lt;td&gt;Posters &amp;amp; legible text&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Seedream 5.5&lt;/td&gt;
&lt;td&gt;~$0.10/img&lt;/td&gt;
&lt;td&gt;10 cr&lt;/td&gt;
&lt;td&gt;Commercial product realism&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;FLUX 3 Image&lt;/td&gt;
&lt;td&gt;~$0.12/img&lt;/td&gt;
&lt;td&gt;12 cr&lt;/td&gt;
&lt;td&gt;4K editorial visuals&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kling Image 4.0&lt;/td&gt;
&lt;td&gt;~$0.16/img&lt;/td&gt;
&lt;td&gt;16 cr&lt;/td&gt;
&lt;td&gt;Up to 8K print/hero&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Look at the spread between &lt;strong&gt;FLUX.2 Klein 4B&lt;/strong&gt; at a penny per frame and &lt;strong&gt;Kling Image 4.0&lt;/strong&gt; at sixteen cents.&lt;/p&gt;

&lt;p&gt;Testing lighting angles or composition on an 8K hero model is pure waste. You can run sixteen layout experiments on Klein 4B for the price of one Kling 4.0 output, or validate brand packaging across 14 reference angles on &lt;strong&gt;Nano Banana 2.1&lt;/strong&gt; for seven cents before committing to a final render.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Real Unit Economics of AI Video
&lt;/h2&gt;

&lt;p&gt;If still-image pricing is a slow leak, video subscriptions are an open hydrant. Because video bills by the second, a few bad camera pans can wipe out a $30 monthly plan in an afternoon.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Cost / Second&lt;/th&gt;
&lt;th&gt;Credit Rate &amp;amp; Sample Clip&lt;/th&gt;
&lt;th&gt;Best Production Use Case&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Grok Imagine Video 1.5 Lite&lt;/td&gt;
&lt;td&gt;~$0.06/s&lt;/td&gt;
&lt;td&gt;6 cr/s (5s ~$0.30)&lt;/td&gt;
&lt;td&gt;Cheapest motion testbed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;MiniMax H3&lt;/td&gt;
&lt;td&gt;~$0.07/s&lt;/td&gt;
&lt;td&gt;7 cr/s (4s ~$0.28)&lt;/td&gt;
&lt;td&gt;Fast turntables &amp;amp; B-roll drafts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Veo 3.1 Lite&lt;/td&gt;
&lt;td&gt;~$0.10/s&lt;/td&gt;
&lt;td&gt;10 cr/s (4s ~$0.40)&lt;/td&gt;
&lt;td&gt;Budget audio-synced drafts&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Wan 3.0&lt;/td&gt;
&lt;td&gt;~$0.12/s&lt;/td&gt;
&lt;td&gt;12 cr/s (4s ~$0.48)&lt;/td&gt;
&lt;td&gt;Native audio, 2-30s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Kling 3.0 / Seedance 2.5 Flash&lt;/td&gt;
&lt;td&gt;~$0.22/s&lt;/td&gt;
&lt;td&gt;22 cr/s&lt;/td&gt;
&lt;td&gt;Mid-tier motion previews&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Veo 3.1 Fast&lt;/td&gt;
&lt;td&gt;~$0.28/s&lt;/td&gt;
&lt;td&gt;28 cr/s (4s ~$1.12)&lt;/td&gt;
&lt;td&gt;48% cheaper than full Veo 3.1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Seedance 2.5 / Kling 4.0&lt;/td&gt;
&lt;td&gt;~$0.36/s&lt;/td&gt;
&lt;td&gt;36 cr/s (3-4s ~$1.08-$1.44)&lt;/td&gt;
&lt;td&gt;Cinema motion &amp;amp; physics&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Veo 3.1&lt;/td&gt;
&lt;td&gt;~$0.54/s&lt;/td&gt;
&lt;td&gt;54 cr/s (4s ~$2.16)&lt;/td&gt;
&lt;td&gt;Flagship 4K + native audio&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Notice that &lt;strong&gt;Veo 3.1&lt;/strong&gt; runs $0.54 a second—$2.16 for a single four-second shot. Meanwhile, &lt;strong&gt;Grok Imagine Video 1.5 Lite&lt;/strong&gt; tests motion physics for six cents a second, and &lt;strong&gt;Veo 3.1 Fast&lt;/strong&gt; delivers nearly identical temporal coherence at $0.28/s, cutting the cost by 48% before you ever touch the flagship tier.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Subscription Math Punishes Real Production
&lt;/h2&gt;

&lt;p&gt;Standard creative billing follows a predictable rhythm: busy during a sprint, quiet during client feedback rounds. Monthly AI subscriptions assume the exact opposite—steady, linear consumption every single week.&lt;/p&gt;

&lt;p&gt;When you carry three or four $20–$30 subscriptions ($90–$120/mo) just to keep access to specific strengths—say, Ideogram for type, Nano Banana for character consistency, and Veo or Kling for motion—60% to 80% of those pooled credits routinely expire unused. Worse, when a deadline hits and you need twenty extra video takes on one platform, you either hit a hard wall or get forced into an enterprise tier upgrade you won't need next week.&lt;/p&gt;

&lt;h2&gt;
  
  
  The "Draft-Then-Hero" Workflow: Cutting Clip Costs by 73.5%
&lt;/h2&gt;

&lt;p&gt;Treating every prompt like a final render is the fastest way to burn cash. Instead, split generation into three deliberate stages where cheap models absorb the trial-and-error phase.&lt;/p&gt;

&lt;p&gt;Suppose you need one clean, four-second commercial product shot with synchronized audio:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Brute-Force Approach:&lt;/strong&gt; Running five takes directly on &lt;strong&gt;Veo 3.1&lt;/strong&gt; ($2.16 per 4s clip) until the camera movement and lighting cooperate costs &lt;strong&gt;$10.80&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stage 1 — Still Composition ($0.10):&lt;/strong&gt; Lock down the exact product geometry, lighting, and brand label first using two prompt checks on &lt;strong&gt;FLUX.2 Klein 4B&lt;/strong&gt; ($0.02) and one final hero frame on &lt;strong&gt;Ideogram 4.5&lt;/strong&gt; ($0.08).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stage 2 — Motion Blocking ($0.60):&lt;/strong&gt; Feed that verified still into &lt;strong&gt;Grok Imagine Video 1.5 Lite&lt;/strong&gt; for two 5-second motion tests ($0.30 each) to verify camera drift and object stability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stage 3 — Hero Polish ($2.16):&lt;/strong&gt; Take the winning seed and motion prompt into &lt;strong&gt;Veo 3.1&lt;/strong&gt; for a single four-second 4K + native audio master render.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Total spend: &lt;strong&gt;$2.86&lt;/strong&gt; instead of &lt;strong&gt;$10.80&lt;/strong&gt;—a &lt;strong&gt;73.5% cost reduction&lt;/strong&gt; with better art direction, because you solved composition before paying for time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three Honest Setups to Ditch Subscription Lock-In
&lt;/h2&gt;

&lt;p&gt;If you are ready to stop paying a monthly tax for idle accounts, three practical architectures eliminate credit expiration:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Local ComfyUI + RTX GPU:&lt;/strong&gt; If you generate hundreds of frames daily and own an NVIDIA card with 16GB–24GB of VRAM, running open-weights models like FLUX.2 Klein 4B or Wan locally drops your marginal cost to electricity. The trade-off is upfront hardware capital, driver maintenance, and zero access to closed frontier models like Veo 3.1 or GPT Image 2.6.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Developer API Playgrounds (fal.ai / Replicate):&lt;/strong&gt; Paying raw per-second and per-megapixel rates directly through developer endpoints gives you total cost transparency and zero monthly minimums. It works well if you are comfortable managing API keys, JSON payloads, and local file organization, though juggling multiple dashboards gets clunky mid-client call.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unified Pay-As-You-Go Web Studios:&lt;/strong&gt; For designers and filmmakers who want browser convenience without recurring bills, &lt;a href="https://creoart.app/pay-as-you-go-ai-generator" rel="noopener noreferrer"&gt;CreoArt's pay-as-you-go AI studio&lt;/a&gt; puts 45 image and video models under one never-expiring $5+ wallet. Every run shows an upfront credit quote before you click generate, keeps commercial work off public galleries with a strict 30-day maximum retention window, and includes an ad-free, local browser PSD editor so you can fix that last 5% of typography or masking without burning another generation credit.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The models themselves aren't overpriced—penny concept renders and thirty-cent motion tests are remarkably cheap compute. You only overpay when you let subscription billing charge you for the days you aren't rendering.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Author Bio:&lt;/strong&gt; Jason is the founder of &lt;a href="https://creoart.app/" rel="noopener noreferrer"&gt;CreoArt&lt;/a&gt;, a pay-as-you-go private AI image and video studio uniting 45 leading models under one never-expiring credit wallet, paired with a free ad-free browser PSD editor.&lt;/p&gt;




&lt;h2&gt;
  
  
  Companion Submission Pitch Email (For Editors)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Subject:&lt;/strong&gt; Original data column pitch: What 18 AI image &amp;amp; video models actually cost per output in 2026&lt;/p&gt;

&lt;p&gt;Hi [Editor Name],&lt;/p&gt;

&lt;p&gt;I've been following [Publication Name]'s coverage of AI creative tools and wanted to pitch a practical, zero-fluff cost breakdown for your readers:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Title:&lt;/strong&gt; &lt;em&gt;The Quiet Tax Inside AI Subscriptions: What 18 Image &amp;amp; Video Models Actually Cost Per Output in 2026&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What's inside (~1,200 words, 100% original):&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Real unit-cost benchmarks across 18 leading 2026 image &amp;amp; video models (&lt;code&gt;$0.01/img&lt;/code&gt; to &lt;code&gt;$0.54/sec&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;The hidden "credit breakage" math behind carrying 3–4 monthly creator subscriptions.&lt;/li&gt;
&lt;li&gt;A concrete 3-stage "Draft-Then-Hero" production workflow that cuts commercial video clip spend by &lt;strong&gt;73.5%&lt;/strong&gt; (&lt;code&gt;$10.80&lt;/code&gt; → &lt;code&gt;$2.86&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Objective comparison of local ComfyUI, developer API playgrounds, and unified pay-as-you-go web studios.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Happy to send the full Markdown/Google Doc right over if it fits your editorial calendar.&lt;/p&gt;

&lt;p&gt;Best,&lt;br&gt;&lt;br&gt;
Jason&lt;br&gt;&lt;br&gt;
CreoArt Studio (&lt;code&gt;support@creoart.app&lt;/code&gt;)&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>saas</category>
    </item>
    <item>
      <title>Why Public AI Galleries Quietly Break Client NDAs—And How Creative Studios Audit Private Workflows in 2026</title>
      <dc:creator>Jason Liang</dc:creator>
      <pubDate>Thu, 26 Nov 2026 19:44:20 +0000</pubDate>
      <link>https://dev.to/aiacstudio/why-public-ai-galleries-quietly-break-client-ndas-and-how-creative-studios-audit-private-workflows-52mk</link>
      <guid>https://dev.to/aiacstudio/why-public-ai-galleries-quietly-break-client-ndas-and-how-creative-studios-audit-private-workflows-52mk</guid>
      <description>&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fco1gsn1fdqu1r787tk3s.jpg" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fco1gsn1fdqu1r787tk3s.jpg" alt="Why Public AI Galleries Quietly Break Client NDAs—And How Creative Studios Audit Private Workflows in 2026" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A junior art director logs into a consumer image generator using a corporate card, uploads an embargoed product render for a Q4 hardware launch, and runs twelve lighting variations. Twenty minutes later, three of those variations are live on a public "Explore" feed, indexed by search engines alongside the exact prompt containing the unreleased product's codename.&lt;/p&gt;

&lt;p&gt;No one got hacked. No API keys leaked. The studio violated its master services agreement simply by using software configured for hobbyists rather than commercial production.&lt;/p&gt;

&lt;p&gt;Most creative agencies spend weeks negotiating indemnity clauses and intellectual property ownership with enterprise clients, only to route pre-launch campaign assets through self-serve generative tools governed by consumer terms of service. By 2026, generative image and video tools sit inside nearly every pitch deck, storyboard, and key-visual pipeline. Yet creative operations teams still audit these tools for output resolution and rendering speed while ignoring where source files go, who can view them, and how long they stay on third-party servers.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Four Leak Vectors Creative Ops Teams Miss
&lt;/h2&gt;

&lt;p&gt;When an agency signs a strict non-disclosure agreement, confidentiality obligations apply to intermediate drafts, mood boards, and unapproved concepts—not just final deliverables. Standard web-based generative platforms introduce four structural failure points that quietly breach those terms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Default-public Explore and community feeds:&lt;/strong&gt; Many popular image and video generators subsidize lower subscription tiers by turning user outputs into a social discovery feed. Unless a user upgrades to an expensive enterprise tier or toggles an obscure privacy switch on every session, generated assets and reference uploads publish automatically to a searchable public gallery.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Perpetual prompt and image indexing:&lt;/strong&gt; Public gallery items rarely stay confined to the platform. External crawlers and prompt-scraping databases archive public images alongside their text prompts, seed numbers, and aspect ratios. Even if a designer notices the mistake and deletes the post an hour later, cached thumbnails and prompt strings often remain accessible across third-party aggregators.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Indefinite cloud asset retention:&lt;/strong&gt; Consumer creative apps treat cloud storage as an infinite history log. Every failed rough draft, uploaded client wireframe, and raw reference photo sits in an unencrypted or multi-tenant bucket indefinitely. When a studio offboards a contractor or closes a client account, there is rarely an automated purge mechanism—leaving years of confidential visual IP sitting on vendor servers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Silent self-model training clauses in low-cost tiers:&lt;/strong&gt; While major foundation labs updated their enterprise API terms, dozens of consumer-facing studio wrappers and budget creative apps still bury broad license grants inside their standard terms of service. Paying $20 or $30 a month on a standard individual plan frequently grants the vendor a perpetual license to fine-tune proprietary weights or style models on your uploaded reference art and output pairs.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The 6-Point Creative Studio AI Privacy Audit Checklist
&lt;/h2&gt;

&lt;p&gt;Before approving any generative image, video, or retouching platform for billable client work, creative operations and IT leads should verify six non-negotiable technical controls:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Private-by-default object storage:&lt;/strong&gt; Every generated frame, video clip, and uploaded reference asset must write exclusively to isolated, private object storage scoped to the workspace. Privacy cannot rely on a per-generation toggle that a tired designer might forget at 11:00 PM before a pitch.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero public gallery or community feed:&lt;/strong&gt; The platform must have no public "Explore" stream, community showcase, or social remix feature connected to workspace accounts. If a vendor's business model relies on user-generated public galleries for organic acquisition, it does not belong in a commercial studio stack.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero self-model training on customer assets:&lt;/strong&gt; Vendor documentation must explicitly state that neither prompts, uploaded reference images, nor generated outputs are used to train, fine-tune, or evaluate internal models—regardless of whether the studio is on a starter plan or an enterprise contract.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;30-day maximum automatic retention:&lt;/strong&gt; Cloud workspaces are production conduits, not permanent digital asset management systems. Look for strict, enforced lifecycle policies—such as a 30-day maximum retention window—that automatically purge old generation artifacts so forgotten project folders do not accumulate liability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Instant 1-click single-asset deletion:&lt;/strong&gt; When a client kills a concept or requests immediate destruction of exploratory files under an NDA termination clause, producers cannot wait five business days for a support ticket. The interface must support immediate, permanent deletion of individual assets and their associated metadata.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Browser-local PSD retouching for sensitive composites:&lt;/strong&gt; Once a generative draft moves into final compositing, typography, and color grading, raw layered files should never need another round-trip to a remote server. Modern studio workflows keep layered PSD retouching local to the designer's machine so embargoed logos, talent faces, and packshots never leave local memory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Auditing existing stacks against these six rules quickly exposes why patchwork toolkits fail. Studios evaluating dedicated commercial environments like &lt;a href="https://creoart.app/" rel="noopener noreferrer"&gt;CreoArt&lt;/a&gt; increasingly look for platforms built around a &lt;a href="https://creoart.app/trust" rel="noopener noreferrer"&gt;verifiable privacy architecture&lt;/a&gt; from day one—combining isolated private storage, zero public feeds, automatic 30-day artifact expiration, and instant single-asset deletion without requiring a six-figure enterprise minimums contract.&lt;/p&gt;

&lt;p&gt;Similarly, separating cloud generation from final compositing closes the last mile of exposure. Pairing private cloud generation with a &lt;a href="https://creoart.app/photo-editor" rel="noopener noreferrer"&gt;browser-local WebGPU PSD editor&lt;/a&gt; lets retouchers open layered files, mask product renders, and adjust color profiles directly on local GPU hardware—ensuring raw client master files never touch an external upload queue.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Seat-Based Subscriptions Break Both Privacy and Agency Accounting
&lt;/h2&gt;

&lt;p&gt;Privacy failures and billing friction usually stem from the same root cause: buying consumer software on individual credit cards.&lt;/p&gt;

&lt;p&gt;In a typical mid-sized agency, a 15-person creative department ends up juggling four separate subscriptions—one for still imagery, one for video motion tests, one for upscaling, and one for background removal—at $30 to $60 per seat every month. That creates $1,800 to $3,600 in fixed monthly SaaS overhead regardless of whether the studio is in heavy production or a quiet pitch cycle. Worse, finance teams cannot cleanly attribute a $48 monthly seat license across three different client retainers, so creative software becomes unbillable agency overhead while producers share logins across freelancers—destroying audit trails in the process.&lt;/p&gt;

&lt;p&gt;Consolidating production inside a &lt;a href="https://creoart.app/pay-as-you-go-ai-generator" rel="noopener noreferrer"&gt;pay-as-you-go AI studio&lt;/a&gt; aligns technical governance with agency accounting. Instead of paying recurring seat fees for idle accounts, studios fund usage with never-expiring credits—starting with $5 starter packs for small pitch tests or $5 to $500 custom top-ups scaled to active production schedules.&lt;/p&gt;

&lt;p&gt;For creative operations and finance leads, usage-based credits solve three operational headaches at once:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Clean client pass-through billing:&lt;/strong&gt; Producers can allocate a dedicated credit balance or track exact generation spend per job number, passing direct production costs onto client invoices just like stock licensing or studio rental fees.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero seat-sharing compromises:&lt;/strong&gt; Because credits never expire and do not punish occasional users with recurring monthly fees, freelancers and account managers never need to share a single master login to avoid buying another $50 seat.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No lock-in to legacy consumer tiers:&lt;/strong&gt; Studios get full commercial privacy controls without having to negotiate annual seat commitments across four disconnected vendors.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Putting the Audit Into Practice Before the Next Pitch
&lt;/h2&gt;

&lt;p&gt;Client confidentiality does not fail because creative directors are careless; it fails when procurement leaves designers to solve production bottlenecks with public-first consumer tools. Run the six-point privacy audit across every image, video, and retouching tab currently open on your team's machines. Shut down any workflow that defaults to public feeds, retains files indefinitely, or trains on client uploads—and move billable production onto private, usage-tracked infrastructure before the next embargoed brief hits your inbox.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>privacy</category>
      <category>security</category>
    </item>
    <item>
      <title>The Hybrid E-Commerce Product Photo Workflow in 2026: Pay-As-You-Go AI Renders + Local PSD Layers</title>
      <dc:creator>Jason Liang</dc:creator>
      <pubDate>Thu, 26 Nov 2026 19:36:43 +0000</pubDate>
      <link>https://dev.to/aiacstudio/the-hybrid-e-commerce-product-photo-workflow-in-2026-pay-as-you-go-ai-renders-local-psd-layers-2mbi</link>
      <guid>https://dev.to/aiacstudio/the-hybrid-e-commerce-product-photo-workflow-in-2026-pay-as-you-go-ai-renders-local-psd-layers-2mbi</guid>
      <description>&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F24e9uwh7rcco7sd14k9n.jpg" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F24e9uwh7rcco7sd14k9n.jpg" alt="Hybrid E-Commerce AI Product Photography and Local PSD Layer Workflow 2026" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Independent e-commerce founders and creative directors face a binary trap every time a new SKU moves from sample approval to storefront launch. On one side sits the traditional commercial studio shoot: location scouting, prop styling, grip rentals, lighting assistants, and retouching fees routinely run &lt;strong&gt;$1,500 to $4,000 per SKU launch&lt;/strong&gt;, locking up working capital before a single ad impression is served. On the other side sit pure end-to-end AI image generators that promise instant lifestyle scenes, yet reliably hallucinate distorted bottle proportions, garble 6-point regulatory micro-typography, shift Pantone-matched packaging colors, and warp embossed foil logos. When a customer zooms in on an Amazon carousel or Shopify product page and sees unreadable ingredient lists or melted serif fonts, conversion rates collapse and return rates climb.&lt;/p&gt;

&lt;p&gt;The most resilient creative teams in 2026 have abandoned both extremes in favor of a &lt;strong&gt;4-step hybrid production pipeline&lt;/strong&gt;. Rather than asking a diffusion or autoregressive model to invent your physical packaging from scratch, you separate &lt;strong&gt;environment lighting&lt;/strong&gt; from &lt;strong&gt;product geometry&lt;/strong&gt;. AI renders the high-cost set design, caustic reflections, and directional shadows; a real smartphone or DSLR capture supplies the exact label, barcode, and color accuracy; and a local browser-based PSD workspace locks the two together in under 15 minutes per SKU without recurring SaaS burn or server-side asset leaks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Production Economics: Traditional Studio vs. Monthly AI vs. Hybrid Pipeline
&lt;/h2&gt;

&lt;p&gt;Before structuring the workflow, compare the unit economics and operational risk across a standard &lt;strong&gt;20-SKU seasonal catalog launch&lt;/strong&gt; (assuming 5 hero and lifestyle deliverables per SKU, or 100 final assets total):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Production Metric&lt;/th&gt;
&lt;th&gt;Traditional Studio Shoot&lt;/th&gt;
&lt;th&gt;Monthly AI Subscription Only&lt;/th&gt;
&lt;th&gt;Hybrid Pay-As-You-Go AI + Local PSD&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cost per 20-SKU Launch (100 Assets)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$30,000 – $80,000 ($1,500–$4,000/SKU)&lt;/td&gt;
&lt;td&gt;$360 – $1,188/yr + heavy retouching fixes&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;~$15 – $35 total&lt;/strong&gt; (pay-per-render credits)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Label &amp;amp; Micro-Typography Accuracy&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;100% optical fidelity&lt;/td&gt;
&lt;td&gt;Low (warped text, shifted hex codes)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;100% optical fidelity&lt;/strong&gt; (real product layer)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Pre-Launch NDA &amp;amp; Asset Security&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;High (controlled physical studio)&lt;/td&gt;
&lt;td&gt;Low (raw CAD/packaging uploaded to cloud)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;High&lt;/strong&gt; (local WebGPU PSD compositing)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Monthly Idle Subscription Burn&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;$0 (project-based, high minimum)&lt;/td&gt;
&lt;td&gt;$30 – $99/month during off-seasons&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;$0&lt;/strong&gt; (never-expiring credit packs from $5)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Turnaround Time per SKU&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;2 – 4 weeks (booking to delivery)&lt;/td&gt;
&lt;td&gt;1 – 2 hours (mostly prompt rerolls)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Under 15 minutes per SKU&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Step 1: Render Controlled Studio &amp;amp; Lifestyle Plates via Pay-As-You-Go Models
&lt;/h2&gt;

&lt;p&gt;Start by generating clean background plates and matched lighting environments rather than finished product composites. Using a &lt;a href="https://creoart.app/pay-as-you-go-ai-generator" rel="noopener noreferrer"&gt;pay-as-you-go AI image generator&lt;/a&gt; eliminates the $30–$99 monthly subscription waste that hits seasonal brands between product drops. Credit packs start at &lt;strong&gt;$5 for 500 credits&lt;/strong&gt; and never expire, allowing creative directors to match model cost strictly to creative stage:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Rapid Composition &amp;amp; Framing Tests (FLUX Fast Schnell — 1 credit / ~$0.01 per image):&lt;/strong&gt; Run 10 to 15 low-cost layout passes to lock camera angle, horizon line, surface texture, and negative space for typography overlays before spending higher credits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Photorealistic Material &amp;amp; Caustic Lighting (Nano Banana 2.1 — 8 credits / ~$0.08 per image &amp;amp; Seedream 5.0 Pro — 8 credits / ~$0.08 per image):&lt;/strong&gt; Once framing is locked, generate final surface plates with physically plausible subsurface scattering, stone grain, and natural shadow falloff.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Complex Multi-Prop Editorial Scenes (GPT Image 2.5 — 12 credits / ~$0.12 per image):&lt;/strong&gt; Use higher-reasoning spatial rendering when a scene requires intricate prop relationships, architectural depth, or strict adherence to multi-clause art direction.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To build reusable lighting environments tailored for e-commerce compositing, generate plates inside a dedicated &lt;a href="https://creoart.app/tools/ai-product-photography" rel="noopener noreferrer"&gt;AI product photography studio&lt;/a&gt; using structured camera, lens, and surface specifications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Copy-Paste Studio Lighting Prompts
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;1. Cosmetics Glass Bottle on Travertine (Warm Editorial Daylight)&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Commercial product photography background plate, empty honed beige Roman travertine stone plinth in center foreground, soft morning sunlight casting crisp diagonal window blind shadows across porous stone texture, warm cream plaster backdrop, shallow depth of field, shot on 85mm f/2.8 macro lens, neutral color temperature 5200K, clean negative space in center for bottle placement, realistic contact shadow zone, photorealistic editorial lighting, no product, no text&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;2. Matte Sneaker on Brutalist Concrete (High-Contrast Studio Key)&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Commercial footwear studio set, empty raw board-formed brutalist concrete block with subtle aggregate texture in lower third, dramatic single-source overhead strip softbox lighting creating crisp specular edge rim and deep directional floor shadow, cool slate grey seamless cyclorama background, 50mm lens, low three-quarter hero camera angle, ultra-sharp surface micro-contrast, clean center staging area, no shoe, no logos&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;strong&gt;3. Specialty Coffee Pouch on Sunlit Kitchen Counter (Authentic Lifestyle)&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Editorial kitchen lifestyle background plate, empty matte white quartz countertop in foreground, out-of-focus brushed stainless steel espresso machine and ceramic pour-over dripper on far right, warm golden hour sunlight streaming from left window across counter surface, soft oak cabinetry in background, shot on 35mm f/2.0 lens, natural filmic dynamic range, clear center surface space for standing pouch composite, no bag, no typography&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Step 2: Isolate the Real Product and Upscale Hero Plates
&lt;/h2&gt;

&lt;p&gt;Never trust an AI generator to redraw your physical SKU. Instead, shoot your actual physical sample on a clean neutral table or sweep using a tripod-mounted camera or modern smartphone in RAW/ProRAW mode. Match the camera elevation and focal perspective to the AI background plate you generated in Step 1 (for example, shooting at eye-level for a straight-on plinth render or a 15-degree downward tilt for a countertop scene).&lt;/p&gt;

&lt;p&gt;Run the real product photo through &lt;strong&gt;automated background removal (2 credits / ~$0.02 per image)&lt;/strong&gt; to produce a clean alpha-channel PNG with crisp edges around caps, zippers, stitching, or glass shoulders. Simultaneously, pass your chosen 1K AI background plate through &lt;strong&gt;AI upscaling (4 credits / ~$0.04 per image)&lt;/strong&gt; so the underlying stone, concrete, or wood grain holds sharp 2K/4K resolution when cropped for Retina desktop storefronts and vertical ad placements. Total spend for a complete hero background plate, cutout, and upscale lands between &lt;strong&gt;$0.07 and $0.18 per scene&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Composite Real Packaging Locally in a WebGPU Browser PSD Editor
&lt;/h2&gt;

&lt;p&gt;Uploading unreleased packaging designs, proprietary formulations, or embargoed Q4 SKUs to ad-heavy online photo editors introduces unnecessary intellectual property exposure. Opening a browser-based &lt;a href="https://creoart.app/photo-editor" rel="noopener noreferrer"&gt;client-side PSD photo editor&lt;/a&gt; keeps your raw product photography, layered PSD masters, and brand fonts strictly on your local machine. Because rendering runs via &lt;strong&gt;local WebGPU acceleration&lt;/strong&gt; with zero server-side image uploads—backed by transparent &lt;a href="https://creoart.app/trust" rel="noopener noreferrer"&gt;client-side privacy architecture&lt;/a&gt;—your unreleased SKUs never touch third-party storage buckets.&lt;/p&gt;

&lt;p&gt;Execute the composite in four deterministic layer steps:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Base Plate &amp;amp; Perspective Lock:&lt;/strong&gt; Place the upscaled AI background render on the bottom layer. Drop your alpha-cutout real product photograph on the layer above, scaling it so the base aligns with the AI surface's focal plane.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ambient Occlusion &amp;amp; Contact Shadow:&lt;/strong&gt; Duplicate the product cutout layer beneath the original, fill it with solid &lt;code&gt;#0F0E0D&lt;/code&gt;, squash its vertical height to 12–18% along the ground plane, apply a 6px Gaussian blur at 65% opacity (&lt;code&gt;Multiply&lt;/code&gt; blend mode), and tuck it directly under the product's base edge. Add a second soft directional shadow layer angled to match the AI plate's light source at 25% opacity.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Color Temperature &amp;amp; Specular Wrap:&lt;/strong&gt; Clip a subtle &lt;code&gt;Color Balance&lt;/code&gt; or &lt;code&gt;Photo Filter&lt;/code&gt; adjustment layer to the product cutout so warm sunlit highlights or cool studio rim lights wrap naturally across the edges of the glass, matte pouch, or leather upper.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Glass &amp;amp; Translucent Refraction (Optional):&lt;/strong&gt; For clear bottles or serums, set a duplicate of the background plate clipped above the glass body to &lt;code&gt;Hard Light&lt;/code&gt; or &lt;code&gt;Overlay&lt;/code&gt; at 18% opacity so the travertine or quartz texture refracts believably through the liquid while keeping the printed front label 100% opaque via a layer mask.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Step 4: Batch-Export Multi-Channel SKU Variants in Under 15 Minutes
&lt;/h2&gt;

&lt;p&gt;Because your master file retains non-destructive PSD layers, generating every required marketplace and paid-social aspect ratio takes less than three minutes once the hero composite is approved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Amazon Main Image (&lt;code&gt;2000 x 2000 px&lt;/code&gt;, 1:1):&lt;/strong&gt; Toggle off the AI lifestyle background layer, reveal a pure &lt;code&gt;#FFFFFF&lt;/code&gt; solid fill layer beneath your contact shadow, and export as sRGB JPEG at 92% quality to satisfy Amazon's strict white-background compliance rules while preserving your retouched studio lighting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shopify PDP Carousel (&lt;code&gt;2048 x 2560 px&lt;/code&gt;, 4:5):&lt;/strong&gt; Re-enable the AI studio or lifestyle background layer, nudge the product group slightly off-center if needed, and export in WebP or JPEG.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Meta &amp;amp; TikTok Paid Social (&lt;code&gt;1080 x 1920 px&lt;/code&gt;, 9:16):&lt;/strong&gt; Expand the canvas vertically—the negative space built into your Step 1 prompt leaves clean headroom for headline hooks, price callouts, or review badges without crowding the packaging.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Save the master &lt;code&gt;.psd&lt;/code&gt; locally in your SKU folder. When seasonal promos or packaging revisions arrive next quarter, you simply swap the real product layer inside the existing lighting and shadow stack—cutting marginal SKU visual production time to under five minutes while maintaining 100% label integrity across every sales channel.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>What One Second of AI Video Actually Costs in 2026: Kling 4.0 vs. Seedance 2.5 vs. Veo 3.1 vs. MiniMax H3</title>
      <dc:creator>Jason Liang</dc:creator>
      <pubDate>Thu, 26 Nov 2026 19:36:32 +0000</pubDate>
      <link>https://dev.to/aiacstudio/what-one-second-of-ai-video-actually-costs-in-2026-kling-40-vs-seedance-25-vs-veo-31-vs-4hmc</link>
      <guid>https://dev.to/aiacstudio/what-one-second-of-ai-video-actually-costs-in-2026-kling-40-vs-seedance-25-vs-veo-31-vs-4hmc</guid>
      <description>&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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn6i3yvvbe95toc2niet0.jpg" 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.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fn6i3yvvbe95toc2niet0.jpg" alt="2026 AI Video Per-Second Pricing Breakdown" width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Evaluating generative video tools through monthly subscription tiers obscures the only metric that affects production margins: the cost per usable second of footage. In late 2026, commercial video synthesis spans nearly an order of magnitude in price, running from $0.06 per second on lightweight drafting engines to $0.54 per second on flagship audiovisual models.&lt;/p&gt;

&lt;p&gt;When creative teams lock themselves into recurring monthly seat licenses, unused credits expire at the end of every billing cycle while heavy campaign weeks trigger punitive overage fees. Moving to a &lt;a href="https://creoart.app/pay-as-you-go-ai-generator" rel="noopener noreferrer"&gt;pay-as-you-go AI generator&lt;/a&gt; changes the unit economics entirely. Using a standard benchmark of $0.01 per credit on a $5, 500-credit never-expiring pack, every model can be measured on an identical, transparent per-second ledger.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 2026 Per-Second AI Video Pricing Matrix
&lt;/h2&gt;

&lt;p&gt;The table below reflects verified pay-as-you-go rates across twelve current video models, standardized by credit burn rate, baseline resolution, minimum clip duration, and native audio support.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Tier&lt;/th&gt;
&lt;th&gt;Credits / Sec&lt;/th&gt;
&lt;th&gt;Cost / Sec&lt;/th&gt;
&lt;th&gt;Baseline Resolution&lt;/th&gt;
&lt;th&gt;Min Clip &amp;amp; Cost&lt;/th&gt;
&lt;th&gt;Native Audio&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Grok Imagine Video 1.5 Lite&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tier 1: Drafting&lt;/td&gt;
&lt;td&gt;6 cr/s&lt;/td&gt;
&lt;td&gt;~$0.06/s&lt;/td&gt;
&lt;td&gt;480p&lt;/td&gt;
&lt;td&gt;1s (~$0.06)&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;MiniMax H3&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tier 1: Drafting&lt;/td&gt;
&lt;td&gt;7 cr/s&lt;/td&gt;
&lt;td&gt;~$0.07/s&lt;/td&gt;
&lt;td&gt;480p&lt;/td&gt;
&lt;td&gt;4s (~$0.28)&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Veo 3.1 Lite&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tier 1: Drafting&lt;/td&gt;
&lt;td&gt;10 cr/s&lt;/td&gt;
&lt;td&gt;~$0.10/s&lt;/td&gt;
&lt;td&gt;720p&lt;/td&gt;
&lt;td&gt;4s (~$0.40)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Wan 3.0 Prime&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tier 1: Drafting&lt;/td&gt;
&lt;td&gt;18 cr/s&lt;/td&gt;
&lt;td&gt;~$0.18/s&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;td&gt;2s (~$0.36)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;MAGI-2&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tier 2: Mid-Range&lt;/td&gt;
&lt;td&gt;20 cr/s&lt;/td&gt;
&lt;td&gt;~$0.20/s&lt;/td&gt;
&lt;td&gt;1080p&lt;/td&gt;
&lt;td&gt;4s (~$0.80)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Seedance 2.5 Flash&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tier 2: Mid-Range&lt;/td&gt;
&lt;td&gt;22 cr/s&lt;/td&gt;
&lt;td&gt;~$0.22/s&lt;/td&gt;
&lt;td&gt;480p&lt;/td&gt;
&lt;td&gt;4s (~$0.88)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Kling 4.0 Flash&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tier 2: Mid-Range&lt;/td&gt;
&lt;td&gt;23 cr/s&lt;/td&gt;
&lt;td&gt;~$0.23/s&lt;/td&gt;
&lt;td&gt;720p&lt;/td&gt;
&lt;td&gt;3s (~$0.69)&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Veo 3.1 Fast&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tier 2: Mid-Range&lt;/td&gt;
&lt;td&gt;28 cr/s&lt;/td&gt;
&lt;td&gt;~$0.28/s&lt;/td&gt;
&lt;td&gt;720p&lt;/td&gt;
&lt;td&gt;4s (~$1.12)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Seedance 2.5&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tier 3: Flagship&lt;/td&gt;
&lt;td&gt;36 cr/s&lt;/td&gt;
&lt;td&gt;~$0.36/s&lt;/td&gt;
&lt;td&gt;480p&lt;/td&gt;
&lt;td&gt;4s (~$1.44)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Kling 4.0&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tier 3: Flagship&lt;/td&gt;
&lt;td&gt;36 cr/s&lt;/td&gt;
&lt;td&gt;~$0.36/s&lt;/td&gt;
&lt;td&gt;720p&lt;/td&gt;
&lt;td&gt;3s (~$1.08)&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;FLUX 3 Video&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tier 3: Flagship&lt;/td&gt;
&lt;td&gt;38 cr/s&lt;/td&gt;
&lt;td&gt;~$0.38/s&lt;/td&gt;
&lt;td&gt;720p&lt;/td&gt;
&lt;td&gt;5s (~$1.90)&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Veo 3.1&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tier 3: Flagship&lt;/td&gt;
&lt;td&gt;54 cr/s&lt;/td&gt;
&lt;td&gt;~$0.54/s&lt;/td&gt;
&lt;td&gt;720p&lt;/td&gt;
&lt;td&gt;4s (~$2.16)&lt;/td&gt;
&lt;td&gt;Yes&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Breaking Down the Three Production Tiers
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Tier 1: Drafting ($0.06–$0.18/s)
&lt;/h3&gt;

&lt;p&gt;Prompt engineering is an iterative probability game. Most initial generations fail because of camera drift, awkward subject blocking, or misunderstood lighting cues. Tier 1 models exist to absorb that failure rate cheaply.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Grok Imagine Video 1.5 Lite&lt;/strong&gt; ($0.06/s) and &lt;strong&gt;MiniMax H3&lt;/strong&gt; ($0.07/s) operate at 480p without audio, making them ideal for testing composition and motion vectors before committing serious budget. At $0.06 for a one-second test on Grok 1.5 Lite, a director can audition sixteen prompt variations for less than a dollar. When blocking requires synchronized sound cues or 720p clarity during animatics, &lt;strong&gt;Veo 3.1 Lite&lt;/strong&gt; ($0.10/s) and &lt;strong&gt;Wan 3.0 Prime&lt;/strong&gt; ($0.18/s) add native audio while keeping clip minimums under $0.40.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tier 2: Mid-Range Speed ($0.20–$0.28/s)
&lt;/h3&gt;

&lt;p&gt;Once a prompt structure proves reliable, Tier 2 engines bridge the gap between rough ideation and client-ready social cuts. &lt;strong&gt;MAGI-2&lt;/strong&gt; stands out at $0.20/s by delivering native 1080p output and synchronized audio at a lower per-second rate than several 480p and 720p competitors.&lt;/p&gt;

&lt;p&gt;For faster turnaround on dynamic motion, &lt;strong&gt;Seedance 2.5 Flash&lt;/strong&gt; ($0.22/s) and &lt;strong&gt;Kling 4.0 Flash&lt;/strong&gt; ($0.23/s) trim latency and credit burn compared to their full-weight counterparts. &lt;strong&gt;Veo 3.1 Fast&lt;/strong&gt; ($0.28/s) sits at the top of this bracket, offering near-flagship prompt adherence at almost half the cost of standard Veo 3.1.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tier 3: Flagship Hero ($0.36–$0.54/s)
&lt;/h3&gt;

&lt;p&gt;Flagship models are built for final hero shots where temporal consistency, complex physics, and micro-textures determine whether a viewer scrolls past or converts. Both &lt;a href="https://creoart.app/kling-4" rel="noopener noreferrer"&gt;Kling 4.0&lt;/a&gt; and &lt;a href="https://creoart.app/seedance-2-5" rel="noopener noreferrer"&gt;Seedance 2.5&lt;/a&gt; command $0.36/s, though they split on packaging: Kling 4.0 outputs silent 720p footage with a 3-second minimum ($1.08), while Seedance 2.5 bundles native audio at 480p over a 4-second minimum ($1.44).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;FLUX 3 Video&lt;/strong&gt; ($0.38/s) requires a 5-second minimum ($1.90), rewarding longer continuous takes with strong stylistic control. At the ceiling sits &lt;a href="https://creoart.app/veo-3-1" rel="noopener noreferrer"&gt;Veo 3.1&lt;/a&gt; at $0.54/s ($2.16 per 4-second clip), combining 720p rendering, tight audiovisual synchronization, and high physical realism. Burning $2.16 on blind prompt testing is poor financial discipline; reserving it for locked prompts turns that spend into predictable production value.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two Real Campaign Budget Breakdowns
&lt;/h2&gt;

&lt;p&gt;Experienced AI directors rarely generate an entire edit on a single flagship model. By drafting camera movement and pacing on Tier 1 engines—and upgrading only the final approved takes to Tier 2 or Tier 3—teams routinely cut total generation spend by more than 65%.&lt;/p&gt;

&lt;h3&gt;
  
  
  Scenario 1: 15-Second DTC Ad Storyboard (5 Cuts × 3 Seconds)
&lt;/h3&gt;

&lt;p&gt;A direct-to-consumer skincare brand needs a 15-second vertical ad composed of five 3-second shots: an opening hook, two texture close-ups, an application shot, and a product packshot. On average, landing a usable shot takes four prompt iterations before the final render.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Brute-Force Flagship Workflow:&lt;/strong&gt; Running all four test iterations plus the final render (5 generations per cut = 25 clips × 3 seconds = 75 seconds total) directly on &lt;strong&gt;Kling 4.0&lt;/strong&gt; ($0.36/s) costs &lt;strong&gt;$27.00&lt;/strong&gt; (2,700 credits).&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Draft-Cheap-Then-Upgrade Workflow:&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;4 Draft iterations per cut (60 seconds total)&lt;/em&gt; on &lt;strong&gt;MiniMax H3&lt;/strong&gt; ($0.07/s): &lt;strong&gt;$4.20&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;3 B-roll final cuts (9 seconds)&lt;/em&gt; upgraded to &lt;strong&gt;Kling 4.0 Flash&lt;/strong&gt; ($0.23/s): &lt;strong&gt;$2.07&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;2 Hero hook &amp;amp; packshot cuts (6 seconds)&lt;/em&gt; upgraded to &lt;strong&gt;Kling 4.0&lt;/strong&gt; ($0.36/s): &lt;strong&gt;$2.16&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Total Spend:&lt;/strong&gt; &lt;strong&gt;$8.43&lt;/strong&gt; (843 credits) — a &lt;strong&gt;68.8% cost reduction&lt;/strong&gt;, saving $18.57 on a single 15-second asset.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Scenario 2: 30-Second Product Launch Teaser (7 Cuts, Audio-Driven)
&lt;/h3&gt;

&lt;p&gt;A hardware startup is producing a 30-second launch teaser requiring synchronized foley and ambient sound design across seven cuts (six 4-second clips and one 6-second hero reveal). Each cut requires five exploratory passes before locking the final edit.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Brute-Force Flagship Workflow:&lt;/strong&gt; Generating five exploratory passes plus one final render (6 takes per cut = 180 seconds of total video) on &lt;strong&gt;Veo 3.1&lt;/strong&gt; ($0.54/s) burns &lt;strong&gt;$97.20&lt;/strong&gt; (9,720 credits).&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Draft-Cheap-Then-Upgrade Workflow:&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;3 Visual blocking passes per cut (90 seconds)&lt;/em&gt; on &lt;strong&gt;Grok Imagine Video 1.5 Lite&lt;/strong&gt; ($0.06/s): &lt;strong&gt;$5.40&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;2 Audio-timing passes per cut (60 seconds)&lt;/em&gt; on &lt;strong&gt;Veo 3.1 Lite&lt;/strong&gt; ($0.10/s): &lt;strong&gt;$6.00&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;4 Supporting final cuts (16 seconds)&lt;/em&gt; on &lt;strong&gt;Veo 3.1 Fast&lt;/strong&gt; ($0.28/s): &lt;strong&gt;$4.48&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;3 Hero launch cuts (14 seconds)&lt;/em&gt; on &lt;strong&gt;Veo 3.1&lt;/strong&gt; ($0.54/s): &lt;strong&gt;$7.56&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Total Spend:&lt;/strong&gt; &lt;strong&gt;$23.44&lt;/strong&gt; (2,344 credits) — a &lt;strong&gt;75.9% cost reduction&lt;/strong&gt;, saving $73.76 while preserving flagship Veo 3.1 quality on every marquee frame.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Disciplined Model Routing Wins Margins
&lt;/h2&gt;

&lt;p&gt;The nine-fold price gap between Grok Imagine Video 1.5 Lite and Veo 3.1 is not a signal to abandon flagship models—it is a blueprint for how to allocate them. Treat Tier 1 credits as disposable rehearsal tape, use Tier 2 engines to carry secondary B-roll, and deploy Tier 3 models exclusively once framing, timing, and prompt structure are proven. When credits never expire and every engine sits under a single per-second rate card, disciplined model routing turns AI video from an unpredictable line item into a scalable production pipeline.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>tools</category>
    </item>
    <item>
      <title>Printing Front-and-Back ID Cards at Exact ISO/IEC 7810 ID-1 Scale (85.6 x 53.98 mm) Without Uploading Sensitive Documents</title>
      <dc:creator>Jason Liang</dc:creator>
      <pubDate>Thu, 26 Nov 2026 19:25:43 +0000</pubDate>
      <link>https://dev.to/aiacstudio/printing-front-and-back-id-cards-at-exact-isoiec-7810-id-1-scale-856-x-5398-mm-without-3m8b</link>
      <guid>https://dev.to/aiacstudio/printing-front-and-back-id-cards-at-exact-isoiec-7810-id-1-scale-856-x-5398-mm-without-3m8b</guid>
      <description>&lt;p&gt;Search for "merge front and back of ID card to A4 PDF" and almost every top result asks you to upload high-resolution photos of your driver's license, national ID, or passport card to an unknown remote server.&lt;/p&gt;

&lt;p&gt;From a security engineering perspective, that workflow is indefensible. Once a raw JPEG of a government-issued ID leaves the browser over HTTPS, you have zero visibility into server access logs, temporary &lt;code&gt;/tmp&lt;/code&gt; directories, CDN caches, S3 lifecycle rules, or third-party processing queues. And the irony is that placing two cropped images onto a printable PDF page requires zero server-side compute. Modern browsers can perform perspective correction, watermark baking, exact ISO scaling, and 300 DPI PDF assembly entirely in local RAM.&lt;/p&gt;

&lt;h2&gt;
  
  
  Exact ISO/IEC 7810 ID-1 Physical Geometry
&lt;/h2&gt;

&lt;p&gt;Standard driver's licenses, national identity cards, and payment cards conform to &lt;strong&gt;ISO/IEC 7810 ID-1&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Width:&lt;/strong&gt; &lt;code&gt;85.60 mm&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Height:&lt;/strong&gt; &lt;code&gt;53.98 mm&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Corner radius:&lt;/strong&gt; &lt;code&gt;3.18 mm&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When people paste smartphone photos of an ID into a word processor, they usually drag the corner handles until it "looks roughly right." That often prints the card 20% oversized or squashed, which bank clerks and administrative offices reject.&lt;/p&gt;

&lt;p&gt;In a browser-based layout engine, convert those ISO constants straight into exact 300 DPI canvas pixels and PostScript PDF points (1/72 inch):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;MM_PER_INCH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;25.4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;ID1_MM&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;85.60&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;53.98&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;cornerRadius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;3.18&lt;/span&gt;&lt;span class="p"&gt;,&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="n"&gt;toPx300&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mm&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mm&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="no"&gt;MM_PER_INCH&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;300&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="n"&gt;toPt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mm&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mm&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="no"&gt;MM_PER_INCH&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;72&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// At 300 DPI: 1011 x 638 px, corner radius 38 px&lt;/span&gt;
&lt;span class="c1"&gt;// In PDF points: 242.65 x 153.01 pt, corner radius 9.01 pt&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Rounding to exact pixel dimensions on a 300 DPI plate guarantees that when the PDF embeds &lt;code&gt;/ViewerPreferences&lt;/code&gt; with &lt;code&gt;/PrintScaling /None&lt;/code&gt; on &lt;strong&gt;DIN A4 (210 x 297 mm)&lt;/strong&gt; or &lt;strong&gt;US Letter (215.9 x 279.4 mm)&lt;/strong&gt;, a ruler placed over the printed sheet measures &lt;code&gt;85.6 x 53.98 mm&lt;/code&gt; down to printer tolerance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Perspective-Cleaning Phone Captures Locally
&lt;/h2&gt;

&lt;p&gt;Users rarely scan IDs on a flatbed scanner; they snap angled photos on a desk with a phone camera. That introduces trapezoidal perspective distortion.&lt;/p&gt;

&lt;p&gt;Before scaling the card to &lt;code&gt;1011 x 638 px&lt;/code&gt;, map the four user-selected card corners to the target rectangle using a 2D projective homography (an 8-degree-of-freedom &lt;code&gt;3x3&lt;/code&gt; transformation matrix solved via Gaussian elimination). Sampling the source &lt;code&gt;ImageData&lt;/code&gt; with bilinear interpolation across the destination &lt;code&gt;1011 x 638&lt;/code&gt; pixel grid produces a crisp, rectangular card face in a few milliseconds on the main thread—or inside a Web Worker to keep pointer dragging smooth.&lt;/p&gt;

&lt;p&gt;After the warp, apply an exact &lt;code&gt;3.18 mm&lt;/code&gt; (&lt;code&gt;38 px&lt;/code&gt; at 300 DPI) rounded-rectangle clipping path (&lt;code&gt;ctx.roundRect(0, 0, 1011, 638, 38)&lt;/code&gt;) so stray desk background outside the card's rounded corners disappears cleanly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Baking Anti-Misuse Watermarks Into the Pixels
&lt;/h2&gt;

&lt;p&gt;Many privacy-conscious users add a diagonal watermark such as &lt;code&gt;"FOR VERIFICATION ONLY"&lt;/code&gt; (or a specific purpose and date) across ID copies before handing them to a landlord, hotel, or HR department.&lt;/p&gt;

&lt;p&gt;A subtle security pitfall when generating PDFs: &lt;strong&gt;do not add the watermark as a separate PDF text overlay or annotation object&lt;/strong&gt;. Anyone with a free PDF editor can select and delete a text layer in two seconds, recovering the clean ID image underneath.&lt;/p&gt;

&lt;p&gt;Instead, paint the diagonal watermark directly onto the 300 DPI canvas &lt;em&gt;before&lt;/em&gt; encoding the card image into the PDF stream:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;drawAntiMisuseWatermark&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;save&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;translate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rotate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;24&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="no"&gt;PI&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;180&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;font&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'600 28px system-ui, -apple-system, sans-serif'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fillStyle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'rgba(20, 20, 20, 0.22)'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;textAlign&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'center'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;textBaseline&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'middle'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;stepX&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;360&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;stepY&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;120&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;stepY&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;=&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="n"&gt;stepX&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fillText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;restore&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With low-opacity repeating strokes tiled across portrait and text regions, the underlying identity details stay completely legible for legitimate verification while making unauthorized reuse dramatically harder.&lt;/p&gt;

&lt;h2&gt;
  
  
  Composing Front and Back on A4 or US Letter
&lt;/h2&gt;

&lt;p&gt;On the final 300 DPI sheet (&lt;code&gt;2480 x 3508 px&lt;/code&gt; for A4 or &lt;code&gt;2550 x 3300 px&lt;/code&gt; for US Letter), center both &lt;code&gt;1011 x 638 px&lt;/code&gt; card faces vertically with a generous ~15–20 mm gap between front and back. Adding subtle outer crop hairline marks (drawn outside the card boundary so they never touch the ID content) makes cutting or filing effortless while keeping total page memory under ~40 MB.&lt;/p&gt;

&lt;p&gt;When you release the temporary &lt;code&gt;URL.createObjectURL&lt;/code&gt; handles right after generating the downloadable PDF Blob, no residual image references linger in memory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Verifying Zero-Upload Claims With Airplane Mode
&lt;/h2&gt;

&lt;p&gt;Any web tool can slap a "100% private" badge on its landing page. As engineers, we should prefer verifiable architecture over trust-me marketing copy.&lt;/p&gt;

&lt;p&gt;Because a purely client-side canvas-to-PDF pipeline requires zero backend API calls after the initial static assets load, it is trivially testable:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Load the page in your browser.&lt;/li&gt;
&lt;li&gt;Open DevTools on the &lt;strong&gt;Network&lt;/strong&gt; tab—or simply &lt;strong&gt;switch your device into Airplane Mode&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Select front and back ID photos, adjust corners, apply your &lt;code&gt;"FOR VERIFICATION ONLY"&lt;/code&gt; watermark, and export the 300 DPI PDF.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If the tool still crops, warps, watermarks, and outputs the full A4 or US Letter PDF offline with zero network errors, you have mathematical proof that your identity documents never touched a server.&lt;/p&gt;

&lt;p&gt;That exact offline-first architecture is how we built &lt;a href="https://poster.creoart.app/id-card-front-and-back" rel="noopener noreferrer"&gt;the local front-and-back ID card print tool&lt;/a&gt; as part of the client-side print suite at &lt;a href="https://poster.creoart.app/" rel="noopener noreferrer"&gt;CreoArt Poster&lt;/a&gt;. Sensitive personal documents belong in volatile browser RAM on your own machine—never in someone else's cloud storage bucket.&lt;/p&gt;

</description>
      <category>privacyjavascanvaswebdevcript</category>
    </item>
    <item>
      <title>Detecting Fake FLAC Files in the Browser: Raw STREAMINFO Parsing and 80-Slice 2048-Point FFT Forensics</title>
      <dc:creator>Jason Liang</dc:creator>
      <pubDate>Thu, 26 Nov 2026 19:20:18 +0000</pubDate>
      <link>https://dev.to/aiacstudio/detecting-fake-flac-files-in-the-browser-raw-streaminfo-parsing-and-80-slice-2048-point-fft-1o9i</link>
      <guid>https://dev.to/aiacstudio/detecting-fake-flac-files-in-the-browser-raw-streaminfo-parsing-and-80-slice-2048-point-fft-1o9i</guid>
      <description>&lt;p&gt;If you inspect a FLAC file with &lt;code&gt;ffprobe&lt;/code&gt; or a media player and see &lt;code&gt;16-bit / 44.1 kHz / 942 kbps&lt;/code&gt;, you still do not know whether the audio is lossless. Transcoding a 128 kbps MP3 into FLAC does not restore discarded spectral data; it simply wraps the decoded, quantized PCM stream inside a lossless entropy coder. The resulting file passes every structural integrity check—valid &lt;code&gt;fLaC&lt;/code&gt; framing, clean CRC-16 frame checksums, and a matching PCM MD5—while carrying a high bitrate tag generated strictly from the encoded file size divided by duration.&lt;/p&gt;

&lt;p&gt;Catching a lossy-to-lossless transcode requires two layers of inspection: raw binary header verification and statistical spectral forensics. Both run comfortably in the browser without uploading files or installing desktop spectrogram utilities like Spek.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Parsing Raw STREAMINFO Before Decoding
&lt;/h2&gt;

&lt;p&gt;Before invoking Web Audio's &lt;code&gt;decodeAudioData&lt;/code&gt;, read the raw &lt;code&gt;ArrayBuffer&lt;/code&gt; to verify the container's true PCM geometry. Relying solely on &lt;code&gt;AudioBuffer.sampleRate&lt;/code&gt; can mislead you because browsers often resample decoded buffers to the host hardware clock (typically 48 kHz).&lt;/p&gt;

&lt;p&gt;A valid FLAC stream begins with the 4-byte ASCII signature &lt;code&gt;fLaC&lt;/code&gt; (&lt;code&gt;0x664C6143&lt;/code&gt;), immediately followed by a 4-byte metadata block header and the mandatory 34-byte &lt;code&gt;STREAMINFO&lt;/code&gt; block (type &lt;code&gt;0&lt;/code&gt;). The sample rate, channel count, bit depth, and total sample count are bit-packed across bytes 18 to 25 of the file:&lt;/p&gt;

&lt;p&gt;JavaScript&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;parseFlacStreamInfo&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;buffer&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="n"&gt;view&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;DataView&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;buffer&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getUint32&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mh"&gt;0x664c6143&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Not a FLAC stream"&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="n"&gt;blockType&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getUint8&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mh"&gt;0x7f&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;blockType&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"First metadata block is not STREAMINFO"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="c1"&gt;// Bytes 18..25 hold: 20-bit sampleRate | 3-bit (ch-1) | 5-bit (bps-1) | 36-bit totalSamples&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;hi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getUint32&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;18&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="n"&gt;lo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;view&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getUint32&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;22&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="n"&gt;sampleRate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;hi&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;channels&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hi&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mh"&gt;0x07&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;bitsPerSample&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hi&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mh"&gt;0x1f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;totalSamples&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hi&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="mh"&gt;0x0f&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="o"&gt;**&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;lo&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="n"&gt;sampleRate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;channels&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;bitsPerSample&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;totalSamples&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;nyquist&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;sampleRate&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This establishes the true Nyquist limit (fN​=fs​/2, or 22,050 Hz for Red Book audio) and prevents false alarms on legitimately 32 kHz source recordings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Brickwall Shelves vs. Natural Analog Roll-Off
&lt;/h2&gt;

&lt;p&gt;Lossy psychoacoustic codecs (MP3, AAC, Ogg Vorbis) discard high-frequency MDCT bins to preserve bit budget for midband masking thresholds. In LAME MP3 encoders, scalefactor band 21 (&lt;code&gt;sfb21&lt;/code&gt;, above 16 kHz) lacks its own scalefactor, making high-frequency coding disproportionately expensive. Consequently, encoders apply steep low-pass brickwall filters at predictable cutoffs:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Codec Profile&lt;/th&gt;
&lt;th&gt;Typical Brickwall Shelf&lt;/th&gt;
&lt;th&gt;Forensic Signature&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;128 kbps MP3 (CBR)&lt;/td&gt;
&lt;td&gt;15.8 – 16.2 kHz&lt;/td&gt;
&lt;td&gt;Sudden 35–50 dB cliff; flat digital silence above 16.5 kHz&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;192 kbps MP3 / AAC-LC&lt;/td&gt;
&lt;td&gt;17.8 – 18.5 kHz&lt;/td&gt;
&lt;td&gt;Sharp shelf with sporadic energy islands from temporal noise shaping&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;320 kbps MP3 (CBR)&lt;/td&gt;
&lt;td&gt;19.8 – 20.5 kHz&lt;/td&gt;
&lt;td&gt;Steep drop near 20 kHz, often with visible sfb21 notch gaps&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;True Lossless (44.1 kHz)&lt;/td&gt;
&lt;td&gt;No brickwall&lt;/td&gt;
&lt;td&gt;Gradual 6–12 dB/octave roll-off extending to 21.5–22.05 kHz&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Authentic analog and lossless digital recordings rarely drop to −∞ dBFS at a straight horizontal frequency line. Cymbal transients, room air, tape hiss, and microphone self-noise decay smoothly toward Nyquist.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: 80-Slice 2048-Point FFT and 90th-Percentile Band Math
&lt;/h2&gt;

&lt;p&gt;Scanning an entire 5-minute track frame-by-frame is unnecessary. Instead, extract M=80 evenly spaced slices across the active 5%–95% duration of the mono-summed signal. Each slice takes N=2048 samples multiplied by a Hann window:&lt;/p&gt;

&lt;p&gt;w[n]=0.5(1−cos(N−12πn​))&lt;/p&gt;

&lt;p&gt;At fs​=44,100 Hz, the frequency resolution is Δf=204844100​≈21.533 Hz/bin. Compute each bin's power in dBFS:&lt;/p&gt;

&lt;p&gt;Pm​[k]=20log10​(N/2∣Xm​[k]∣​+10−12)&lt;/p&gt;

&lt;p&gt;Do not average Pm​[k] across the 80 slices, and do not take the maximum. Arithmetic mean drags high-frequency energy down during quiet verses, while maximum gets fooled by a single transient click or dither spike. Take the &lt;strong&gt;90th percentile&lt;/strong&gt; (P90​[k]) across the 80 slices for every bin k. This isolates sustained energetic passages (choruses, hi-hats, vocal sibilance).&lt;/p&gt;

&lt;p&gt;Next, evaluate median P90​ levels across a reference band Bref​=[10,14] kHz and three diagnostic shelf bands:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;B16​=[16.5,17.8] kHz&lt;/li&gt;
&lt;li&gt;B18​=[18.5,19.8] kHz&lt;/li&gt;
&lt;li&gt;B20​=[20.5,21.8] kHz&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Compute the band drop Δb​=mediank∈Bb​​(P90​[k])−mediank∈Bref​​(P90​[k]). When median(Bref​) sits above −55 dBFS (confirming the track actually has bright program material) and B16​ plunges below −85 dBFS with Δ16​≤−32 dB, you have a definitive 128 kbps transcode. Similar calibrated thresholds on B18​ and B20​, combined with local spectral slope ∂f∂P90​​, distinguish 192 kbps and 320 kbps shelves from dark acoustic recordings.&lt;/p&gt;

&lt;h2&gt;
  
  
  Practical Browser-Local Workflow
&lt;/h2&gt;

&lt;p&gt;Running this exact &lt;code&gt;STREAMINFO&lt;/code&gt; parser and 80-slice FFT forensic pass requires zero server infrastructure. You can verify suspicious downloads directly in RAM—with no file uploads and no Spek installation—using &lt;a href="https://aiac.app/fake-flac-checker/" rel="noopener noreferrer"&gt;AIAC's Fake FLAC Checker&lt;/a&gt;. Once you confirm a master is genuinely lossless and need compact delivery files where you control the exact encoding bitrate rather than inheriting unknown generational loss, &lt;a href="https://aiac.app/flac-to-mp3/" rel="noopener noreferrer"&gt;AIAC's FLAC to MP3 Converter&lt;/a&gt; handles the transcoding 100% locally in the browser as well.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>audio</category>
      <category>javascript</category>
      <category>webassembly</category>
    </item>
    <item>
      <title>Why Most Browser Puzzle Generators Force Blind Guesses — And How We Proved Unique Solutions in Vanilla JS</title>
      <dc:creator>Jason Liang</dc:creator>
      <pubDate>Thu, 26 Nov 2026 19:20:05 +0000</pubDate>
      <link>https://dev.to/aiacstudio/why-most-browser-puzzle-generators-force-blind-guesses-and-how-we-proved-unique-solutions-in-162p</link>
      <guid>https://dev.to/aiacstudio/why-most-browser-puzzle-generators-force-blind-guesses-and-how-we-proved-unique-solutions-in-162p</guid>
      <description>&lt;p&gt;Most browser puzzle generators fail at the exact moment a logic game is supposed to be satisfying. You spend four minutes carefully narrowing down a 15x15 Nonogram or clearing a Minesweeper board down to the last two squares, only to hit a symmetrical 50/50 split where no deduction exists. You click, lose, and close the tab.&lt;/p&gt;

&lt;p&gt;That failure is structural, not accidental. Naive generators treat puzzle creation as random sampling: scatter mines across a grid, poke holes in a completed Sudoku, or convert a random bitmap into row and column clues. Sampling produces grids that are &lt;em&gt;solvable&lt;/em&gt;—at least one valid solution exists—but it makes no guarantee that the solution is &lt;em&gt;unique&lt;/em&gt;, or that a human can reach it without trial-and-error bifurcation.&lt;/p&gt;

&lt;p&gt;At &lt;a href="https://fogboard.com/" rel="noopener noreferrer"&gt;Fogboard&lt;/a&gt;, an independent browser-based daily logic puzzle studio covering 11 English logic and fog-of-war games plus 3 Japanese editions, we treated solver verification as a hard gate inside the client-side generator. A board is never rendered until a Vanilla JS solver proves it meets its game-specific invariant: exact-cover uniqueness for &lt;a href="https://fogboard.com/shikaku" rel="noopener noreferrer"&gt;Shikaku&lt;/a&gt; rectangle divisions, iterative coral wall sealing to lock a unique Hamiltonian path across 5x5 to 7x7 grids in Zip Game, unique-solution verification for Queens Puzzle's non-touching colored regions, and pure deductive solvability for Nonograms and Minesweeper.&lt;/p&gt;

&lt;p&gt;Here is how four of those client-side verifiers work under the hood.&lt;/p&gt;

&lt;h2&gt;
  
  
  Nonograms: Proving Zero-Guess Solvability with Line-by-Line DP
&lt;/h2&gt;

&lt;p&gt;A &lt;a href="https://fogboard.com/nonogram" rel="noopener noreferrer"&gt;Nonogram&lt;/a&gt; (5x5, 10x10, or 15x15) can have a strictly unique solution and still feel unfair. If resolving a board requires guessing a cell, tracing implications across six rows, hitting a contradiction, and backtracking, the player experiences it as trial and error rather than logic.&lt;/p&gt;

&lt;p&gt;To guarantee zero guessing is ever required, our verifier forbids backtracking completely. It only accepts boards solvable by pure single-line constraint propagation using forward/backward dynamic programming (DP).&lt;/p&gt;

&lt;p&gt;Consider a single line of length N&lt;code&gt;N&lt;/code&gt; with current cell states in {UNKNOWN,EMPTY,FILLED}&lt;code&gt;\{\text{UNKNOWN}, \text{EMPTY}, \text{FILLED}\}&lt;/code&gt; and a clue list c1,c2,…,ck&lt;code&gt;c_1, c_2, \dots, c_k&lt;/code&gt;. Rather than enumerating all valid placements—which blows up combinatorially on sparse 15x15 lines—we compute two boolean DP tables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Forward feasibility (&lt;code&gt;pref[i][j]&lt;/code&gt;):&lt;/strong&gt; whether the first j&lt;code&gt;j&lt;/code&gt; clues can be legally placed within the prefix of cells 0…i−1&lt;code&gt;0 \dots i-1&lt;/code&gt; without placing a filled run over a known &lt;code&gt;EMPTY&lt;/code&gt; cell or leaving a known &lt;code&gt;FILLED&lt;/code&gt; cell uncovered.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Backward feasibility (&lt;code&gt;suff[i][j]&lt;/code&gt;):&lt;/strong&gt; the mirror computation from right to left, testing whether the remaining clues j…k−1&lt;code&gt;j \dots k-1&lt;/code&gt; fit within the suffix i…N−1&lt;code&gt;i \dots N-1&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A placement of clue cj&lt;code&gt;c_j&lt;/code&gt; starting at index p&lt;code&gt;p&lt;/code&gt; is globally valid for the line if and only if:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;pref[p][j]&lt;/code&gt; is true (with a separator cell before p&lt;code&gt;p&lt;/code&gt; if j≥1&lt;code&gt;j \ge 1&lt;/code&gt;, meaning index p−1&lt;code&gt;p-1&lt;/code&gt; cannot be &lt;code&gt;FILLED&lt;/code&gt;),&lt;/li&gt;
&lt;li&gt;None of the cells in [p,p+cj−1]&lt;code&gt;[p, p + c_j - 1]&lt;/code&gt; is &lt;code&gt;EMPTY&lt;/code&gt;, and&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;suff[p + c_j][j + 1]&lt;/code&gt; is true (with index p+cj&lt;code&gt;p + c_j&lt;/code&gt; not &lt;code&gt;FILLED&lt;/code&gt; when p+cj≤N−1&lt;code&gt;p + c_j \le N - 1&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using prefix sums of &lt;code&gt;EMPTY&lt;/code&gt; and &lt;code&gt;FILLED&lt;/code&gt; counts, each placement check runs in O(1)&lt;code&gt;O(1)&lt;/code&gt; time. As we sweep every valid &lt;code&gt;(p, j)&lt;/code&gt; placement, we mark a difference array &lt;code&gt;canFill&lt;/code&gt; across [p,p+cj−1]&lt;code&gt;[p, p + c_j - 1]&lt;/code&gt;. Simultaneously, any cell x&lt;code&gt;x&lt;/code&gt; where &lt;code&gt;pref[x][j] &amp;amp;&amp;amp; suff[x + 1][j]&lt;/code&gt; holds (and cell x&lt;code&gt;x&lt;/code&gt; is not &lt;code&gt;FILLED&lt;/code&gt;) sets &lt;code&gt;canEmpty[x] = true&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;After one pass over the DP tables:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If &lt;code&gt;canFill[x]&lt;/code&gt; is true and &lt;code&gt;canEmpty[x]&lt;/code&gt; is false, cell x&lt;code&gt;x&lt;/code&gt; is &lt;strong&gt;forced &lt;code&gt;FILLED&lt;/code&gt;&lt;/strong&gt; across every valid line configuration.&lt;/li&gt;
&lt;li&gt;If &lt;code&gt;canEmpty[x]&lt;/code&gt; is true and &lt;code&gt;canFill[x]&lt;/code&gt; is false, cell x&lt;code&gt;x&lt;/code&gt; is &lt;strong&gt;forced &lt;code&gt;EMPTY&lt;/code&gt;&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every time a cell changes state, its perpendicular line enters a work queue. The solver loops until the queue drains. If any cell remains &lt;code&gt;UNKNOWN&lt;/code&gt; at the fixed point, the candidate bitmap is rejected immediately. Every published 5x5, 10x10, and 15x15 board is therefore mathematically proved solvable by line-by-line deduction alone.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sudoku: 9-Bit Bitmask MRV Backtracking for Uniqueness
&lt;/h2&gt;

&lt;p&gt;For &lt;a href="https://fogboard.com/mini-sudoku" rel="noopener noreferrer"&gt;Mini Sudoku 6x6&lt;/a&gt; (with 2x3 boxes) and Classic Sudoku 9x9, removing clues from a completed grid requires proving that no second solution exists. In JavaScript, allocating arrays of candidate sets inside a recursive backtracking loop creates GC pressure during generation. Representing constraints as integer bitmasks eliminates allocations altogether.&lt;/p&gt;

&lt;p&gt;For Classic 9x9, each row, column, and 3x3 box is tracked as a 9-bit integer (&lt;code&gt;rowMask[9]&lt;/code&gt;, &lt;code&gt;colMask[9]&lt;/code&gt;, &lt;code&gt;boxMask[9]&lt;/code&gt;), where bit d&lt;code&gt;d&lt;/code&gt; represents digit d+1&lt;code&gt;d + 1&lt;/code&gt;. Finding every legal candidate for cell &lt;code&gt;(r, c)&lt;/code&gt; reduces to a single bitwise expression:&lt;/p&gt;

&lt;p&gt;JavaScript&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;FULL_MASK&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mh"&gt;0x1FF&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// 9 bits set (0x3F for 6x6 Mini Sudoku)&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;countSolutions&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;board&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rowMask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;colMask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;boxMask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;limit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;bestIdx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;bestMask&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;minCount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;81&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;board&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;continue&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&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="n"&gt;avail&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;~&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;rowMask&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;colMask&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;boxMask&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="no"&gt;FULL_MASK&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;avail&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// dead end&lt;/span&gt;

    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;POPCOUNT_9BIT&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;avail&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;minCount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="n"&gt;minCount&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;count&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="n"&gt;bestIdx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="n"&gt;bestMask&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;avail&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;count&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// forced naked single&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bestIdx&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// board solved&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;bestIdx&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bestIdx&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;solutions&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bestMask&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;^=&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;m&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="n"&gt;bit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;m&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;board&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;bestIdx&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;bit&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;rowMask&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;^=&lt;/span&gt; &lt;span class="n"&gt;bit&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;colMask&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;^=&lt;/span&gt; &lt;span class="n"&gt;bit&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;boxMask&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;^=&lt;/span&gt; &lt;span class="n"&gt;bit&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="n"&gt;solutions&lt;/span&gt; &lt;span class="o"&gt;+=&lt;/span&gt; &lt;span class="nf"&gt;countSolutions&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;board&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;rowMask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;colMask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;boxMask&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;limit&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;solutions&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="n"&gt;board&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;bestIdx&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;rowMask&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;^=&lt;/span&gt; &lt;span class="n"&gt;bit&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;colMask&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;^=&lt;/span&gt; &lt;span class="n"&gt;bit&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;boxMask&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;^=&lt;/span&gt; &lt;span class="n"&gt;bit&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;solutions&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;=&lt;/span&gt; &lt;span class="n"&gt;limit&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;solutions&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="n"&gt;solutions&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two details make this fast enough to run synchronously during generation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Minimum Remaining Values (MRV):&lt;/strong&gt; Scanning for the cell with the smallest lookup-table popcount collapses the branching factor. Any naked single (&lt;code&gt;count === 1&lt;/code&gt;) exits the scan immediately.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Early abort at &lt;code&gt;limit = 2&lt;/code&gt;:&lt;/strong&gt; Proving uniqueness does not require counting &lt;em&gt;all&lt;/em&gt; solutions—only proving the count never reaches 2. As soon as a second completion is found, the recursion unwinds and the candidate clue removal is rolled back. On Classic 9x9, we pair this uniqueness proof with a rule-based hint engine that surfaces explanatory logical hints rather than opaque digit reveals.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  No-Guess Minesweeper: Zero Pockets and Pairwise Subset Overlap
&lt;/h2&gt;

&lt;p&gt;Classic Minesweeper breaks down in two places: the opening click and the late-game frontier. In &lt;a href="https://fogboard.com/no-guess-minesweeper" rel="noopener noreferrer"&gt;No Guess Minesweeper&lt;/a&gt;, we solve the opening by guaranteeing a pre-opened safe zero pocket, then validate the entire remaining board with a constraint solver before play starts.&lt;/p&gt;

&lt;p&gt;Each revealed numbered cell on the active frontier produces a constraint (Si,mi)&lt;code&gt;(S_i, m_i)&lt;/code&gt;, where Si&lt;code&gt;S_i&lt;/code&gt; is the set of adjacent unrevealed cells and mi&lt;code&gt;m_i&lt;/code&gt; is the clue value minus adjacent flagged mines.&lt;/p&gt;

&lt;p&gt;First, the solver exhausts single-cell rules:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;If mi=0&lt;code&gt;m_i = 0&lt;/code&gt;, every cell in Si&lt;code&gt;S_i&lt;/code&gt; is safe and gets revealed.&lt;/li&gt;
&lt;li&gt;If mi=∣Si∣&lt;code&gt;m_i = \vert{}S_i\vert{}&lt;/code&gt;, every cell in Si&lt;code&gt;S_i&lt;/code&gt; is a mine and gets flagged.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Single-cell rules alone leave classic patterns like &lt;code&gt;1-2-1&lt;/code&gt; or &lt;code&gt;1-2-2-1&lt;/code&gt; stuck. Whenever propagation stalls, the solver compares pairs of overlapping frontier constraints (Sa,ma)&lt;code&gt;(S_a, m_a)&lt;/code&gt; and (Sb,mb)&lt;code&gt;(S_b, m_b)&lt;/code&gt; that share at least one unknown cell.&lt;/p&gt;

&lt;p&gt;Let A∖B&lt;code&gt;A \setminus B&lt;/code&gt; be the cells exclusive to Sa&lt;code&gt;S_a&lt;/code&gt;, and B∖A&lt;code&gt;B \setminus A&lt;/code&gt; be the cells exclusive to Sb&lt;code&gt;S_b&lt;/code&gt;. Because the shared intersection Sa∩Sb&lt;code&gt;S_a \cap S_b&lt;/code&gt; holds the exact same mines for both clues, subtracting the two equations yields a tight bound on the difference sets:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Strict subset (Sa⊂Sb&lt;code&gt;S_a \subset S_b&lt;/code&gt;):&lt;/strong&gt; The remaining cells Sb∖Sa&lt;code&gt;S_b \setminus S_a&lt;/code&gt; must contain exactly mb−ma&lt;code&gt;m_b - m_a&lt;/code&gt; mines. If mb−ma=0&lt;code&gt;m_b - m_a = 0&lt;/code&gt;, every cell in Sb∖Sa&lt;code&gt;S_b \setminus S_a&lt;/code&gt; is safe. If mb−ma=∣Sb∖Sa∣&lt;code&gt;m_b - m_a = \vert{}S_b \setminus S_a\vert{}&lt;/code&gt;, every cell in Sb∖Sa&lt;code&gt;S_b \setminus S_a&lt;/code&gt; is a mine.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;General overlap:&lt;/strong&gt; Even when neither set strictly contains the other, the difference in mine counts satisfies mb−ma≤∣B∖A∣&lt;code&gt;m_b - m_a \le \vert{}B \setminus A\vert{}&lt;/code&gt;. Whenever mb−ma=∣B∖A∣&lt;code&gt;m_b - m_a = \vert{}B \setminus A\vert{}&lt;/code&gt;, the maximum possible number of mines must sit in B∖A&lt;code&gt;B \setminus A&lt;/code&gt; (all mines) and the minimum possible number must sit in A∖B&lt;code&gt;A \setminus B&lt;/code&gt; (all safe).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every deduction feeds newly opened cells back into the frontier queue. If the loop terminates with unrevealed safe cells remaining—meaning the board contains an irreducible 50/50 guess or requires global mine-count tank enumeration—the board is discarded and regenerated.&lt;/p&gt;

&lt;h2&gt;
  
  
  Zero-Backend Daily Parity: FNV-1a + Mulberry32 over UTC
&lt;/h2&gt;

&lt;p&gt;Daily puzzles usually pull an indie project into backend infrastructure: a scheduled generator, a database to store daily seeds, and an API to serve them. Moving verified generation to the client lets us eliminate the backend completely while keeping global daily parity across players and supporting a 30-day replayable daily archive.&lt;/p&gt;

&lt;p&gt;The only requirement is bit-exact determinism across every JavaScript engine. We build a canonical UTC key (for example, &lt;code&gt;2026-11-27:nonogram:10x10&lt;/code&gt;), hash it into a 32-bit unsigned integer with FNV-1a, and seed Mulberry32:&lt;/p&gt;

&lt;p&gt;JavaScript&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;fnv1a32&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mh"&gt;0x811c9dc5&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="o"&gt;++&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;h&lt;/span&gt; &lt;span class="o"&gt;^=&lt;/span&gt; &lt;span class="n"&gt;str&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;charCodeAt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;h&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;imul&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mh"&gt;0x01000193&lt;/span&gt;&lt;span class="p"&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;return&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&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;mulberry32&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;seed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;seed&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mh"&gt;0x6D2B79F5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;imul&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;imul&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;61&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="n"&gt;t&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="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;^&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;14&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;4294967296&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using &lt;code&gt;Math.imul&lt;/code&gt; and unsigned right shifts (&lt;code&gt;&amp;gt;&amp;gt;&amp;gt;&lt;/code&gt;) keeps every intermediate operation inside exact 32-bit integer arithmetic, avoiding IEEE-754 precision drift. Because the candidate generator, solver verifier, and rejection loop consume only this seeded stream, two players on opposite sides of the planet derive the exact same verified board for any UTC date—with zero sign-up, zero external webfonts, and a mobile-first Apple-porcelain light UI that loads directly into the puzzle.&lt;/p&gt;

&lt;p&gt;The broader architecture—including exact-cover verification for Shikaku, iterative coral wall sealing for Zip Game, and the probability-heatmap Hunt-and-Target AI behind Battleship Online—is documented on-site at &lt;a href="https://fogboard.com/how-solvers-work" rel="noopener noreferrer"&gt;how our solvers work&lt;/a&gt;. Moving proof of solvability into the browser turns puzzle fairness from a hopeful heuristic into a deterministic build invariant.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>audio</category>
      <category>javascript</category>
      <category>webassembly</category>
    </item>
    <item>
      <title>Generating True 300 DPI Print-Ready PDFs in Pure Browser JavaScript (MediaBox, PrintScaling /None, and US Letter vs DIN A4)</title>
      <dc:creator>Jason Liang</dc:creator>
      <pubDate>Thu, 26 Nov 2026 19:12:53 +0000</pubDate>
      <link>https://dev.to/aiacstudio/generating-true-300-dpi-print-ready-pdfs-in-pure-browser-javascript-mediabox-printscaling-none-4a21</link>
      <guid>https://dev.to/aiacstudio/generating-true-300-dpi-print-ready-pdfs-in-pure-browser-javascript-mediabox-printscaling-none-4a21</guid>
      <description>&lt;p&gt;Every frontend engineer who tries to print a structured document from the browser eventually runs into the same wall: &lt;code&gt;window.print()&lt;/code&gt; is designed for reflowing web articles, not precision physical layouts.&lt;/p&gt;

&lt;p&gt;Even with &lt;code&gt;@page { size: A4; margin: 0; }&lt;/code&gt; in CSS, browser print pipelines routinely clip ink near paper edges, distort proportions when a layout authored for &lt;strong&gt;DIN A4 (210 x 297 mm)&lt;/strong&gt; is printed on &lt;strong&gt;US Letter (215.9 x 279.4 mm)&lt;/strong&gt;, and silently apply "Fit to printable area" scaling that shrinks the entire page to around &lt;strong&gt;94%&lt;/strong&gt; of its intended physical size. On a calendar grid, ruler, or poster tile, a 6% silent scale reduction ruins alignment and makes binder-hole margins miss the punch.&lt;/p&gt;

&lt;p&gt;If you need exact millimeter fidelity without sending user data to a headless Chromium server, the cleanest solution is generating the PDF directly in browser memory with explicit PDF geometry and 300 DPI rasterized plates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Locking Exact MediaBox Dimensions in PostScript Points
&lt;/h2&gt;

&lt;p&gt;PDF coordinates use PostScript points, where &lt;strong&gt;1 point equals 1/72 of an inch&lt;/strong&gt; (and 1 inch equals exactly 25.4 mm). Instead of relying on CSS pixel approximations (&lt;code&gt;96 px/in&lt;/code&gt;), compute every page's &lt;code&gt;/MediaBox&lt;/code&gt; directly from physical millimeters:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;MM_PER_INCH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;25.4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;PT_PER_INCH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;72&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;mmToPt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mm&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="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;mm&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="no"&gt;MM_PER_INCH&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="no"&gt;PT_PER_INCH&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toFixed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&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="no"&gt;PAPER_SIZES_MM&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="no"&gt;A4&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;210&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;297&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;          &lt;span class="c1"&gt;// [0, 0, 595.28, 841.89] pt&lt;/span&gt;
  &lt;span class="no"&gt;LETTER&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;215.9&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;279.4&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;  &lt;span class="c1"&gt;// [0, 0, 612.00, 792.00] pt&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice the aspect ratio mismatch: DIN A4 has an aspect ratio of &lt;code&gt;1 : 1.414&lt;/code&gt;, while US Letter is noticeably wider and shorter at &lt;code&gt;1 : 1.294&lt;/code&gt;. Never scale an A4 layout onto US Letter. Recompute column widths, row heights, and typography metrics against the target paper box before drawing a single pixel.&lt;/p&gt;

&lt;h2&gt;
  
  
  Defeating Silent 94% Shrink With ViewerPreferences
&lt;/h2&gt;

&lt;p&gt;Setting &lt;code&gt;/MediaBox&lt;/code&gt; accurately only gets you halfway. Desktop PDF viewers like Adobe Acrobat and built-in browser PDF plugins often default to "Shrink oversized pages" or "Fit to printable area" in the print dialog—reintroducing that 94% scale distortion even on a clean PDF.&lt;/p&gt;

&lt;p&gt;The PDF specification provides an explicit catalog dictionary directive to instruct compliant viewers to default to 100% scale:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight postscript"&gt;&lt;code&gt;&lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="n"&gt;obj&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt;
  &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nc"&gt;Type&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nc"&gt;Catalog&lt;/span&gt;
  &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nc"&gt;Pages&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="no"&gt;R&lt;/span&gt;
  &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nc"&gt;ViewerPreferences&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&amp;lt;&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nc"&gt;PrintScaling&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="nc"&gt;None&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;gt;&amp;gt;&lt;/span&gt;
&lt;span class="n"&gt;endobj&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Including the &lt;code&gt;ViewerPreferences&lt;/code&gt; dictionary with &lt;code&gt;/PrintScaling /None&lt;/code&gt; tells the print dialog not to auto-fit the sheet. Pair this with physical margin discipline so desktop inkjet and laser printers do not clip the outer border when printing at 100% actual size.&lt;/p&gt;

&lt;h2&gt;
  
  
  Designing Printer-Safe and Binder-Punch Margins
&lt;/h2&gt;

&lt;p&gt;Most home and office printers cannot print full-bleed to the paper edge; mechanical paper-feed rollers require an unprintable dead zone around the perimeter. Reserving a &lt;strong&gt;12 mm printer safe margin&lt;/strong&gt; on all four sides protects outer borders, grid rules, and page headers across nearly all consumer hardware.&lt;/p&gt;

&lt;p&gt;For calendars or reference sheets meant to live in a ring binder or wall clip, add an optional &lt;strong&gt;+10 mm binder punch margin&lt;/strong&gt; (22 mm total on the punched edge):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;computeContentRectMm&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;paper&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;options&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="p"&gt;}&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="n"&gt;safeMargin&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;12&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;punchBonus&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;binderPunch&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="mi"&gt;10&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;punchEdge&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;punchEdge&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s1"&gt;'left'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// 'left' or 'top'&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;safeMargin&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;punchEdge&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'left'&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;punchBonus&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&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="n"&gt;top&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;safeMargin&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;punchEdge&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'top'&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;punchBonus&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&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="n"&gt;right&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;safeMargin&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;bottom&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;safeMargin&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="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;top&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;paper&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;left&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;right&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;paper&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;height&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;top&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;bottom&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By baking both safe margins and punch offsets directly into the layout engine before rendering, printing at 100% scale works out of the box with zero manual scaling tweaks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rendering 300 DPI Canvas Plates Without Exhausting Browser RAM
&lt;/h2&gt;

&lt;p&gt;To render crisp typography, custom fonts, and vector-sharp grid hairlines into a 300 DPI raster plate inside the browser, scale your offscreen &lt;code&gt;&amp;lt;canvas&amp;gt;&lt;/code&gt; backing store from millimeters to 300 DPI pixels:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;DIN A4 at 300 DPI:&lt;/strong&gt; &lt;code&gt;2480 x 3508 px&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;US Letter at 300 DPI:&lt;/strong&gt; &lt;code&gt;2550 x 3300 px&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here is the trap most client-side PDF generators hit: a single uncompressed &lt;code&gt;2480 x 3508&lt;/code&gt; RGBA canvas consumes roughly &lt;strong&gt;34.8 MB&lt;/strong&gt; of raw pixel memory. If you bundle a rolling 12-month calendar—for instance, an &lt;strong&gt;August 2026–July 2027 academic calendar&lt;/strong&gt; or an &lt;strong&gt;April 2027–March 2028 Japan fiscal year calendar&lt;/strong&gt;—holding 12 full-resolution canvases in memory at once burns over 400 MB of RAM and crashes mobile Safari tabs.&lt;/p&gt;

&lt;p&gt;The fix is a strict streaming render loop: allocate &lt;strong&gt;one&lt;/strong&gt; offscreen canvas, render month &lt;code&gt;i&lt;/code&gt;, immediately encode that frame to a compressed JPEG/PNG byte buffer, append the image XObject stream into your PDF byte array, clear the canvas, and yield to the event loop before rendering month &lt;code&gt;i + 1&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;buildRollingCalendarPdf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;months&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;paperKey&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="n"&gt;paper&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="no"&gt;PAPER_SIZES_MM&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;paperKey&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="n"&gt;dpi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;300&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;pxW&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;paper&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="no"&gt;MM_PER_INCH&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;dpi&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="n"&gt;pxH&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;paper&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;height&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="no"&gt;MM_PER_INCH&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;dpi&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="n"&gt;canvas&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'canvas'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pxW&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pxH&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'2d'&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="n"&gt;pageBlobs&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&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;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;monthSpec&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="n"&gt;months&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;fillStyle&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'#ffffff'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fillRect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pxW&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pxH&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nf"&gt;drawMonthPlate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;monthSpec&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;paper&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dpi&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="n"&gt;blob&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Promise&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toBlob&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;res&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'image/jpeg'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.92&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;pageBlobs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;push&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Uint8Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;blob&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;arrayBuffer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Release backing store immediately after all plates are encoded&lt;/span&gt;
  &lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;width&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="n"&gt;canvas&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;height&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;assemblePdfWithPrintScalingNone&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pageBlobs&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;paper&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The entire 12-page PDF builds in browser RAM with zero server upload, zero cloud rendering bills, and exact 300 DPI clarity.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where This Architecture Pays Off in Production
&lt;/h2&gt;

&lt;p&gt;This exact pipeline—explicit PostScript point MediaBoxes, &lt;code&gt;/PrintScaling /None&lt;/code&gt;, 12 mm safe margins with optional +10 mm punch allowances, and single-canvas 300 DPI streaming—powers &lt;a href="https://poster.creoart.app/printable-calendar-maker" rel="noopener noreferrer"&gt;the CreoArt printable calendar maker&lt;/a&gt;. You can open &lt;a href="https://poster.creoart.app/samples/creoart-2027-us-letter-monthly-sample.pdf" rel="noopener noreferrer"&gt;this US Letter 2027 monthly sample PDF&lt;/a&gt; in a PDF inspector to check the &lt;code&gt;612 x 792 pt&lt;/code&gt; MediaBox and print-scaling flags directly.&lt;/p&gt;

&lt;p&gt;The same math also generalizes beyond single-page grids. When splitting an oversized wall chart across tiled sheets in &lt;a href="https://poster.creoart.app/print-large-poster-multiple-pages" rel="noopener noreferrer"&gt;multi-page poster printing&lt;/a&gt;, locking true 1:1 physical scale and consistent overlap margins is the difference between tiles that tape together seamlessly and a crooked jigsaw puzzle.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>audio</category>
      <category>javascript</category>
      <category>javascriptpdwebdevcanvasf</category>
    </item>
    <item>
      <title>Why Intl.DateTimeFormat('zh-CN-u-ca-chinese') Gets 2027 Chinese New Year Wrong by 1 Day (The 23:56 CST vs 00:56 JST Boundary)</title>
      <dc:creator>Jason Liang</dc:creator>
      <pubDate>Thu, 26 Nov 2026 19:11:07 +0000</pubDate>
      <link>https://dev.to/aiacstudio/why-intldatetimeformatzh-cn-u-ca-chinese-gets-2027-chinese-new-year-wrong-by-1-day-the-2356-1jdh</link>
      <guid>https://dev.to/aiacstudio/why-intldatetimeformatzh-cn-u-ca-chinese-gets-2027-chinese-new-year-wrong-by-1-day-the-2356-1jdh</guid>
      <description>&lt;p&gt;If you are building a calendar renderer, scheduling tool, or printable wall planner for 2027, relying blindly on &lt;code&gt;Intl.DateTimeFormat('zh-CN-u-ca-chinese')&lt;/code&gt; will ship an off-by-one bug for Chinese New Year across a wide swath of browsers and operating systems.&lt;/p&gt;

&lt;p&gt;I hit this exact edge case while validating 2027 lunisolar grid layouts for print output. The root cause is not a casual typo in a locale file. It sits at a razor-thin four-minute astronomical boundary.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 23:56 CST vs. 00:56 JST Boundary
&lt;/h2&gt;

&lt;p&gt;Under the traditional Chinese lunisolar calendar, the first day of every lunar month—the &lt;em&gt;shuòrì&lt;/em&gt; (朔日)—is the calendar date in China Standard Time (CST, UTC+8) on which the astronomical new moon (exact Sun–Moon ecliptic conjunction) occurs.&lt;/p&gt;

&lt;p&gt;For the first lunar month of 2027, that exact astronomical new moon occurs at:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;UTC:   2027-02-06 15:56
CST:   2027-02-06 23:56 (UTC+8 — Beijing Time)
JST:   2027-02-07 00:56 (UTC+9 — Japan Standard Time)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice two consequences of that 23:56 timestamp:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;In China (UTC+8)&lt;/strong&gt;, the conjunction falls four minutes before midnight on &lt;strong&gt;February 6, 2027&lt;/strong&gt;. Therefore, 2027 Chinese New Year (农历正月初一) is &lt;strong&gt;February 6, 2027&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;In Japan (UTC+9)&lt;/strong&gt;, that exact same astronomical event occurs fifty-six minutes after midnight on &lt;strong&gt;February 7, 2027&lt;/strong&gt;. Because Japan's traditional lunisolar calendar (&lt;em&gt;kyūreki&lt;/em&gt;) evaluates conjunctions against UTC+9, China and Japan's traditional lunar calendars genuinely diverge by one full day in 2027.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When an astronomical boundary sits four minutes from midnight, any minor drift in ephemeris calculation or timezone handling flips the entire month by 24 hours.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Browser Intl APIs Drift on Edge Conjunctions
&lt;/h2&gt;

&lt;p&gt;Most browsers delegate calendar math to ICU (International Components for Unicode) via V8, SpiderMonkey, or JavaScriptCore. ICU's Chinese calendar implementation computes lunar phases using internal astronomical approximations rather than shipping official national observatory tables for every year. When a conjunction sits comfortably at 14:20 CST, a few minutes of ΔT (terrestrial time vs. universal time) approximation error makes zero difference to the civil date.&lt;/p&gt;

&lt;p&gt;At 23:56 CST, a five-minute drift or an unpinned timezone conversion pushes the computed conjunction past 00:00 on February 7. You can inspect how your local runtime behaves with a quick check:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Intl&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DateTimeFormat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'zh-CN-u-ca-chinese'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;timeZone&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'Asia/Shanghai'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;year&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'numeric'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;month&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'long'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;day&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'numeric'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&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;for&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;iso&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s1"&gt;'2027-02-05'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'2027-02-06'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'2027-02-07'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Use midday UTC+8 to avoid local DST/midnight shifts during formatting&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;date&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nb"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`${iso}T12:00:00+08:00`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nb"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;iso&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'=&amp;gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;format&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;date&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Depending on the ICU version bundled into a user's browser or Node.js binary, &lt;code&gt;2027-02-06&lt;/code&gt; frequently formats as the last day of the twelfth lunar month instead of 正月初一, silently shifting Chinese New Year to &lt;code&gt;2027-02-07&lt;/code&gt;. Worse, if a developer omits &lt;code&gt;timeZone: 'Asia/Shanghai'&lt;/code&gt;, users opening the app in Tokyo, San Francisco, or London get inconsistent lunar dates on the same Gregorian day.&lt;/p&gt;

&lt;h2&gt;
  
  
  Verifying 24 Solar Terms Against Hong Kong Observatory Data
&lt;/h2&gt;

&lt;p&gt;Lunar new moons are only half the story for East Asian calendar typography. The 24 solar terms (&lt;em&gt;jiéqì&lt;/em&gt;, 节气) are defined by the Sun reaching exact 15-degree intervals of ecliptic longitude, again evaluated against UTC+8 civil dates.&lt;/p&gt;

&lt;p&gt;Because &lt;code&gt;Intl.DateTimeFormat&lt;/code&gt; does not expose solar terms at all, developers often reach for simplified trigonometric formulas. Those approximations regularly miss near-midnight solar term crossings by a day. For 2027, cross-checking every solar term against official &lt;strong&gt;Hong Kong Observatory&lt;/strong&gt; ephemeris tables locks down exact CST timestamps—for example, &lt;strong&gt;Lichun (立春)&lt;/strong&gt; falls on &lt;strong&gt;February 4, 2027 at 09:46 CST&lt;/strong&gt;, two days before Chinese New Year.&lt;/p&gt;

&lt;p&gt;In practice, storing a compact precomputed lookup table of verified new moons and solar terms for target years takes only a few kilobytes of JSON and removes runtime ICU drift completely:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="no"&gt;VERIFIED_2027_ANCHORS&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;lichunCST&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'2027-02-04T09:46:00+08:00'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="n"&gt;springFestivalCST&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'2027-02-06'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// New moon at 23:56 CST&lt;/span&gt;
  &lt;span class="n"&gt;japanKyurekiNewYearJST&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'2027-02-07'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Same new moon at 00:56 JST&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Modeling China's Official 2027 Statutory Schedule (国办发明电〔2026〕10号)
&lt;/h2&gt;

&lt;p&gt;A printable Chinese calendar is still incomplete if it only renders lunar dates and solar terms. Statutory holidays in mainland China combine multi-day holiday spans with weekend makeup workdays (&lt;em&gt;tiáoxiū&lt;/em&gt;, 调休).&lt;/p&gt;

&lt;p&gt;Under the State Council's official 2027 notice (&lt;strong&gt;国办发明电〔2026〕10号&lt;/strong&gt;), the year defines &lt;strong&gt;7 official holiday spans&lt;/strong&gt;—including a &lt;strong&gt;9-day Spring Festival break from February 5 through February 13&lt;/strong&gt;—paired with &lt;strong&gt;5 mandatory weekend makeup workdays&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;January 31&lt;/strong&gt; (Sunday)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;February 14&lt;/strong&gt; (Sunday)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;May 8&lt;/strong&gt; (Saturday)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;September 26&lt;/strong&gt; (Sunday)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;October 9&lt;/strong&gt; (Saturday)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From a data-modeling and typography standpoint, never fold makeup workdays into a generic "holiday" boolean. Every calendar cell needs a three-state status (&lt;code&gt;regular&lt;/code&gt;, &lt;code&gt;holiday&lt;/code&gt;, &lt;code&gt;makeup-workday&lt;/code&gt;) so the grid can visually distinguish red rest badges (休) from muted workday badges (班) without confusing weekend readers.&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="kd"&gt;type&lt;/span&gt; &lt;span class="nc"&gt;DayBadge&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s1"&gt;'none'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'rest'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="s1"&gt;'work'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;interface&lt;/span&gt; &lt;span class="nc"&gt;CalendarDayMeta&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="n"&gt;gregorian&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;      &lt;span class="c1"&gt;// '2027-02-06'&lt;/span&gt;
  &lt;span class="n"&gt;lunarLabel&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;     &lt;span class="c1"&gt;// '春节' or '正月初一'&lt;/span&gt;
  &lt;span class="n"&gt;solarTerm&lt;/span&gt;&lt;span class="o"&gt;?:&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;     &lt;span class="c1"&gt;// e.g. '立春' on '2027-02-04'&lt;/span&gt;
  &lt;span class="n"&gt;statutoryBadge&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;DayBadge&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Putting Verified Tables Into Print Output
&lt;/h2&gt;

&lt;p&gt;When we built the 2027 print engine behind &lt;a href="https://poster.creoart.app/printable-calendar-maker" rel="noopener noreferrer"&gt;the CreoArt printable calendar maker&lt;/a&gt; and its dedicated &lt;a href="https://poster.creoart.app/zh/printable-calendar-maker" rel="noopener noreferrer"&gt;Chinese lunar calendar layout builder&lt;/a&gt;, decoupling astronomical data from browser &lt;code&gt;Intl&lt;/code&gt; was the single highest-leverage reliability fix. Every date cell resolves from verified Hong Kong Observatory CST solar terms, exact UTC+8 new-moon boundaries, and the statutory 2027 schedule rather than whatever ICU build happens to ship in the visitor's browser.&lt;/p&gt;

&lt;p&gt;If you want to inspect how February 4 (立春), February 5–13 (Spring Festival), the February 6 正月初一 placement, and the January 31 / February 14 makeup workdays render together on a real A4 grid, you can inspect &lt;a href="https://poster.creoart.app/samples/creoart-2027-zh-a4-lunar-official-holidays.pdf" rel="noopener noreferrer"&gt;this zero-watermark 2027 Chinese A4 lunar calendar sample PDF&lt;/a&gt; directly.&lt;/p&gt;

&lt;p&gt;Whenever your software crosses astronomical boundaries or statutory calendars, treat browser &lt;code&gt;Intl&lt;/code&gt; as a localized string formatter—not as a source of astronomical truth.&lt;/p&gt;

</description>
      <category>javascripti18webdevtypographyn</category>
    </item>
    <item>
      <title>Building a Zero-Database Moral Alignment Test With Linear Math and a Checksum URL Hash</title>
      <dc:creator>Jason Liang</dc:creator>
      <pubDate>Thu, 26 Nov 2026 19:07:34 +0000</pubDate>
      <link>https://dev.to/aiacstudio/building-a-zero-database-moral-alignment-test-with-linear-math-and-a-checksum-url-hash-571l</link>
      <guid>https://dev.to/aiacstudio/building-a-zero-database-moral-alignment-test-with-linear-math-and-a-checksum-url-hash-571l</guid>
      <description>&lt;p&gt;Most personality quizzes on the web behave like slot machines. You click through thirty vague prompts, watch a fake progress bar spin for two seconds, and get handed a dramatic archetype with no explanation of how your answers turned into that label. Behind the curtain, there is usually an ad-tech payload, a backend database logging your responses, and a scoring table nobody bothered to audit.&lt;/p&gt;

&lt;p&gt;When I built the browser-only &lt;a href="https://vicefolk.com/moral-alignment-test" rel="noopener noreferrer"&gt;Moral Alignment Test&lt;/a&gt; at Vicefolk, I wanted the opposite architecture: no accounts, no database, no server-side scoring, and math plain enough to inspect in DevTools in thirty seconds.&lt;/p&gt;

&lt;h2&gt;
  
  
  Balanced Items and Plain Linear Math
&lt;/h2&gt;

&lt;p&gt;The classic nine-cell alignment chart rests on two independent dimensions: &lt;strong&gt;Order&lt;/strong&gt; (Lawful to Chaotic) and &lt;strong&gt;Morality&lt;/strong&gt; (Good to Evil). To keep the test short enough to finish in a coffee break while still separating noise from signal, I settled on 24 statements rated on a standard 1-to-5 Likert scale:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;12 Order items&lt;/strong&gt;: 6 Lawful-keyed and 6 Chaotic-keyed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;12 Moral items&lt;/strong&gt;: 6 Good-keyed and 6 Evil-keyed.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Splitting each axis evenly across positive and reverse-keyed statements does real work. People naturally lean toward agreeing with well-phrased sentences—a habit survey designers call &lt;em&gt;acquiescence bias&lt;/em&gt;. If all 12 Order prompts celebrate structure, an agreeable reader gets pushed toward Lawful even if they only hold mild opinions. Pairing 6 Lawful statements with 6 Chaotic statements forces the score back toward center unless the respondent holds a consistent stance.&lt;/p&gt;

&lt;p&gt;Each reverse-keyed item is flipped using &lt;code&gt;6 - rawValue&lt;/code&gt;, giving every axis an integer sum between &lt;code&gt;12&lt;/code&gt; and &lt;code&gt;60&lt;/code&gt;, with a neutral midpoint of &lt;code&gt;36&lt;/code&gt;. From there, the conversion to a readable coordinate is deterministic linear math:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;axis&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;36&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;No curve-fitting, no hidden multipliers, no opaque weighting. A sum of &lt;code&gt;12&lt;/code&gt; maps to &lt;code&gt;-100&lt;/code&gt;, &lt;code&gt;36&lt;/code&gt; maps to &lt;code&gt;0&lt;/code&gt;, and &lt;code&gt;60&lt;/code&gt; maps to &lt;code&gt;+100&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;To divide the &lt;code&gt;-100&lt;/code&gt; to &lt;code&gt;+100&lt;/code&gt; plane into the familiar 3×3 grid, each axis uses &lt;code&gt;±30&lt;/code&gt; cut lines. Scores at or above &lt;code&gt;+30&lt;/code&gt; land in Lawful or Good; scores at or below &lt;code&gt;-30&lt;/code&gt; land in Chaotic or Evil; everything in between lands in Neutral. Setting the cuts at &lt;code&gt;±30&lt;/code&gt; instead of &lt;code&gt;±33&lt;/code&gt; leaves the center band wide enough that genuinely mixed respondents land in Neutral without turning the outer eight boxes into tiny edge cases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Honest Borderline Coordinate Disclosure
&lt;/h2&gt;

&lt;p&gt;Hard cutoffs create a subtle dishonesty in almost every bucketed quiz. Suppose one person scores &lt;code&gt;+29&lt;/code&gt; on Order and another scores &lt;code&gt;+31&lt;/code&gt;. On a 24-question Likert test, that two-point gap is smaller than the difference a single tired click makes—yet a naive UI hands them completely separate identities and pretends the wall between them is made of concrete.&lt;/p&gt;

&lt;p&gt;To counter that false precision, the results view checks how close each coordinate sits to a &lt;code&gt;±30&lt;/code&gt; threshold. Whenever either axis lands within &lt;strong&gt;&lt;code&gt;±8&lt;/code&gt; points&lt;/strong&gt; of a cut line—meaning between &lt;code&gt;22&lt;/code&gt; and &lt;code&gt;38&lt;/code&gt;, or between &lt;code&gt;-38&lt;/code&gt; and &lt;code&gt;-22&lt;/code&gt;—the interface flags a &lt;strong&gt;Borderline Coordinate&lt;/strong&gt; and explicitly surfaces the adjacent alignment alongside the primary result. If your Order score is &lt;code&gt;+24&lt;/code&gt; and your Moral score is &lt;code&gt;+46&lt;/code&gt;, you see Neutral Good first, paired with a clear note that you sit right on the doorstep of Lawful Good.&lt;/p&gt;

&lt;h2&gt;
  
  
  Zero-Database Friend Overlays With a Checksummed Hash
&lt;/h2&gt;

&lt;p&gt;The most requested feature for a quiz like this is comparing results with a friend. The standard route is storing results in Postgres or Redis, generating a short ID, and serving a comparison URL—which immediately introduces privacy policies, database upkeep, and retention headaches for what is basically two integers.&lt;/p&gt;

&lt;p&gt;Instead, the entire friend overlay lives inside &lt;code&gt;location.hash&lt;/code&gt; using the format &lt;code&gt;#compare=order.moral.chk&lt;/code&gt;. Because browsers never send URL fragments to the server, your friend's coordinates never touch a backend log. When you open their link and finish your own run, the client parses the hash and plots both dots on the same 3×3 SVG grid.&lt;/p&gt;

&lt;p&gt;Originally, the hash was just &lt;code&gt;#compare=order.moral&lt;/code&gt;. Then a Reddit commenter pointed out a practical bug: certain messaging apps and mobile share sheets occasionally clip trailing characters off URL hashes, turning &lt;code&gt;#compare=24.46&lt;/code&gt; into &lt;code&gt;#compare=24.4&lt;/code&gt; and silently plotting the wrong dot. Adding a single trailing Base36 checksum character fixed the problem without bloating the URL.&lt;/p&gt;

&lt;p&gt;Here is the core scoring and hash validation module (full MIT reference spec + test vectors on GitHub: &lt;a href="https://github.com/WaterJason/moral-alignment-scoring-spec" rel="noopener noreferrer"&gt;moral-alignment-scoring-spec&lt;/a&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;scoreAxis&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;answers&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;directions&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="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;answers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reduce&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;acc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;i&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="n"&gt;val&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;directions&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;acc&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;val&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&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="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;36&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="mi"&gt;24&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&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;computeChecksum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;moral&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="n"&gt;o&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;order&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;moral&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;100&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="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;13&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;m&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;19&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;%&lt;/span&gt; &lt;span class="mi"&gt;36&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toString&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;36&lt;/span&gt;&lt;span class="p"&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="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;encodeCompareHash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;moral&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="sb"&gt;`#compare=${order}.${moral}.${computeChecksum(order, moral)}`&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="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;decodeCompareHash&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hashString&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="n"&gt;match&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;/^&lt;/span&gt;#&lt;span class="n"&gt;compare&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-?&lt;/span&gt;\&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;\&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;-?&lt;/span&gt;\&lt;span class="n"&gt;d&lt;/span&gt;&lt;span class="o"&gt;+&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;\&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;9a&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;z&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;$&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;i&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;exec&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;hashString&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;trim&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&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="n"&gt;order&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;]&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="n"&gt;moral&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;]&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="n"&gt;chk&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;match&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toLowerCase&lt;/span&gt;&lt;span class="p"&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;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;order&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;moral&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;moral&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;computeChecksum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;moral&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="n"&gt;chk&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="kc"&gt;null&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="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;moral&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If a chat client lops off the final character or corrupts a digit, &lt;code&gt;decodeCompareHash&lt;/code&gt; returns &lt;code&gt;null&lt;/code&gt; and the page falls back cleanly to a solo run instead of plotting fabricated coordinates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Keeping the Scope Honest
&lt;/h2&gt;

&lt;p&gt;One engineering boundary matters just as much as the code: being candid about what a tool is. This test is built strictly for self-reflection and entertainment—not clinical psychology or validated psychometric diagnosis. Simple linear math cannot diagnose a human being, and pretending otherwise would break the whole point of transparent design.&lt;/p&gt;

&lt;p&gt;For readers who like pairing an external coordinate map with a more inward-looking prompt set, the &lt;a href="https://vicefolk.com/moral-alignment-test" rel="noopener noreferrer"&gt;Moral Alignment Test&lt;/a&gt; sits alongside the 21-question &lt;a href="https://vicefolk.com/" rel="noopener noreferrer"&gt;7 Deadly Sins Test&lt;/a&gt; over on Vicefolk. Both run on the same philosophy: small footprints, zero logins, readable math, and no mystery box pretending to know you better than you know yourself.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>audio</category>
      <category>engineering</category>
    </item>
    <item>
      <title>Running a 120 FPS Pure Rust Multitrack DAW Inside a Browser Tab Under connect-src 'self' CSP</title>
      <dc:creator>Jason Liang</dc:creator>
      <pubDate>Thu, 26 Nov 2026 19:05:14 +0000</pubDate>
      <link>https://dev.to/aiacstudio/running-a-120-fps-pure-rust-multitrack-daw-inside-a-browser-tab-under-connect-src-self-csp-5335</link>
      <guid>https://dev.to/aiacstudio/running-a-120-fps-pure-rust-multitrack-daw-inside-a-browser-tab-under-connect-src-self-csp-5335</guid>
      <description>&lt;p&gt;Most browser-based DAWs treat the tab as a thin UI shell backed by WebSockets, cloud object storage, and server-side mixdown workers. Enforcing a strict &lt;code&gt;Content-Security-Policy: connect-src 'self'&lt;/code&gt; header flips that architecture: the browser engine itself blocks outbound audio uploads, third-party API calls, and remote telemetry. Every sample of synthesis, routing, metering, and export must execute inside local memory.&lt;/p&gt;

&lt;p&gt;Building a deterministic multitrack workstation under that constraint requires pairing a lock-free Rust &lt;code&gt;wasm32-unknown-unknown&lt;/code&gt; audio graph with GPU-instanced rendering and sample-accurate delay compensation.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Lock-Free wasm32-unknown-unknown Audio Graphs
&lt;/h2&gt;

&lt;p&gt;Web Audio drives real-time playback through &lt;code&gt;AudioWorkletProcessor&lt;/code&gt; in fixed &lt;strong&gt;128-sample render quanta&lt;/strong&gt;—a hard deadline of 2.667 ms at 48 kHz (2.902 ms at 44.1 kHz). Garbage-collected JavaScript inside the audio callback risks occasional 5–15 ms GC pauses that manifest as buffer underrun clicks.&lt;/p&gt;

&lt;p&gt;Compiling the DSP engine from pure Rust to &lt;code&gt;wasm32-unknown-unknown&lt;/code&gt; eliminates GC completely. To stay real-time safe:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Zero allocations in &lt;code&gt;process()&lt;/code&gt;:&lt;/strong&gt; Pre-allocate every track buffer, biquad filter state, compressor envelope, and delay ring buffer during graph construction or inside a background reallocation swap.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lock-free control plane:&lt;/strong&gt; UI parameter changes (fader moves, mute toggles, automation curves) never lock a mutex on the audio thread. They push fixed-size command structs across a single-producer/single-consumer (SPSC) ring buffer backed by &lt;code&gt;SharedArrayBuffer&lt;/code&gt; and &lt;code&gt;Atomics&lt;/code&gt; (or a double-buffered &lt;code&gt;MessagePort&lt;/code&gt; snapshot when cross-origin isolation is unavailable).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;SIMD vectorization:&lt;/strong&gt; Enabling &lt;code&gt;+simd128&lt;/code&gt; compiles Rust inner mixing loops and gain ramps directly to 128-bit WASM SIMD instructions, summing 32 stereo tracks in a small fraction of the 2.667 ms budget.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. 10 Inserts, 10 Sends, and Automatic PDC via DAG Scheduling
&lt;/h2&gt;

&lt;p&gt;Supporting &lt;strong&gt;10 serial inserts and 10 pre/post-fader sends&lt;/strong&gt; per channel creates a classic phase problem: if Track 1 runs a 64-sample lookahead limiter on Insert 3 while its parallel reverb bus or Track 2 has zero latency, summing them introduces comb filtering.&lt;/p&gt;

&lt;p&gt;Solve this with graph-level &lt;strong&gt;Automatic Plugin Delay Compensation (PDC)&lt;/strong&gt;. Model tracks, inserts, sends, and return buses as a directed acyclic graph (DAG) G=(V,E), execute a topological sort via Kahn's algorithm, and compute the maximum cumulative latency arriving at every summing node v:&lt;/p&gt;

&lt;p&gt;D(v)=(u,v)∈Emax​(D(u)+L(u))&lt;/p&gt;

&lt;p&gt;where L(u) is the reported sample latency of node u. On every incoming edge (u,v), allocate a circular delay buffer of length:&lt;/p&gt;

&lt;p&gt;Δu→v​=D(v)−(D(u)+L(u))&lt;/p&gt;

&lt;p&gt;Every parallel send and return arrives at the master bus phase-aligned to the exact sample, with zero manual track nudging.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. 120 FPS Rendering: WebGPU Primary, WebGL2 Fallback
&lt;/h2&gt;

&lt;p&gt;On 120 Hz displays, the UI thread gets &lt;strong&gt;8.33 ms per frame&lt;/strong&gt;. Rendering dozens of scrolling multitrack waveforms, automation lanes, and ballistic peak meters via DOM elements or SVG triggers constant layout thrashing.&lt;/p&gt;

&lt;p&gt;Instead, pre-compute multi-resolution min/max peak mipmaps (e.g., 64, 512, and 4096 samples per bucket) when audio enters memory and upload them to GPU storage buffers. Each frame draws the visible timeline window using &lt;strong&gt;instanced quad passes&lt;/strong&gt; and signed-distance-field (SDF) anti-aliased metering. &lt;strong&gt;WebGPU&lt;/strong&gt; serves as the primary renderer for low driver overhead and direct storage-buffer indexing, falling back seamlessly to &lt;strong&gt;WebGL2&lt;/strong&gt; instanced VBOs and texture-packed mipmaps on browsers or drivers without WebGPU support.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Lossless 32-Bit Float Bounce
&lt;/h2&gt;

&lt;p&gt;When exporting a mix, the same Rust graph runs in an offline loop decoupled from hardware clock interrupts—rendering faster than real time into an &lt;strong&gt;IEEE-754 32-bit float WAV&lt;/strong&gt; (&lt;code&gt;wFormatTag = 0x0003&lt;/code&gt;, &lt;code&gt;bitsPerSample = 32&lt;/code&gt;). Unlike 16-bit integer bounce, 32-bit float preserves over 1500 dB of dynamic range and retains peaks above 0 dBFS without clipping or truncation noise, giving downstream mastering processors clean headroom.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Honest Engineering Trade-Offs
&lt;/h2&gt;

&lt;p&gt;A &lt;code&gt;connect-src 'self'&lt;/code&gt; browser DAW makes deliberate architectural compromises compared to both cloud DAWs and native desktop workstations:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;Pure Rust Browser DAW (connect-src 'self')&lt;/th&gt;
&lt;th&gt;Cloud DAWs (BandLab / Soundtrap)&lt;/th&gt;
&lt;th&gt;Native Desktop DAWs (Reaper / Ableton)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Privacy &amp;amp; Offline Use&lt;/td&gt;
&lt;td&gt;100% local RAM; verifiable zero upload&lt;/td&gt;
&lt;td&gt;Requires cloud project sync and servers&lt;/td&gt;
&lt;td&gt;100% local disk/RAM&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Collaboration&lt;/td&gt;
&lt;td&gt;File export/import only&lt;/td&gt;
&lt;td&gt;Real-time multi-user cloud sessions&lt;/td&gt;
&lt;td&gt;Third-party sync or stems&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Plugin Ecosystem&lt;/td&gt;
&lt;td&gt;Built-in Rust/WASM DSP only&lt;/td&gt;
&lt;td&gt;Built-in web instruments/FX&lt;/td&gt;
&lt;td&gt;Arbitrary native VST3 / CLAP / AU binaries&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Memory &amp;amp; I/O Ceiling&lt;/td&gt;
&lt;td&gt;~2–4 GB wasm32 limit; OS mixer latency&lt;/td&gt;
&lt;td&gt;Server-backed storage; browser I/O&lt;/td&gt;
&lt;td&gt;Full system RAM; exclusive ASIO/CoreAudio (under 3 ms RTL)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If your priority is multi-user browser jam sessions or loading third-party commercial VST3 libraries, BandLab/Soundtrap or a native desktop host remains the right tool. If you need instant zero-install multitrack mixing, 10 inserts/sends with auto PDC, and 32-bit float export without uploading unreleased stems, &lt;a href="https://aiac.app/soundcraft/" rel="noopener noreferrer"&gt;AIAC SoundCraft&lt;/a&gt; runs this exact Rust/WASM architecture directly inside the tab. For a deeper technical matrix against cloud workspaces, see &lt;a href="https://aiac.app/vs/online-daw/" rel="noopener noreferrer"&gt;AIAC's Online DAW Comparison&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Launch the unmodified Rust WebAssembly studio with zero login: &lt;a href="https://aiac.app/soundcraft/" rel="noopener noreferrer"&gt;SoundCraft Online DAW&lt;/a&gt; · &lt;a href="https://aiac.app/vs/online-daw/" rel="noopener noreferrer"&gt;SoundCraft vs BandLab &amp;amp; Soundtrap&lt;/a&gt; · &lt;a href="https://aiac.app/lufs-meter/" rel="noopener noreferrer"&gt;ITU-R BS.1770-4 LUFS Meter&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

</description>
      <category>rust</category>
      <category>webassembly</category>
      <category>webdev</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
