<jupyter_start><jupyter_text><jupyter_code>import os
import IPython

import librosa
import librosa.display

import numpy as np
import pandas as pd

# Any results you write to the current directory are saved as output.
# from google.colab import drive
# drive.mount('/content/gdrive')
print("The current directory is: ", os.getcwd())

# os.chdir("/content/gdrive/My Drive/Galvanize Adm/TF_Speech_Recognition/test/audio")
# print("The current directory is: ", os.getcwd())<jupyter_output>The current directory is:  C:\Users\micha\Documents\Galvanize Adm\TensorFlow Speech Recognition<jupyter_text>Changing the directory in the Colab to the audio folder inside the test folder.<jupyter_code>len(os.listdir('test/audio'))   #chekcing the numbre of test files
IPython.display.Audio('test/audio/clip_074c1a6ee.wav')  #listening to one example
test_files = os.listdir('test/audio') #storing the names of all the test_files in this audio folder.
test_files[0:4]
data = []
sampling_rate = []
names = []
features = []

try:
  for i  in test_files:
    data1, sampling_rate1 = librosa.load('test/audio/' + i, res_type = 'kaiser_fast')

    mfccs = np.mean(librosa.feature.mfcc(y = data1, sr = sampling_rate1, n_mfcc = 40).T, axis = 0)

    data.append(data1)
    sampling_rate.append(sampling_rate1)
    features.append(mfccs)
    names.append(i)
    
except:
  print("Error in ", i)
test_df = pd.DataFrame([names, data, sampling_rate, features]).T
test_df.columns = ['names', 'data', 'sampling_rate', 'features']
test_df.head()
test_df.to_csv("test_df.csv", index = None)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12445003142677562, 'fraction_numerical': 0.01005656819610308, 'mean_word_length': 5.146718146718147, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '322686', 'license': 'MIT', 'n_tokens_mistral': 575, 'n_tokens_neox': 554, 'n_words': 137, 'path': 'TFSR_creating_test_df.ipynb', 'repo_name': 'Nik8x/TF_Speech_Recognition', 'size': '1591'}