Docs
Kifuliiru.com
Applications
Kifuliiru.com
Overview
IntroductionArchitectureDevelopment setup
Design languageCalculatorNumbers systemMath question templatesTranslation systemRole-based access controlAudio systemAPI implementation plan
Platform integration
HomeBrowse applications

© 2026 Wekify LLC · Kifuliiru Lab

Homellms.txtkifuliiru.com

GuidesAudio system

Audio system

Audio integration and pronunciation.

Overview

This system provides client-side audio concatenation for Kifuliiru numbers using existing audio files from the Supabase storage bucket tuharure-audio.

Features

  • Client-side concatenation - No server-side processing required
  • Signed URL access - Secure access to private Supabase storage
  • Real-time playback - Play any number by concatenating audio files
  • Caching - Audio files are cached in browser memory
  • Responsive UI - Multiple component sizes and variants

Architecture

Core Components

1. AudioService (src/lib/audioService.ts)

  • Handles Supabase storage access with signed URLs
  • Manages audio file caching
  • Implements number decomposition logic
  • Provides audio concatenation and playback

2. AudioPlayer (src/components/audio/AudioPlayer.tsx)

  • Full-featured audio player with controls
  • Progress tracking and visual feedback
  • Play/pause/stop functionality
  • Volume control (basic)

3. NumberAudioButton (src/components/audio/AudioPlayer.tsx)

  • Simple button component for quick audio playback
  • Multiple sizes and variants
  • Perfect for number grids and lists

Usage

Basic Audio Player

Code
import { AudioPlayer } from '@/components/audio/AudioPlayer';

<AudioPlayer 
 number={1234} 
 showControls={true}
 autoPlay={false}
/>
```text

### Simple Audio Button
```tsx
import { NumberAudioButton } from '@/components/audio/AudioPlayer';

<NumberAudioButton
 number={5678}
 size="md"
 variant="primary"
/>
```text

### Direct Service Usage
```tsx
import { audioService } from '@/lib/audioService';

// Play a number
await audioService.playNumber(1234);

// Play concatenated components
await audioService.playConcatenated(['thousands/1000.mp3', 'hundreds/200.mp3', 'tens/30.mp3', 'basic/4.mp3']);

// Stop playback
audioService.stop();
```text

## Audio File Structure

The system expects audio files to be organized in the `tuharure-audio` bucket as:

```text
tuharure-audio/
├── basic/ # 1-9
│ ├── 1.mp3
│ ├── 2.mp3
│ └── ...
├── tens/ # 10-90
│ ├── 10.mp3
│ ├── 20.mp3
│ └── ...
├── hundreds/ # 100-900
│ ├── 100.mp3
│ ├── 200.mp3
│ └── ...
├── thousands/ # 1000-9000
│ ├── 1000.mp3
│ ├── 2000.mp3
│ └── ...
├── units/ # Unit words
│ ├── thousands.mp3
│ ├── millions.mp3
│ └── billions.mp3
└── connectors/ # Connector words
 └── na.mp3
```text

## Number Decomposition Logic

The system automatically decomposes numbers into audio components:

- **1234** → `thousands/1000.mp3` + `hundreds/200.mp3` + `tens/30.mp3` + `basic/4.mp3`
- **56789** → `tens/50.mp3` + `thousands/6000.mp3` + `hundreds/700.mp3` + `tens/80.mp3` + `basic/9.mp3`
- **1000000** → `basic/1.mp3` + `units/millions.mp3`

## Environment Variables Required

```bash
NEXT_PUBLIC_SUPABASE_URL=your_supabase_url
NEXT_PUBLIC_SUPABASE_ANON_KEY=your_supabase_anon_key
```text

## Demo Page

Visit `/audio-demo` to test the audio system with various numbers and see all available components in action.

## Integration Examples

### Numbers Page
The audio system is already integrated into the numbers page (`/numbers`) where each number card has an audio button.

### Any Number Tool
The audio system can be easily integrated into the any-number tool for pronunciation of any number.

## Performance Considerations

- **Preloading**: Common audio files (1-20, 100, 1000) are preloaded for better performance
- **Caching**: Audio files are cached in browser memory to avoid repeated downloads
- **Signed URLs**: URLs expire after 1 hour, but are refreshed automatically
- **Error Handling**: Graceful fallback for missing or corrupted audio files

## Future Enhancements

- **Volume Control**: Individual audio file volume control
- **Playback Speed**: Adjustable playback speed
- **Offline Support**: Service worker for offline audio playback
- **Audio Visualization**: Waveform or progress visualization
- **Multiple Voices**: Support for different speaker voices
PreviousRole-based access controlNextAPI implementation plan

On this page

  • Overview
  • Features
  • Architecture
  • Core Components
  • 1. AudioService (src/lib/audioService.ts)
  • 2. AudioPlayer (src/components/audio/AudioPlayer.tsx)
  • 3. NumberAudioButton (src/components/audio/AudioPlayer.tsx)
  • Usage
  • Basic Audio Player