Search code examples
python-3.xspeech-to-textazure-cognitive-servicesscikits

What are Python3 libraries which replace "from scikits.audiolab import Format, Sndfile"


Hope you'll are doing good. I am new to python. I am trying to use audio.scikits library in python3 verion. I have a working code version in 2.7(with audio.scikits) . While I am running with python3 version I am getting the Import Error: No Module Named 'Version' error. I get to know that python3 is not anymore supporting audio.scikits(If I am not wrong). Can anyone suggest me replacing library for audio.scikits where I can use all the functionalities like audio.scikits do OR any other solution which might helps me. Thanks in advance.

2.7 Version Code :

from scikits.audiolab import Format, Sndfile
from scipy.signal import firwin, lfilter

array = np.array(all)
fmt = Format('flac', 'pcm16')
nchannels = 1
cd, FileNameTmp = mkstemp('TmpSpeechFile.wav')
# making the file .flac
afile =  Sndfile(FileNameTmp, 'w', fmt, nchannels, RawRate) 
#writing in the file
afile.write_frames(array)
SendSpeech(FileNameTmp)

To check entire code please visit :Google Asterisk Reference Code(modifying based on this code)

I want to modify this code with python3 supported libraries. Here I am doing this for Asterisk-Microsoft-Speech To Text SDK.


Solution

  • Firstly the link code you paste is Asterisk-Google-Speech-Recognition, it's not the Microsoft-Speech-To-Text, if you want get a sample about Microsoft-Speech-To-Text you could refer to the official doc:Recognize speech from an audio file.

    And about your problem you said, yes it's not completely compatible, in the github issue there is a solution for it, you could refer to this comment.