0

I have been trying to program a voice recorder but it gives me an error that I have never seen.

This is pythmy code:

import sounddevice as sd 
from scipy.io.wavfile import write 

def record(name , duration):
    freq = 48000
    duration = 10
    recording = sd.rec(int(duration * freq), samplerate=freq ,channels=2) 
    sd.wait() 
    write(".\\audio\\wav\\MyRecording.wav", freq, recording) 
    print(recording)
record("hi" , 5)

Tbtw the reason that I print recording is to see how it exactly record voice

and This is the error :

    Traceback (most recent call last):
  File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\numpy\core\__init__.py", line 22, in <module>
    from . import multiarray
  File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\numpy\core\multiarray.py", line 12, in <module>
    from . import overrides
  File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\numpy\core\overrides.py", line 7, in <module>
    from numpy.core._multiarray_umath import (
ImportError: DLL load failed while importing _multiarray_umath: The specified module could not be found.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\school\helli3\9th\پژوهشی کامپیوتر\project\Voisy\Voisy\src\recorder.py", line 2, in <module>
    from scipy.io.wavfile import write
  File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\scipy\__init__.py", line 67, in <module>
    from numpy import show_config as show_numpy_config
  File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\numpy\__init__.py", line 145, in <module>
    from . import core
  File "C:\Users\ASUS\AppData\Local\Programs\Python\Python38-32\lib\site-packages\numpy\core\__init__.py", line 48, in <module>
    raise ImportError(msg)
ImportError:

IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!

Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.

We have compiled some common reasons and troubleshooting tips at:

    https://numpy.org/devdocs/user/troubleshooting-importerror.html

Please note and check the following:

  * The Python version is: Python3.8 from "C:\Users\ASUS\AppData\Local\Programs\Python\Python38-32\python.exe"
  * The NumPy version is: "1.20.3"

and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.

Original error was: DLL load failed while importing _multiarray_umath: The specified module could not be found.

how can I fix this error? (I have installed scipy and sounddevice liabrary)

mohaka
  • 23
  • 6
  • This looks like an issue with numpy and perhaps your development environment. Are you using a virtual environment & how are you executing the script? – PeptideWitch Oct 27 '21 at 04:51
  • I am running it with both cmd and python's idle and I use vscode for developing – mohaka Oct 27 '21 at 05:06

0 Answers0