Hello everyone,
I am newer to using Praat but have used Python for a little while now. I am trying to run a Praat script through parselmouth that analyzes features of audio files in batches. I have tested it on some small batches, and it works great. However, I need to analyze about 6,000 audio files that are each 2-3 minutes long for a machine learning project. When I try to do this, I get this error message:
"Out of memory: there is not enough room for (some large number) more elements whose sizes are 8 bytes each. Matrix of elements not created. Sound Not Created . . ."
I suspect that the operating system does not like allocating so much memory to one application, resulting in the crash. Has anyone else experienced something like this when trying to analyze large batches? Is there a way to work around it by deleting Praat Sound objects as I go, or is the only solution to manually break it into small batches?
Any advice would be very appreciated. I will attach the relevant piece of my code below if it is helpful.
Thanks,
Abe
Code for batch analysis:
# set up path for Praat script and audio folder
script_path = "example_path/syllablenucleiv3.praat"
audios = []
audio = "example_path/audio_folder"
# find audio files within audio folder and create sound objects
for file in os.listdir(audio):
f = os.path.join(audio, file)
if os.path.isfile(f):
sndObj = parselmouth.Sound(f)
sndObj.name = file
audios.append(sndObj)
# run Praat script on the list of Praat sound objects
run_file(audios,
script_path,
sndObj.name,
"None", # Pre processing: "None", "Band pass (300..3330 Hz)", "Reduce Noise"
-25, # Silence threshold (dB): (default -25)
2, # Minimum dip near peak (dB): (default 2)
0.3, # Minimum pause duration (s): (default 0.3)
False, # Detect Filled Pauses (bool)
"English", # Language (for Filled Pasuses): "English"/"Dutch"
1, # Filled Pause threshold: (default 1.00)
"Save as text file", # Data: "TextGrid(s) only", "Praat Info window", "Save as text file", "Table"
"OverWriteData", # DataCollectionType: "OverWriteData"/"AppendData
False) # Keep Objects (when processing files) (bool))
# store the results from SyllableNuclei.txt as pandas DataFrame
results = pd.read_csv(r'example_path/SyllableNuclei.txt')