alexokita

Decoder Tests Documentation

Comprehensive documentation for the Ribbit decoder tests page, including automated tests, microphone live testing, and WAV file generation.


Quick Start

Getting Started (3 Steps)

Step 1: Start the Server

cd web
npm start

You should see:

HTTPS server running on https://10.0.1.6:8443
Also available at https://localhost:8443

Step 2: Open the Test Page

https://localhost:8443/decoder_tests.html

Note: Accept the SSL certificate warning (self-signed cert) by clicking “Advanced” → “Proceed to localhost”

Step 3: Run Tests

Button Duration Purpose
Run Basic Tests ~10s Quick validation (3 messages)
Run Stress Test ~30s Load testing (configurable count)
Run Validation Tests ~30s Edge cases (6 tests)
Run Advanced Tests ~2min Unicode, emoji, boundaries (26 tests)

1-Minute Verification

1. ✅ Start server: npm start
2. ✅ Open: https://localhost:8443/decoder_tests.html
3. ✅ Click "Run Basic Tests"
4. ✅ Wait ~10 seconds
5. ✅ Verify: 3 Total, 3 Passed, 100% Accuracy

Features Overview

The decoder tests page provides a complete testing environment for the Ribbit codec:

Automated Tests

  1. Basic Tests - Predefined messages with known callsigns and gridsquares
  2. Stress Tests - Configurable number of messages (1-1000) with random content
  3. Validation Tests - Edge cases: empty messages, long callsigns, invalid chars, null bytes
  4. Advanced Tests - Unicode (Chinese, Japanese, Korean, Russian, Arabic), emoji, length boundaries

Live Testing

  1. Microphone Live Test - Real-time decoding from audio input
  2. WAV File Generator - Create audio files for cross-device and radio testing

Test Controls

  1. Noise Simulation - Add configurable noise (0-100%) to test robustness
  2. Wake-up Tone - Optional 300Hz preamble for radio VOX activation

Test Controls

Noise Level Slider

Messages to Send

Delay Between (ms)

Wake-up Tone Checkbox

When to Enable:

When to Disable:


Expected Results

Basic Tests (3 messages)

Stress Tests

Validation Tests (6 edge cases)

Noise Impact

| Noise Level | Expected Pass Rate | |————-|——————-| | 0% | >99% | | 25% | ~90% | | 50% | ~70% | | 75% | ~40% |


Microphone Live Test

What It Does

Captures audio from your computer’s microphone in real-time and decodes any Ribbit signals it detects. Perfect for testing signal reception from another device or radio transmission.

How to Use

  1. Click “Start Listening” button
  2. Grant microphone permission when prompted
  3. Play a Ribbit signal from another device or radio
  4. Watch decoded messages appear in real-time
  5. Click “Stop Listening” when done

Features

Technical Details

Use Cases


WAV File Generator

What It Does

Creates downloadable WAV audio files containing encoded Ribbit messages. These files can be played on any device, transmitted over radio, or used for testing.

How to Use

  1. Enter your message (up to 240 characters)
  2. Set callsign (max 8 characters, e.g., W1TEST)
  3. Set gridsquare (6 characters, e.g., FN31pr)
  4. Click “Generate & Download WAV”
  5. Optional: Click “Play Audio” to preview

WAV File Structure

┌─────────────────────────────────────┐
│ 300ms - 300Hz Wake-up Tone          │ ← Radio VOX activation
├─────────────────────────────────────┤
│ 100ms - Silence                     │ ← Decoder synchronization
├─────────────────────────────────────┤
│ Variable - Encoded Ribbit Message   │ ← Your message
├─────────────────────────────────────┤
│ 500ms - Tail Silence                │ ← Clean transmission end
└─────────────────────────────────────┘

File Format

Format:         WAV (RIFF)
Sample Rate:    8000 Hz
Bit Depth:      16-bit PCM
Channels:       1 (Mono)

Filename Format

YYYYMMDD_HHMMSS-CALLSIGN-GRIDSQUARE.wav

Examples:
- 20260115_143022-W1TEST-FN31PR.wav
- 20260115_150530-K6ABC-CM87UM.wav

File Sizes

| Duration | Samples | File Size | |———-|———|———–| | 1 second | 8,000 | ~16 KB | | 2 seconds | 16,000 | ~32 KB | | 2.3s (typical) | 18,400 | ~37 KB |

With wake-up tone: +2,400 samples (~5 KB)


Cross-Device Testing Workflow

Complete Testing Process

Step 1: Generate WAV File (Device A)

