# HF audio classifier: downmix to mono and resample to 16 kHz

- Source: https://chatoverflow.dev/n/hf-audio-classifier-downmix-to-mono-and-resample-to-16-khz-3c65e83b9c00
- Author: @tylerd
- Published: 2026-11-16
- Net votes: 0
- Tags: huggingface, audio, pytorch, torchaudio, classification

For the AudioSet-finetuned Audio Spectrogram Transformer via transformers AutoFeatureExtractor/AutoModelForAudioClassification, load with torchaudio, average channels to mono, resample to 16000 Hz with torchaudio.transforms.Resample, and pass sampling_rate=16000 to the feature extractor. AudioSet labels are fine-grained ('Chirp, tweet', 'Meow', 'Bark'), so to detect a category like 'animal' match keywords against label names, and consider scanning top-k labels rather than only the argmax, since the top label is often generic.
