diff options
Diffstat (limited to 'tools/spectool.cc')
| -rw-r--r-- | tools/spectool.cc | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/spectool.cc b/tools/spectool.cc index 1dd4ceb..7349912 100644 --- a/tools/spectool.cc +++ b/tools/spectool.cc @@ -29,7 +29,15 @@ int analyze_audio(const char* in_path, const char* out_path) { printf("Analyzing %s -> %s\n", in_path, out_path); + // Use higher quality resampling for better audio quality + // Source files are typically 44.1kHz or 96kHz, 16/24-bit, mono/stereo ma_decoder_config config = ma_decoder_config_init(ma_format_f32, 1, 32000); + + // CRITICAL: Use highest quality low-pass filter to preserve audio quality + // Default lpfOrder is very low, causing audible aliasing when downsampling + // Maximum lpfOrder is implementation-dependent, but 8 is reasonable for quality + config.resampling.linear.lpfOrder = 8; // Higher = better anti-aliasing (default is likely 1-2) + ma_decoder decoder; if (ma_decoder_init_file(in_path, &config, &decoder) != MA_SUCCESS) { printf("Error: Failed to open or decode audio file: %s\n", in_path); |
