- Add RNNoise neural network audio denoising (16kHz↔48kHz resampling) - Add transient suppressor to filter claps/clicks/pops before RNNoise - VAD now works on FILTERED audio (not raw) to avoid false triggers - Real-time denoised audio level display in UI - Save denoised audio previews in Opus format (.ogg) - Add extensive Whisper hallucination filter (Tingting, music, etc.) - Add "Clear" button to reset accumulated translations - Double VAD thresholds (0.02/0.08) for less sensitivity - Update Claude prompt to handle offensive content gracefully 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
66 lines
1.3 KiB
C++
66 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include <thread>
|
|
#include <atomic>
|
|
#include <string>
|
|
#include <vector>
|
|
#include "../utils/ThreadSafeQueue.h"
|
|
|
|
namespace secondvoice {
|
|
|
|
class AudioCapture;
|
|
class WhisperClient;
|
|
class ClaudeClient;
|
|
class TranslationUI;
|
|
class AudioBuffer;
|
|
|
|
struct AudioChunk {
|
|
std::vector<float> data;
|
|
int sample_rate;
|
|
int channels;
|
|
};
|
|
|
|
class Pipeline {
|
|
public:
|
|
Pipeline();
|
|
~Pipeline();
|
|
|
|
bool initialize();
|
|
bool start();
|
|
void stop();
|
|
|
|
// Call this from main thread for UI updates
|
|
void update();
|
|
|
|
bool isRunning() const { return running_; }
|
|
bool shouldClose() const;
|
|
|
|
// Clear accumulated translations
|
|
void clearAccumulated();
|
|
|
|
private:
|
|
void audioThread();
|
|
void processingThread();
|
|
|
|
std::unique_ptr<AudioCapture> audio_capture_;
|
|
std::unique_ptr<WhisperClient> whisper_client_;
|
|
std::unique_ptr<ClaudeClient> claude_client_;
|
|
std::unique_ptr<TranslationUI> ui_;
|
|
std::unique_ptr<AudioBuffer> full_recording_;
|
|
|
|
ThreadSafeQueue<AudioChunk> audio_queue_;
|
|
|
|
std::thread audio_thread_;
|
|
std::thread processing_thread_;
|
|
|
|
std::atomic<bool> running_{false};
|
|
std::atomic<int> recording_duration_{0};
|
|
|
|
// Simple accumulation
|
|
std::string accumulated_chinese_;
|
|
std::string accumulated_french_;
|
|
};
|
|
|
|
} // namespace secondvoice
|