Commit 069d121

Ansari <ping@ansari.wtf>
2026-08-05 16:21:09
Audio Processing flow
Even the author forgot how this repo worked. That's all you need to know. After digging through my own code like an archaeologist, I finally made a `flow.md` so nobody (especially me) has to suffer through that again.
1 parent 4331231
Changed files (1)
flow.md
@@ -0,0 +1,79 @@
+# Audio Processing Flow
+
+```
+                    main()
+                      │
+                      ▼
+      AudioProcessor(input, output)
+                      │
+                      ▼
+      processWithCustomResampler()
+                       │
+      ┌────────────────┘
+      │                                
+      ▼                                
+readRawAudioFile() ─▶ resample() ─▶  performAGC()
+                                           │
+                                           ▼
+                                    Create AGC instance
+                                           │
+                                           ▼
+                               GainController2 initialized
+                                           │
+                                           ▼
+                              Process audio in 10 ms frames
+                                          │                                                      
+                                          ▼                                                      
+                                 processFrame()                                             
+      ┌───────────────────────────────────┘
+      │                                
+      ▼   
+AGC::process(frame)  ─▶AudioBuffer::CopyFrom()  ─▶ GainController2::Process() ─▶AudioBuffer::CopyTo()
+                                                                                          │
+                                                                                          ▼
+                                                                        Processed frame copied to output buffer
+                                                                                          │
+                                                                                          ▼
+                                                                                  writeRawAudioFile()
+```
+
+---
+
+# GainController2 Internal Flow
+
+Each 10 ms audio frame follows the pipeline below.
+
+```
+                  Input Audio Frame
+                         │
+                         ▼
+                GainController2::Process()
+                         │
+                         ▼
+          Is internal VAD enabled?
+                 │              │
+              Yes              No
+                 │              │
+                 ▼              ▼
+      vad_->Analyze()     Caller must provide
+                           speech_probability
+                 │              │
+                 └──────┬───────┘
+                        ▼
+          speech_probability available?
+                        │
+                        ▼
+         SpeechLevelEstimator::Update()
+                        │
+                        ▼
+        Adaptive Digital Gain Controller
+                        │
+                        ▼
+             Apply gain to audio frame
+                        │
+                        ▼
+                 Output Audio Frame
+```
+
+---
+