<jupyter_start><jupyter_text>MFCCHere we will be using Mel-Frequency Cepstral Coefficients(MFCC) from the audio samples. The MFCC summarises the frequency distribution across the window size, so it is possible to analyse both the frequency and time characteristics of the sound. These audio representations will allow us to identify features for classification.<jupyter_code># feature extracting
def extract(location,filename):
    directory=location+filename
    audio, samplerate = librosa.load(directory, res_type='kaiser_fast')
    mfccs_features = librosa.feature.mfcc(y=audio, sr=samplerate, n_mfcc=40)
    mfccs_scaled_features = np.mean(mfccs_features.T,axis=0)
    return mfccs_scaled_features
extracted_features=[]
cls=[]
for index_num,row in tqdm(data.iterrows()):
    classLabel=row["label"]
    filename=row["fileName"]
    location=row["absPath"]
    data=extract(location,filename)
    extracted_features.append(data.tolist())
    cls.append(classLabel)
print(extracted_features[0:4])
print(cls[0:4])
### converting extracted_features to Pandas dataframe
data=pd.DataFrame(extracted_features)
data.head()
data['label'] = pd.DataFrame(cls)
data.head()
data.to_csv("processed.csv",index=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10517799352750809, 'fraction_numerical': 0.0056634304207119745, 'mean_word_length': 6.829113924050633, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '440142', 'license': 'MIT', 'n_tokens_mistral': 399, 'n_tokens_neox': 388, 'n_words': 90, 'path': 'preprocess.ipynb', 'repo_name': 'Ankit152/DigitAudio', 'size': '1236'}