microsoft / CLAP

Learning audio concepts from natural language supervision
MIT License
455 stars 35 forks source link

audio preprocessing and duration for pretrained model inference #33

Closed sivannavis closed 1 month ago

sivannavis commented 4 months ago

Hi! I'm using pretrained clap models for downstream tasks. I'm wondering if it's necessary to do the preprocessing in your wrapper code here? Seems like this function made sure the audio is repeated or truncated to be 7 or 5 seconds as predefined. However, I found the model HTSAT or CNN can take variable lengths and output 1024 embedding regardless even without such preprocessing.

Could you tell me if it's important to do this when I use the model for inference?

Thanks!

bmartin1 commented 3 months ago

CLAP performs better with recordings of 7 seconds length, that's why we preprocess the audio. You can try different ways to preprocess the length, and different ways to preprocess longer recordings. The length constraint from CLAP comes from HTSAT.