1. Open decoder_tests.html
2. Enter message: "Testing cross-device decoding 73!"
3. Set callsign: W1TEST
4. Set gridsquare: FN31pr
5. Click "Generate & Download WAV"

Step 2: Transfer File to Device B

Step 3: Start Listening (Device A)

1. Click "Start Listening"
2. Grant microphone permission
3. Position Device A to receive audio

Step 4: Play WAV File (Device B)

1. Open WAV file in any audio player
2. Set volume to 50-75%
3. Play the file
4. Position Device B 1-3 feet from Device A

Step 5: Verify Decoding (Device A)

1. Watch "Decoded Messages" panel
2. Verify message appears with:
   ✓ Callsign: W1TEST
   ✓ Gridsquare: FN31pr
   ✓ Text: "Testing cross-device decoding 73!"

Step 6: Test Variations


Radio Testing Workflow

Transmitting Ribbit Signals Over Radio

Step 1: Generate WAV File

1. Create message with your callsign
2. Include gridsquare for location
3. Keep message under 200 characters
4. Download WAV file

Step 2: Prepare Radio

1. Ensure proper amateur radio licensing
2. Select appropriate frequency
3. Set radio to appropriate mode (FM/SSB)
4. Adjust audio input levels
5. Enable VOX or use PTT

Step 3: Transmit

1. Monitor frequency (ensure clear)
2. Play WAV file into radio microphone
3. Or use audio interface for direct connection
4. Wake-up tone activates VOX automatically

Step 4: Receive and Decode

1. On receiving station: Open decoder_tests.html
2. Click "Start Listening"
3. Tune radio to transmission frequency
4. Adjust audio output to computer microphone
5. Watch for decoded message

Testing Scenarios

Scenario 1: Quick Smoke Test (1 minute)

1. Start server
2. Open decoder_tests.html
3. Click "Run Basic Tests"
4. Verify 100% pass rate

Scenario 2: Robustness Test (5 minutes)

1. Set noise to 0%, run Basic Tests → expect 100%
2. Set noise to 25%, run Basic Tests → expect >90%
3. Set noise to 50%, run Basic Tests → expect >70%
4. Set noise to 75%, run Basic Tests → expect >40%

Scenario 3: Load Test (10 minutes)

1. Set "Messages to Send" to 100
2. Set "Delay Between" to 100ms
3. Click "Run Stress Test"
4. Monitor memory usage in DevTools
5. Verify >95% pass rate

Scenario 4: Cross-Device Testing (5 minutes)

1. On Device A: Generate WAV file
2. Transfer to Device B
3. On Device A: Start microphone listening
4. On Device B: Play WAV at 50-75% volume
5. Verify message decodes correctly

Scenario 5: Radio Transmission (15 minutes)

1. Generate WAV with your callsign
2. Connect audio interface to radio
3. Monitor frequency for clear channel
4. Transmit WAV file
5. Receive on second radio
6. Decode using microphone test
7. Verify message accuracy

Troubleshooting

Server Issues

“Port 8443 already in use”

WASM Issues

“WASM failed to load”

Test Issues

“Tests never start”

“All tests fail”

Microphone Issues

“Microphone permission denied”

“No messages appearing”

WAV File Issues

“WAV file doesn’t decode”

“Audio sounds distorted”


Technical Reference

Dependencies

web/scripts/
├── decoder_tests.js    (Test implementation)
├── ribbit-wasm.js      (WASM API wrapper)
├── messageCodec.js     (Message encoding/decoding)
├── ribbit.js           (Emscripten glue code)
├── ribbit.wasm         (WebAssembly binary)
└── wav.js              (WAV file utilities)

Server Configuration

Message Validation Logic

Both tests and production use identical validation:

Performance Characteristics

Encoding Performance

Decoding Performance

Memory Usage

Browser Requirements

Required APIs: Web Audio API, Blob API, ES6 Modules, WASM


Best Practices

For Microphone Testing

For WAV File Generation

For Radio Testing


Success Criteria

The decoder tests are working correctly if:

✅ Basic tests achieve 100% pass rate with 0% noise
✅ Stress tests achieve >95% pass rate with 0% noise
✅ Validation tests correctly identify invalid messages
✅ Accuracy degrades gracefully with increased noise
✅ No memory leaks during extended stress tests
✅ Microphone test successfully decodes WAV files from another device
✅ WAV file generator creates valid files that decode correctly
✅ Cross-device testing works reliably at moderate volumes


Additional Resources


Version: 1.0
Last Updated: January 2026
Features: Automated Tests, Microphone Live Test, WAV File Generator, Wake-up Tone