Native Kotlin alarm application engineered for heavy sleepers — enforcing cognitive wakefulness via interactive mental puzzles and decaying snooze penalties.
Silencing an alarm requires solving arithmetic equations, matching emoji memory matrices, or matching visual pattern sequences ("Simon Says").
Dynamic penalty engine that shrinks snooze windows with each press (e.g. 10m → 5m → 3m) until complete lockout enforces wakefulness.
Procedural audio synthesizer using Android AudioTrack API to output non-habituation soundscapes (Digital Beep, Chimes, Laser Siren).
Built-in mission practice lab allowing users to test puzzle types and difficulty levels directly from the Compose dashboard.
// Kotlin AudioTrack Procedural PCM Sound Synthesis
fun generateBeepTone(sampleRate: Int = 44100, freq: Double = 1200.0): AudioTrack {
val numSamples = sampleRate * 2
val sample = DoubleArray(numSamples) { i -> Math.sin(2.0 * Math.PI * i * freq / sampleRate) }
val pcmBuffer = ShortArray(numSamples) { i -> (sample[i] * 32767).toInt().toShort() }
return AudioTrack.Builder()
.setAudioAttributes(AudioAttributes.Builder().setUsage(AudioAttributes.USAGE_ALARM).build())
.setBufferSizeInBytes(pcmBuffer.size * 2)
.build().apply { write(pcmBuffer, 0, pcmBuffer.size); play() }
}
| Feature | Implementation | Benefit |
|---|---|---|
| UI Rendering | Jetpack Compose | High-performance reactive animations |
| Audio Engine | AudioTrack PCM + Volume Ramping | Non-habituation alerts with zero stress shock |
| Persistence | Room Database + Kotlin Flow | Real-time reactive alarm state updates |
| Background Reliability | Foreground Service + AlarmManager | Guaranteed trigger delivery under Doze mode |