본문으로 건너뛰기
cccskills
무료GitHub에 공개

agc-tuner

Analyze and optimize AGC (Automatic Gain Control) parameters for WaveCap-SDR channels. Use when audio is too quiet, too loud, has pumping artifacts, or when tuning AGC attack/release/target settings for FM/AM/SSB modes.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(2)

  • SKILL.md8.0 KB
  • source.json710 B

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

AGC Tuner for WaveCap-SDR

This skill helps analyze audio dynamics and optimize AGC (Automatic Gain Control) parameters for different demodulation modes.

When to Use This Skill

Use this skill when:

  • Audio output is too quiet or too loud
  • Audio has "pumping" or "breathing" artifacts (AGC responding too fast/slow)
  • Setting up AGC for a new demodulation mode (AM, SSB, digital)
  • Comparing AGC behavior between channels
  • Debugging why AGC isn't controlling gain properly
  • Finding optimal attack_time, release_time, and target_level

How It Works

The skill provides tools to:

  1. Analyze audio dynamics - Measure RMS levels, peak levels, crest factor over time
  2. Visualize AGC behavior - Plot gain adjustments, signal envelope, output level
  3. Suggest optimal parameters - Recommend attack/release times based on signal characteristics
  4. Compare settings - A/B test different AGC configurations

AGC Background

WaveCap-SDR's AGC (in backend/wavecapsdr/dsp/agc.py) maintains consistent audio output level:

class AGC:
    def __init__(self, attack_time: float, release_time: float, target_level: float):
        self.attack_alpha = 1.0 - np.exp(-1.0 / (attack_time * sample_rate))
        self.release_alpha = 1.0 - np.exp(-1.0 / (release_time * sample_rate))
        self.target_level = target_level
        self.current_gain = 1.0

Key Parameters:

  • attack_time: How quickly AGC responds to increases in signal level (seconds)
  • release_time: How quickly AGC responds to decreases in signal level (seconds)
  • target_level: Desired RMS output level (0.0 to 1.0, typically 0.1-0.3)

Usage Instructions

Step 1: Identify Channel to Analyze

Find the channel you want to optimize:

curl http://127.0.0.1:8087/api/v1/captures | jq '.[] | .channels'

Note the channel ID (e.g., "ch1") and current AGC settings.

Step 2: Capture Audio and Analyze Dynamics

Run the AGC analyzer to capture audio and measure dynamics:

PYTHONPATH=backend backend/.venv/bin/python .claude/skills/agc-tuner/agc_analyzer.py \
  --channel ch1 \
  --duration 10 \
  --port 8087

Parameters:

  • --channel: Channel ID to analyze (default: ch1)
  • --duration: Seconds of audio to capture (default: 10)
  • --port: Server port (default: 8087)
  • --host: Server host (default: 127.0.0.1)
  • --attack: Test attack time in seconds (default: current AGC setting)
  • --release: Test release time in seconds (default: current AGC setting)
  • --target: Test target level 0.0-1.0 (default: current AGC setting)
  • --plot: Generate plots of AGC behavior
  • --output: Save plots to file

Step 3: Interpret Results

The script outputs:

Signal Characteristics:

  • RMS Level: Average signal power over time
  • Peak Level: Maximum amplitude
  • Crest Factor: Peak/RMS ratio (high = dynamic, low = compressed)
  • Dynamic Range: Difference between loudest and quietest parts

AGC Behavior:

  • Gain Variation: How much AGC is adjusting gain
  • Settling Time: How long AGC takes to stabilize
  • Overshoot: Does AGC overcorrect?
  • Pumping Detection: Rapid gain changes indicating poor settings

Recommendations: The script suggests optimal attack/release times based on signal type.

Step 4: Typical AGC Settings by Mode

FM Broadcast (Music/Talk):

attack_time = 0.010   # 10ms - respond quickly to peaks
release_time = 0.500  # 500ms - slow release to avoid pumping
target_level = 0.2    # 20% RMS output

AM/SSB Voice:

attack_time = 0.005   # 5ms - fast attack for speech peaks
release_time = 0.300  # 300ms - moderate release
target_level = 0.25   # 25% RMS output (voice needs more headroom)

Digital Modes (P25, DMR):

attack_time = 0.001   # 1ms - very fast attack
release_time = 0.100  # 100ms - fast release
target_level = 0.3    # 30% RMS output (digital is pre-compressed)

NOAA Weather Radio:

attack_time = 0.020   # 20ms - moderate attack
release_time = 0.800  # 800ms - very slow release (steady signal)
target_level = 0.15   # 15% RMS output (avoid distortion)

Step 5: Update Channel AGC Settings

Update AGC parameters via API:

# Update AGC settings for channel
curl -X PATCH http://127.0.0.1:8087/api/v1/channels/ch1 \
  -H "Content-Type: application/json" \
  -d '{
    "agcAttackMs": 10,
    "agcReleaseMs": 500,
    "agcTargetDb": -20
  }'

# Note: Channel settings can be updated while running (no restart needed)

Or update in backend/config/wavecapsdr.yaml presets/recipes.

Common AGC Issues and Solutions

Issue: Audio Too Quiet

Symptoms: Output barely audible even at full volume Diagnosis: Target level too low, or source signal very weak Solution:

  • Increase target_level from 0.1 to 0.3
  • Check if antenna/tuning is good (use audio-quality-checker skill)
  • Verify channel is started and streaming

Issue: Audio Pumping/Breathing

Symptoms: Volume swells up and down, "breathing" artifacts Diagnosis: Release time too fast for signal characteristics Solution:

  • Increase release_time (e.g., 0.1 → 0.5 seconds)
  • For steady signals (NOAA weather), use very slow release (0.8-1.0s)
  • For music, use 0.3-0.5s release

