tyiannak / pyAudioAnalysis

Python Audio Analysis Library: Feature Extraction, Classification, Segmentation and Applications
Apache License 2.0
5.8k stars 1.19k forks source link

ImportError: cannot import name 'audioBasicIO' #277

Open Airade opened 4 years ago

Airade commented 4 years ago

Trying to write down code as shown in wiki i got that error. How can I fix it? from pyAudioAnalysis import audioBasicIO from pyAudioAnalysis import ShortTermFeatures import matplotlib.pyplot as plt [Fs, x] = audioBasicIO.read_audio_file("sample.wav") F, f_names = ShortTermFeatures.feature_extraction(x, Fs, 0.050Fs, 0.025Fs) plt.subplot(2,1,1); plt.plot(F[0,:]); plt.xlabel('Frame no'); plt.ylabel(f_names[0]) plt.subplot(2,1,2); plt.plot(F[1,:]); plt.xlabel('Frame no'); plt.ylabel(f_names[1]); plt.show()

tyiannak commented 4 years ago

Please send the error as well.

Airade commented 4 years ago

ImportError: cannot import name 'audioBasicIO'

This is the error I got, nothing else.

tyiannak commented 4 years ago

Does import pyAudioAnalysis work?

Airade commented 4 years ago

When I clone it separately to other venv it starts to work.

marin123 commented 4 years ago

I had a similar issue on my MacBook. After installing libmagic with brew install libmagic it worked

AtrayeeNeog commented 4 years ago

I am also getting a similar type of error: ImportError Traceback (most recent call last)

in ----> 1 from pyAudioAnalysis import audioBasicIO 2 from pyAudioAnalysis import audioFeatureExtraction 3 import matplotlib.pyplot as plt 4 import numpy as np ImportError: cannot import name 'audioBasicIO' from 'pyAudioAnalysis' (unknown location) I have tried it with venv as well but the error has not disappeared. Import pyAudioAnalysis works fine. I am using Jupyter Notebook on my Windows and Python version 3.8.3 Edit: I have also installed libmagic but it still shows this error.
minalmeg commented 4 years ago

Just make sure your files are installed properly. Your main.py file should be place alongside pyaudioanalysis folder which contains all the python modules - audioBasicIO or ShortTermFeatures, etc. Then you can successfully run - from pyAudioAnalysis import audioBasicIO from pyAudioAnalysis import ShortTermFeatures

Note -

  1. You should check is if you're installing it for the correct version of python. The recommended is 2.7 version of python.
  2. audioFeatureExtraction is inside ShortTermFeatures. You can call it like this - info=ShortTermFeatures.feature_extraction() and get ride of import audioFeatureExtraction completely.