1use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct StyleTransferConfig {
8 pub enabled: bool,
10
11 pub content_preservation_weight: f32,
13
14 pub style_transfer_strength: f32,
16
17 pub quality_threshold: f32,
19
20 pub transfer_method: StyleTransferMethod,
22
23 pub adaptation_settings: StyleAdaptationSettings,
25
26 pub feature_extraction: FeatureExtractionSettings,
28
29 pub synthesis_settings: SynthesisSettings,
31
32 pub realtime_settings: RealtimeProcessingSettings,
34}
35
36#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
38pub enum StyleTransferMethod {
39 ContentStyleDecomposition,
41
42 AdversarialTransfer,
44
45 CycleConsistentTransfer,
47
48 NeuralStyleTransfer,
50
51 SemanticStyleTransfer,
53
54 HierarchicalTransfer,
56}
57
58#[derive(Debug, Clone, Serialize, Deserialize)]
60pub struct StyleAdaptationSettings {
61 pub learning_rate: f32,
63
64 pub adaptation_iterations: usize,
66
67 pub regularization_strength: f32,
69
70 pub content_consistency_weight: f32,
72
73 pub style_consistency_weight: f32,
75
76 pub perceptual_loss_weight: f32,
78
79 pub adversarial_loss_weight: f32,
81}
82
83#[derive(Debug, Clone, Serialize, Deserialize)]
85pub struct FeatureExtractionSettings {
86 pub enable_prosodic: bool,
88
89 pub enable_spectral: bool,
91
92 pub enable_temporal: bool,
94
95 pub enable_semantic: bool,
97
98 pub feature_dimension: usize,
100
101 pub window_size: f32,
103
104 pub hop_size: f32,
106
107 pub normalization_method: NormalizationMethod,
109}
110
111#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
113pub enum NormalizationMethod {
114 ZScore,
116
117 MinMax,
119
120 Unit,
122
123 Quantile,
125
126 None,
128}
129
130#[derive(Debug, Clone, Serialize, Deserialize)]
132pub struct SynthesisSettings {
133 pub synthesis_method: SynthesisMethod,
135
136 pub vocoder_config: VocoderConfig,
138
139 pub post_processing: PostProcessingSettings,
141
142 pub quality_enhancement: QualityEnhancementSettings,
144}
145
146#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
148pub enum SynthesisMethod {
149 NeuralVocoder,
151
152 Parametric,
154
155 Hybrid,
157
158 DirectWaveform,
160}
161
162#[derive(Debug, Clone, Serialize, Deserialize)]
164pub struct VocoderConfig {
165 pub vocoder_type: VocoderType,
167
168 pub hop_length: usize,
170
171 pub filter_length: usize,
173
174 pub window_function: String,
176
177 pub mel_bins: usize,
179
180 pub sample_rate: u32,
182}
183
184#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
186pub enum VocoderType {
187 HiFiGAN,
189
190 WaveGlow,
192
193 ParallelWaveGAN,
195
196 MelGAN,
198
199 Universal,
201}
202
203#[derive(Debug, Clone, Serialize, Deserialize)]
205pub struct PostProcessingSettings {
206 pub noise_reduction: bool,
208
209 pub dynamic_range_compression: bool,
211
212 pub spectral_enhancement: bool,
214
215 pub artifacts_removal: bool,
217
218 pub enhancement_strength: f32,
220}
221
222#[derive(Debug, Clone, Serialize, Deserialize)]
224pub struct QualityEnhancementSettings {
225 pub super_resolution: bool,
227
228 pub bandwidth_extension: bool,
230
231 pub prosody_enhancement: bool,
233
234 pub target_quality: f32,
236
237 pub quality_speed_tradeoff: f32,
239}
240
241#[derive(Debug, Clone, Serialize, Deserialize)]
243pub struct RealtimeProcessingSettings {
244 pub enabled: bool,
246
247 pub chunk_size: usize,
249
250 pub lookahead_size: usize,
252
253 pub max_latency: f32,
255
256 pub gpu_acceleration: bool,
258
259 pub thread_pool_size: usize,
261}
262
263impl Default for StyleTransferConfig {
264 fn default() -> Self {
265 Self {
266 enabled: true,
267 content_preservation_weight: 0.7,
268 style_transfer_strength: 0.8,
269 quality_threshold: 0.75,
270 transfer_method: StyleTransferMethod::ContentStyleDecomposition,
271 adaptation_settings: StyleAdaptationSettings {
272 learning_rate: 0.001,
273 adaptation_iterations: 50,
274 regularization_strength: 0.01,
275 content_consistency_weight: 1.0,
276 style_consistency_weight: 1.0,
277 perceptual_loss_weight: 0.5,
278 adversarial_loss_weight: 0.1,
279 },
280 feature_extraction: FeatureExtractionSettings {
281 enable_prosodic: true,
282 enable_spectral: true,
283 enable_temporal: true,
284 enable_semantic: true,
285 feature_dimension: 512,
286 window_size: 25.0,
287 hop_size: 10.0,
288 normalization_method: NormalizationMethod::ZScore,
289 },
290 synthesis_settings: SynthesisSettings {
291 synthesis_method: SynthesisMethod::NeuralVocoder,
292 vocoder_config: VocoderConfig {
293 vocoder_type: VocoderType::HiFiGAN,
294 hop_length: 256,
295 filter_length: 1024,
296 window_function: "hann".to_string(),
297 mel_bins: 80,
298 sample_rate: 22050,
299 },
300 post_processing: PostProcessingSettings {
301 noise_reduction: true,
302 dynamic_range_compression: true,
303 spectral_enhancement: true,
304 artifacts_removal: true,
305 enhancement_strength: 0.5,
306 },
307 quality_enhancement: QualityEnhancementSettings {
308 super_resolution: true,
309 bandwidth_extension: true,
310 prosody_enhancement: true,
311 target_quality: 0.9,
312 quality_speed_tradeoff: 0.7,
313 },
314 },
315 realtime_settings: RealtimeProcessingSettings {
316 enabled: false,
317 chunk_size: 1024,
318 lookahead_size: 256,
319 max_latency: 100.0,
320 gpu_acceleration: true,
321 thread_pool_size: 4,
322 },
323 }
324 }
325}