Issue: Clipping/Distortion

Symptoms: Audio sounds distorted, harsh, broken up Diagnosis: Target level too high, or attack time too slow Solution:

  • Decrease target_level (e.g., 0.3 → 0.15)
  • Decrease attack_time to catch peaks faster (e.g., 0.02 → 0.005)
  • Check for overmodulation at source (reduce SDR gain)

Issue: Slow Response to Level Changes

Symptoms: AGC doesn't adjust quickly enough when switching between quiet/loud Diagnosis: Attack time too slow Solution:

  • Decrease attack_time (e.g., 0.05 → 0.01 seconds)
  • Be careful not to go too fast or AGC will respond to individual waveforms

Advanced: Testing Parameter Sweeps

Test multiple AGC configurations and compare:

# Test attack times from 1ms to 50ms
for attack in 0.001 0.005 0.010 0.020 0.050; do
  echo "Testing attack_time=$attack"
  PYTHONPATH=backend backend/.venv/bin/python .claude/skills/agc-tuner/agc_analyzer.py \
    --channel ch1 \
    --duration 5 \
    --attack $attack \
    --release 0.5 \
    --target 0.2 \
    --output "agc_test_attack_${attack}.png"
done

Compare the output plots to find optimal settings.

Technical Details

AGC Algorithm: The AGC uses exponential smoothing to track signal envelope:

# Compute signal envelope (RMS)
envelope = sqrt(mean(signal^2))

# Compute desired gain
desired_gain = target_level / envelope

# Smooth gain changes
if desired_gain < current_gain:
    # Attack: signal increased, reduce gain quickly
    current_gain += attack_alpha * (desired_gain - current_gain)
else:
    # Release: signal decreased, increase gain slowly
    current_gain += release_alpha * (desired_gain - current_gain)

# Apply gain
output = signal * current_gain

Time Constants: Attack/release times are converted to smoothing factors (alpha):

alpha = 1.0 - exp(-1.0 / (time_constant * sample_rate))
  • Larger time constant → slower response (smaller alpha)
  • Smaller time constant → faster response (larger alpha)

Headroom: AGC maintains headroom to avoid clipping:

  • Target level of 0.2 means output RMS is 20% of full scale
  • This leaves ~14 dB of headroom for peaks (crest factor ~5)

Files in This Skill

  • SKILL.md: This file - instructions for using the skill
  • agc_analyzer.py: Audio dynamics analyzer and AGC simulator

Notes

  • AGC operates on demodulated audio (after FM/AM demodulation)
  • For best results, test with real signals (not test tones)
  • AGC settings are per-channel, not global
  • Extremely fast attack times (<1ms) can cause distortion
  • Very slow release times (>2s) can make AGC unresponsive
  • Target level around 0.2 (20%) is a good starting point

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

007

무료

Security audit, hardening, threat modeling (STRIDE/PASTA), Red/Blue Team, OWASP checks, code review, incident response, and infrastructure security for any project.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aibot88/sec_skill_store52026년 5월 27일 업데이트

Guides the creation of agile user stories and Gherkin feature files. Use when the user wants to create a user story, write acceptance criteria, define Gherkin scenarios, or author BDD feature files. This should trigger for requests such as Create a user story; Write a user story; I need to write a user story. Part of cursor-rules-java project

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aibot88/sec_skill_store52026년 5월 27일 업데이트

Facilitates conversational discovery to create Architectural Decision Records (ADRs) for non-functional requirements using the ISO/IEC 25010:2023 quality model. Use when the user wants to document quality attributes, NFR decisions, security/performance/scalability architecture, or design systems with measurable quality criteria. This should trigger for requests such as Create ADR for Non-functional requirements; Document Non-functional requirements; Capture Non-functional requirements; Generate Non-functional requirements in an ADR. Part of cursor-rules-java project

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aibot88/sec_skill_store52026년 5월 27일 업데이트

Run a health check on an existing project: dependency audit, security scan, test runner detection, CI/CD evaluation, and missing configuration analysis. Maps the three execution gates (pre/in/post) from /10x-bootstrapper to an assessment framework for existing codebases. Reads optional context/foundation/stack-assessment.md from /10x-stack-assess to focus checks on identified gaps. Writes context/foundation/health-check.md with findings, prioritized fixes, and an agent-readiness verdict. Use when the user has an existing project and wants to verify its health before working with an agent. Trigger phrases: "health check", "check my project", "audit my project", "is my project healthy", "sprawdź projekt", "audyt projektu", "health-check", "project health". Use AFTER /10x-stack-assess (brownfield chain), BEFORE agent onboarding (m1-l4).

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aibot88/sec_skill_store52026년 5월 27일 업데이트

10x-team

무료

You MUST use this when building projects end-to-end. Orchestrates all 12 team roles — automatically switches between CTO, architect, PM, engineers, SRE, security, DBA, QA, and EM based on the current phase of work. Starts with brainstorming before any implementation.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aibot88/sec_skill_store52026년 5월 27일 업데이트

Use when you need to add or configure Maven plugins in your pom.xml — including quality tools (enforcer, surefire, failsafe, jacoco, pitest, spotbugs, pmd), security scanning (OWASP), code formatting (Spotless), version management, container image build (Jib), build information tracking, and benchmarking (JMH) — through a consultative, modular step-by-step approach that only adds what you actually need. This should trigger for requests such as Add Maven plugins in pom.xml; Improve Maven plugins in pom.xml. Part of cursor-rules-java project

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

aibot88/sec_skill_store52026년 5월 27일 업데이트

aibot88의 스킬 모두 보기

이 스킬의 문제 신고