pyAudioAnalysis
pyAudioAnalysis copied to clipboard
How do I get segment data from audio file?
Hi,
Thanks for writing this module.
I am a little bit confused with audioSegmentation.py about getting raw segment data(i.e., stuffs like
0.01,9.90,speech
9.90,10.70,silence
10.70,23.50,speech
) from the audio file.
Which function should I use to get such data(in any form of data type)?
Many thanks.
Hi Check out the audio segmentation wiki. The quick answer is that u should use mtFileClassification().
Why don't you use simple indexing?
Given sample rate Fs.
audio[(0.01_Fs): (9.90_Fs)-1]
Hi! I am also looking into this.
In the wiki it says that .segments files can be used for performance evaluation. However, I am looking to generate a .segments file from running segmentation on a .wav file. How should this be done?
Thanks
Hi,
I have same question and still wondering to find out how to generate the .segments file! Any one was able to do that?
Thanks-
Hi,
I am getting this error while trying to compile the example code from the wiki
from pyAudioAnalysis import audioSegmentation as aS
[flagsInd, classesAll, acc, CM] = aS.mtFileClassification("data/scottish.wav", "data/svmSM", "svm", True, 'data/scottish.segments')
mtFileClassificationError: input modelType not found!
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-4-bd6617b411ea> in <module>()
----> 1 [flagsInd, classesAll, acc, CM] = aS.mtFileClassification(audioLocation, "data/svmSM", "svm", True, 'data/scottish.segments')
ValueError: need more than 3 values to unpack
I have same question and still wondering to find out how to generate the .segments file! Any one was able to do that?when I use my own chinese datasets.
$python audioAnalysis.py speakerDiarization -i ../your/data/file/dic/test.wav --num 0 --flsd
and just in case you wanna generate segmented wav file, add the following after line 943 in audioSegmentation.py:
(segs, classes) = flags2segs(cls, mt_step)
for i,s in enumerate(segs):
person = int(classes[i]) + 1
person = chr(97+person)
strout = "{0:s}_{3:s}_{1:.3f}_{2:.3f}_.wav".format(filename[:-4],s[0],s[1],person)
scipy.io.wavfile.write(strout, fs , x[int(fs * s[0]) : int(fs * s[1])] )
the same problem:
from pyAudioAnalysis import audioSegmentation as aS [flagsInd, classesAll, acc, CM] = aS.mid_term_file_classification("data/scottish.wav", "/data/models/svm_rbf_sm", "svm", True, 'data/scottish.segments') mtFileClassificationError: input model_type not found!
the same problem:
from pyAudioAnalysis import audioSegmentation as aS [flagsInd, classesAll, acc, CM] = aS.mid_term_file_classification("data/scottish.wav", "/data/models/svm_rbf_sm", "svm", True, 'data/scottish.segments') mtFileClassificationError: input model_type not found!
Model path seems wrong ("/" is not correct before data)
I don't have any data folder in pyAudioAnalysis. How to get the model type (data/svmSM)? Please help me. It is showing: mtFileClassificationError: input model_type not found! aS.mid_term_file_classification(file name,"what to write here?","svm")
the same problem:
from pyAudioAnalysis import audioSegmentation as aS [flagsInd, classesAll, acc, CM] = aS.mid_term_file_classification("data/scottish.wav", "/data/models/svm_rbf_sm", "svm", True, 'data/scottish.segments') mtFileClassificationError: input model_type not found!
Model path seems wrong ("/" is not correct before data)
segments = aS.mid_term_file_classification(audio_filepath, "data/models/svm_rbf_sm", "svm", True) i tired using without slash . but getting the same error, mtFileClassificationError: input model_type not found!
i can see the models from data folder , is any other way , we can add those path?
What worked for me was to add the absolute path (in Windows):
data_path = "C:/path/to/the/package/pyAudioAnalysis/pyAudioAnalysis/" [flagsInd, classesAll, acc, CM] = aS.mid_term_file_classification(data_path + "data/scottish.wav", data_path + "data/models/svm_rbf_sm", "svm", True, data_path + 'data/scottish.segments')
My working directory was in another folder, so it couldn't find the files.