Loop-based sleep applications fail for a reason that has little to do with audio engineering and everything to do with human perception. An eight-minute rain recording, no matter how professionally captured, contains repeating micro-structure: the same cluster of droplet impacts, the same phase relationship between low rumble and high hiss. By the third minute your auditory cortex tags the signal as "recording" rather than "environment," and sleep grows lighter precisely when you needed darkness and continuity. Estua takes a different approach: it synthesizes ambient audio in real time at forty-eight kilohertz on your phone, producing output with no fixed period and no seam to detect.
The signal chain begins with a master clock running at forty-eight kilohertz with a fixed block size of five hundred twelve samples, which equals approximately ten point seven milliseconds per callback. This audio thread is sacred territory — no heap allocation, no logging, no network calls — a discipline shared with Sonarish's capture path and documented in our audio thread post. White noise enters a pink-noise shaping stage using Paul Kellet's economical recursive filter or an equivalent biquad stack, producing the characteristic one-over-f frequency spectrum where energy per octave stays constant. An optional brown-noise layer adds low-frequency rumble for ocean-like scenes. Multiple slow low-frequency oscillators, running between zero point zero two and zero point fifteen hertz with uncorrelated phases, modulate filter cutoff and gain so that no periodicity emerges at thirty or sixty second intervals — the timescales where loop-based apps betray themselves.
Scenes, seeds, and the statistics of surf
Each scene — Rain, Ocean, Wind, and others — layers additional processing on the pink foundation. Rain adds band-passed noise bursts triggered with Poisson-distributed inter-arrival times, mimicking the random spacing of droplets on a roof. Ocean mixes amplitude modulation on a low band between eighty and four hundred hertz with mid-frequency hiss, creating the slow breathing quality of surf without any recorded waveform to repeat. A soft limiter clips at minus one decibel full scale, preventing digital full-scale spikes that would startle a sleeping listener at three AM.
Each night you choose a scene and a seed, or let the application pick randomly. The seed initializes pseudorandom number generators governing noise samples and LFO phase offsets. The same seed produces the same soundscape for that session — useful when you liked last night's rain — but we optionally stir the seed with the calendar date so that "Rain plus seed forty-two" is not identical every night for years. This balances reproducibility within a session against long-term variety across weeks.
Why crossfading two loops is not enough
A common industry workaround crossfades between two loop segments to hide the seam. Crossfading hides the audible click at the splice point, but it does not change the underlying statistics. Autocorrelation of looped rain still spikes at the loop period T, and the human auditory system detects periodicity at remarkably subtle levels — evolution favored spotting patterned threats in rustling grass. Real ocean surf approximates pink noise with occasional transient swash events whose timing follows no fixed schedule. Synthesis costs three to eight percent CPU on modern phones for our stack, but buys uncorrelated output for hours of continuous playback.
On iOS, Estua drives an AVAudioEngine manual source node callback with playback session category; on Android, AudioTrack runs at PCM float encoding with low-latency mode when the OEM supports it. Both platforms enforce the no-allocation rule in the hot path. Estua is not binaural beats, not AI-generated music, and not a streaming wrapper. There are no accounts and no analytics on listening habits. A timer fades volume over twenty to forty-five minutes; a separate alarm uses a gentle synthesized tone from a different scene so the sound that woke you is not the sound you slept to. For the psychoacoustic background on one-over-f noise and sleep, see sleep, waves, and why your brain likes surf; for why we keep all of this local, read why everything runs on your phone.
App ngủ kiểu loop fail vì lý do ít liên quan kỹ thuật audio và nhiều liên quan cảm nhận con người. Track mưa tám phút, dù ghi chuyên nghiệp, vẫn lặp micro-structure: cùng cụm giọt rơi, cùng quan hệ phase giữa rumble thấp và hiss cao. Đến phút thứ ba vỏ não thính giác gắn nhãn tín hiệu là "recording" chứ không phải "môi trường," và giấc ngủ nông đi đúng lúc bạn cần liên tục và tối. Estua đi hướng khác: tổng hợp ambient real-time ở 48 kHz trên điện thoại, tạo output không chu kỳ cố định và không có seam để bắt.
Chuỗi tín hiệu bắt đầu master clock 48 kHz với block 512 sample, tương đương khoảng 10,7 ms mỗi callback. Audio thread là vùng thiêng — không cấp phát heap, không log, không network — kỷ luật chia với capture path Sonarish và ghi trong bài audio thread. White noise vào tầng shape pink noise bằng filter đệ quy tiết kiệm Paul Kellet hoặc stack biquad tương đương, tạo phổ tần số đặc trưng một-trên-f với năng lượng mỗi octave gần bằng nhau. Layer brown noise tùy chọn thêm rumble tần thấp cho scene kiểu biển. Nhiều bộ dao động tần số thấp chạy 0,02–0,15 Hz với phase không tương quan, điều chế cutoff filter và gain để không periodicity ở 30 hay 60 giây — timescale app loop thường lộ.
Scene, seed và thống kê sóng biển
Mỗi scene — Mưa, Biển, Gió và các scene khác — xếp thêm xử lý trên nền pink. Mưa thêm burst noise đã band-pass kích hoạt theo thời gian đến Poisson, mô phỏng khoảng cách ngẫu nhiên giọt trên mái. Biển trộn biến điệu biên độ dải thấp 80–400 Hz với hiss tần trung, tạo nhịp thở chậm của sóng mà không có waveform ghi hình để lặp. Soft limiter clip ở −1 dBFS, chặn spike full-scale digital đánh thức listener lúc ba giờ sáng.
Mỗi đêm bạn chọn scene và seed, hoặc để app random. Seed khởi tạo PRNG cho sample noise và offset phase LFO. Cùng seed cho cùng soundscape session đó — hữu ích khi thích mưa đêm qua — nhưng team tùy chọn stir seed với ngày lịch để "Mưa + seed 42" không giống hệt mỗi đêm suốt năm. Cân bằng tái lập trong session và đa dạng dài hạn qua tuần.
Vì sao crossfade hai loop không đủ
Workaround phổ biến crossfade hai đoạn loop để che seam. Crossfade che click ở chỗ nối, nhưng không đổi thống kê nền. Autocorrelation mưa loop vẫn spike ở chu kỳ T, và hệ thính giác phát hiện periodicity ở mức rất tinh — tiến hóa ưu tiên pattern nguy hiểm trong cỏ xào xạc. Sóng biển thật gần pink noise cộng swash thoáng qua không lịch cố định. Synthesis tốn 3–8% CPU trên máy mới cho stack team, nhưng mua output không tương quan hàng giờ phát liên tục.
Trên iOS Estua drive callback source node thủ công AVAudioEngine với session playback; Android AudioTrack chạy PCM float, low-latency khi OEM hỗ trợ. Hai nền tảng ép luật không allocate trên hot path. Estua không phải binaural beats, không AI nhạc, không bọc stream. Không tài khoản, không analytics thói quen nghe. Timer fade volume 20–45 phút; báo thức tone tổng hợp nhẹ từ scene khác để âm đánh thức không trùng âm đã ngủ. Nền psychoacoustic về noise 1/f và giấc ngủ: ngủ, sóng, và vì sao não thích biển; vì sao giữ mọi thứ local: vì sao mọi thứ chạy trên điện thoại.