{"record":{"id":"0b717e18bbcb192e","repo":"iflytek/astron-agent","slug":"audio-sample-rate-too-low","errorCode":"AUDIO_SAMPLE_RATE_TOO_LOW","errorMessage":"AUDIO_SAMPLE_RATE_TOO_LOW","messagePattern":"AUDIO_SAMPLE_RATE_TOO_LOW","errorType":"validation","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/commons/src/main/java/com/iflytek/astron/console/commons/util/AudioValidator.java","lineNumber":142,"sourceCode":"                if (durationSeconds > MAX_DURATION_SECONDS) {\n                    throw new BusinessException(ResponseEnum.AUDIO_DURATION_TOO_LONG);\n                }\n            }\n        }\n    }\n\n    @NotNull\n    private static AudioFormat getAudioFormat(AudioInputStream audioInputStream) {\n        AudioFormat format = audioInputStream.getFormat();\n\n        // Check number of channels (mono)\n        if (format.getChannels() != REQUIRED_CHANNELS) {\n            throw new BusinessException(ResponseEnum.AUDIO_CHANNELS_INVALID);\n        }\n\n        // Check sample rate (24kHz and above)\n        if (format.getSampleRate() < MIN_SAMPLE_RATE) {\n            throw new BusinessException(ResponseEnum.AUDIO_SAMPLE_RATE_TOO_LOW);\n        }\n\n        // Check bit depth (16bit)\n        if (format.getSampleSizeInBits() != REQUIRED_SAMPLE_SIZE) {\n            throw new BusinessException(ResponseEnum.AUDIO_BIT_DEPTH_INVALID);\n        }\n        return format;\n    }\n\n    /**\n     * Validate basic properties for MP3 and M4A formats\n     */\n    private static void validateMp3M4aBasic(MultipartFile file) throws BusinessException {\n        // For MP3 and M4A, only basic validation can be performed currently\n        // Duration check is roughly estimated by file size (this is not a precise method, but it is a\n        // reasonable approximation without specialized libraries)\n        long fileSize = file.getSize();\n","sourceCodeStart":124,"sourceCodeEnd":160,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/commons/src/main/java/com/iflytek/astron/console/commons/util/AudioValidator.java#L124-L160","documentation":"BusinessException(ResponseEnum.AUDIO_SAMPLE_RATE_TOO_LOW) thrown by getAudioFormat when format.getSampleRate() is below MIN_SAMPLE_RATE (24kHz). The service requires voice-quality audio at 24kHz or higher, so low-rate recordings are rejected after the channel check.","triggerScenarios":"Uploading WAV/PCM audio sampled below 24000 Hz — e.g. 8kHz telephone-quality recordings or 16kHz speech corpora — to the endpoint that runs getAudioFormat via validateAudioProperties/format.","commonSituations":"Legacy telephony recordings (8kHz); speech datasets exported at 16kHz; recorder apps configured for small files at low sample rates; conversions that downsampled the audio.","solutions":["Resample to at least 24kHz with ffmpeg: ffmpeg -i low.wav -ar 24000 resampled.wav (note: upsampled audio adds no information but passes the gate).","Re-record at 24kHz+ — set the capture device/app sample rate to 24000 or 48000 Hz.","Export from the audio editor with sample rate >= 24000 Hz.","Check the current requirement (MIN_SAMPLE_RATE in AudioValidator) before exporting."],"exampleFix":"// before: 8kHz telephony recording rejected\nupload(call_8k.wav)\n// after: resample to 24kHz+\n// ffmpeg -i call_8k.wav -ar 24000 call_24k.wav\nupload(call_24k.wav)","handlingStrategy":"validation","validationCode":"// ffprobe -v error -show_entries stream=sample_rate -of csv=p=0 file.wav  -> expect >= 24000","typeGuard":null,"tryCatchPattern":"try { AudioValidator.validateAudioProperties(file); }\ncatch (BusinessException e) { if (ResponseEnum.AUDIO_SAMPLE_RATE_TOO_LOW.equals(e.getResponseEnum())) { /* 400: ask user to resample >= 24kHz */ } else { throw e; } }","preventionTips":["Record at 24kHz or 48kHz sample rate.","Resample with ffmpeg -ar 24000 before upload.","Avoid telephony-grade 8kHz sources.","Check ffprobe sample_rate before sending."],"tags":["java","audio","sample-rate","wav"],"backgroundTag":"value-out-of-range","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}