From 327081d668f99002a37ccb20773e02af55b5127c Mon Sep 17 00:00:00 2001 From: CoprDistGit Date: Fri, 5 May 2023 05:36:14 +0000 Subject: automatic import of python-algorithmlib --- .gitignore | 1 + python-algorithmlib.spec | 438 +++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 440 insertions(+) create mode 100644 python-algorithmlib.spec create mode 100644 sources diff --git a/.gitignore b/.gitignore index e69de29..e37ff87 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/AlgorithmLib-3.9.30.tar.gz diff --git a/python-algorithmlib.spec b/python-algorithmlib.spec new file mode 100644 index 0000000..af37e90 --- /dev/null +++ b/python-algorithmlib.spec @@ -0,0 +1,438 @@ +%global _empty_manifest_terminate_build 0 +Name: python-AlgorithmLib +Version: 3.9.30 +Release: 1 +Summary: audio algorithms to compute and test audio quality of speech enhencement +License: MIT +URL: https://github.com/pypa/sampleproject +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/0b/d9/50292d75e5f23586799067af941b6a7fb5061f46eb9284d2f4970f5ac795/AlgorithmLib-3.9.30.tar.gz +BuildArch: noarch + + +%description + Audio test libs to compute audio quality and 3A performance by objective metrics + pcm,wav inputfiles is allowed,support different samplerate (invalid params are simply corrected to valid ones) + + + + # How to install ? + #Install with pip: + + simply use pip to install this toolkit + + + + "pip install algorithmLib" + + # Build and Install with git: + + first step: + + git clone https://g.hz.netease.com/majianli/audiotestalgorithm + + second step: + + simply run move2sys.prefix.bat before you building the project + + + + # How to use? + + #just see ./demos/ + def compute_audio_quality(metrics,testFile=None,refFile=None,cleFile=None,samplerate=16000,bitwidth=2,channel=1,refOffset=0,testOffset=0,,maxComNLevel =-48.0,speechPauseLevel=-35.0,audioType=0, + aecStartPoint=0,aecTargetType=0,aecScenario=0,rmsCalsection=None): + + """ + :param metrics: G160/P563/POLQA/PESQ/STOI/STI/PEAQ/SDR/SII/LOUDNESS, + # G160 no samplerate limiting, WAV/PCM input , three inputfiles :clean,ref,test no duration limiting; + # P563 8000hz( only 8k spectrum is being calculated), WAV/PCM input , single inputfile, duration < 20s; + # POLQA nb mode 8k swb mode 48k :WAV/PCM input , 2 inputfiles: ref,test: duration < 20s; + # PESQ nb mode 8k wb mode 16k ,WAV/PCM input ,2 inputfiles: ref,test: duration < 20s; + # STOI no samplerate limiting; 2 inputfiles: ref,test, no duration limiting; + # STI >8k(only 8k spectrum is being calculated), WAV/PCM input , 2 inputfiles: ref,test ,duration > 20s; + # PEAQ no samplerate limiting, WAV/PCM ,2 inputfiles: ref, test , no duration limiting; + # SDR no samplerate limiting; WAV/PCM input ,2 inputfiles:ref,test: no duration limiting; + # MATCH no samplerate limiting; WAV/PCM input;3 inputfiles:ref,test,out; no duration limiting; + # MUSIC no samplerate limiting;WAV/PCM input;2 inputfiles:ref,test;no duration limiting; + # TRANSIENT no samplerate limiting; WAV/PCM input;3 inputfiles: cle,noise,test; no duration limiting; + # GAINTABLE , no samplerate limiting; WAV/PCM input;2 inputfiles: ref, test ; specific files; + # ATTACKRELEASE no samplerate limiting; WAV/PCM input;2 inputfiles: ref, test ; specific files; + # MUSICSTA no samplerate limiting; WAV/PCM input;2 inputfiles: ref, test ; no duration limiting; + # AGCDELAY no samplerate limiting; WAV/PCM input 2 inputfiles锛歳ef ,test; no duration limiting; + # MATCHAEC no samplerate limiting; WAV/PCM input;3 inputfiles:ref,mic,test; no duration limiting; + # ELRE no samplerate limiting; WAV/PCM input;3 inputfiles:mic,ref,test; no duration limiting; + # SLIENCE no samplerate limiting; WAV/PCM/MP4 input;1 input file锛歵est; no duration limiting; + # FORMAT no samplerate limiting; WAV/MP4 input;1 input file锛歵est; no duration limiting; + # AECMOS no samplerate limiting; WAV/PCM input ;3 inputfiles:mic,ref,test ; no duration limiting; + # AIMOS no samplerate limiting; WAV/PCM input ;1 input file: test; no duration limiting; + # TRMS no samplerate limiting; WAV/PCM input ;1 input file:test; no duration limiting; + # ARMS no samplerate limiting; WAV/PCM input ;1 input file:test; no duration limiting; + # NOISE no samplerate limiting; WAV/PCM input ;1 input file:ref銆乼est; no duration limiting; + there are different params for different metrics,if params you speend is valid,they will be corrected to valid ones while calculating + :param testFile: the files under test , + :param refFile: the reference file ,FR metrics need POLQA/PESQ/PEAQ + :param cleFile: clean file ,G160 need + :param noiseFile noise file,option, TRANSIENT NOISE + :param outFile out file,option, MATCH SIG + :param samplerate: samplerate,option ,pcmfile default = 16000 + :param bitwidth: bitwidth, option,pcmfile default = 2 + :param channel: channels, option,pcmfile default = 1 + :param refOffset: offset for ref file,option + :param testOffset: offset for test file ,option + :param maxComNLevel: G160 + :param speechPauseLevel G160 + :param audioType 0:speech 1:music MATCH/GAINTABLE + :param aecStartPoint AECMOS + :param aecTargetType 0:Chiness 1:English 2:Single Digit 3:Music MATCHAEC/ELRE + :param aecScenario aec mos 0:'doubletalk_with_movement', 1:'doubletalk', 2:'farend_singletalk_with_movement', 3:'farend_singletalk', 4:'nearend_singletalk' + :param rmsCalsection TRMS/ARMS + :return + """ + + # PESQ example + src = "a.pcm" + test = "b.pcm" + + score = compute_audio_quality('PESQ',testFile=test,refFile=src,samplerate=16000) + + + or + + src = "a.wav" + test = "b.wav" + + score = compute_audio_quality('PESQ',testFile=test,refFile=src) + + + # G160 example + + src = "a.wav" + test = "b.wav" + cle = "c.wav" + tnlr,nplr,snri,dsn = compute_audio_quality("G160",testFile=test,refFile=src,cleFile=cle) + + or + + src = "a.pcm" + test = "b.pcm" + cle = "c.pcm" + + tnlr,nplr,snri,dsn = compute_audio_quality("G160",testFile=test,refFile=src,cleFile=cle,samplerate=48000) + + + #p563 example + + test = "a.wav" + + Mos,SpeechLevel,Snr,NoiseLevel = compute_audio_quality('P563',testFile=test) + + or + + test = "a.pcm" + + Mos,SpeechLevel,Snr,NoiseLevel = compute_audio_quality('P563',testFile=test,samplerate=32000) + + + +%package -n python3-AlgorithmLib +Summary: audio algorithms to compute and test audio quality of speech enhencement +Provides: python-AlgorithmLib +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-AlgorithmLib + Audio test libs to compute audio quality and 3A performance by objective metrics + pcm,wav inputfiles is allowed,support different samplerate (invalid params are simply corrected to valid ones) + + + + # How to install ? + #Install with pip: + + simply use pip to install this toolkit + + + + "pip install algorithmLib" + + # Build and Install with git: + + first step: + + git clone https://g.hz.netease.com/majianli/audiotestalgorithm + + second step: + + simply run move2sys.prefix.bat before you building the project + + + + # How to use? + + #just see ./demos/ + def compute_audio_quality(metrics,testFile=None,refFile=None,cleFile=None,samplerate=16000,bitwidth=2,channel=1,refOffset=0,testOffset=0,,maxComNLevel =-48.0,speechPauseLevel=-35.0,audioType=0, + aecStartPoint=0,aecTargetType=0,aecScenario=0,rmsCalsection=None): + + """ + :param metrics: G160/P563/POLQA/PESQ/STOI/STI/PEAQ/SDR/SII/LOUDNESS, + # G160 no samplerate limiting, WAV/PCM input , three inputfiles :clean,ref,test no duration limiting; + # P563 8000hz( only 8k spectrum is being calculated), WAV/PCM input , single inputfile, duration < 20s; + # POLQA nb mode 8k swb mode 48k :WAV/PCM input , 2 inputfiles: ref,test: duration < 20s; + # PESQ nb mode 8k wb mode 16k ,WAV/PCM input ,2 inputfiles: ref,test: duration < 20s; + # STOI no samplerate limiting; 2 inputfiles: ref,test, no duration limiting; + # STI >8k(only 8k spectrum is being calculated), WAV/PCM input , 2 inputfiles: ref,test ,duration > 20s; + # PEAQ no samplerate limiting, WAV/PCM ,2 inputfiles: ref, test , no duration limiting; + # SDR no samplerate limiting; WAV/PCM input ,2 inputfiles:ref,test: no duration limiting; + # MATCH no samplerate limiting; WAV/PCM input;3 inputfiles:ref,test,out; no duration limiting; + # MUSIC no samplerate limiting;WAV/PCM input;2 inputfiles:ref,test;no duration limiting; + # TRANSIENT no samplerate limiting; WAV/PCM input;3 inputfiles: cle,noise,test; no duration limiting; + # GAINTABLE , no samplerate limiting; WAV/PCM input;2 inputfiles: ref, test ; specific files; + # ATTACKRELEASE no samplerate limiting; WAV/PCM input;2 inputfiles: ref, test ; specific files; + # MUSICSTA no samplerate limiting; WAV/PCM input;2 inputfiles: ref, test ; no duration limiting; + # AGCDELAY no samplerate limiting; WAV/PCM input 2 inputfiles锛歳ef ,test; no duration limiting; + # MATCHAEC no samplerate limiting; WAV/PCM input;3 inputfiles:ref,mic,test; no duration limiting; + # ELRE no samplerate limiting; WAV/PCM input;3 inputfiles:mic,ref,test; no duration limiting; + # SLIENCE no samplerate limiting; WAV/PCM/MP4 input;1 input file锛歵est; no duration limiting; + # FORMAT no samplerate limiting; WAV/MP4 input;1 input file锛歵est; no duration limiting; + # AECMOS no samplerate limiting; WAV/PCM input ;3 inputfiles:mic,ref,test ; no duration limiting; + # AIMOS no samplerate limiting; WAV/PCM input ;1 input file: test; no duration limiting; + # TRMS no samplerate limiting; WAV/PCM input ;1 input file:test; no duration limiting; + # ARMS no samplerate limiting; WAV/PCM input ;1 input file:test; no duration limiting; + # NOISE no samplerate limiting; WAV/PCM input ;1 input file:ref銆乼est; no duration limiting; + there are different params for different metrics,if params you speend is valid,they will be corrected to valid ones while calculating + :param testFile: the files under test , + :param refFile: the reference file ,FR metrics need POLQA/PESQ/PEAQ + :param cleFile: clean file ,G160 need + :param noiseFile noise file,option, TRANSIENT NOISE + :param outFile out file,option, MATCH SIG + :param samplerate: samplerate,option ,pcmfile default = 16000 + :param bitwidth: bitwidth, option,pcmfile default = 2 + :param channel: channels, option,pcmfile default = 1 + :param refOffset: offset for ref file,option + :param testOffset: offset for test file ,option + :param maxComNLevel: G160 + :param speechPauseLevel G160 + :param audioType 0:speech 1:music MATCH/GAINTABLE + :param aecStartPoint AECMOS + :param aecTargetType 0:Chiness 1:English 2:Single Digit 3:Music MATCHAEC/ELRE + :param aecScenario aec mos 0:'doubletalk_with_movement', 1:'doubletalk', 2:'farend_singletalk_with_movement', 3:'farend_singletalk', 4:'nearend_singletalk' + :param rmsCalsection TRMS/ARMS + :return + """ + + # PESQ example + src = "a.pcm" + test = "b.pcm" + + score = compute_audio_quality('PESQ',testFile=test,refFile=src,samplerate=16000) + + + or + + src = "a.wav" + test = "b.wav" + + score = compute_audio_quality('PESQ',testFile=test,refFile=src) + + + # G160 example + + src = "a.wav" + test = "b.wav" + cle = "c.wav" + tnlr,nplr,snri,dsn = compute_audio_quality("G160",testFile=test,refFile=src,cleFile=cle) + + or + + src = "a.pcm" + test = "b.pcm" + cle = "c.pcm" + + tnlr,nplr,snri,dsn = compute_audio_quality("G160",testFile=test,refFile=src,cleFile=cle,samplerate=48000) + + + #p563 example + + test = "a.wav" + + Mos,SpeechLevel,Snr,NoiseLevel = compute_audio_quality('P563',testFile=test) + + or + + test = "a.pcm" + + Mos,SpeechLevel,Snr,NoiseLevel = compute_audio_quality('P563',testFile=test,samplerate=32000) + + + +%package help +Summary: Development documents and examples for AlgorithmLib +Provides: python3-AlgorithmLib-doc +%description help + Audio test libs to compute audio quality and 3A performance by objective metrics + pcm,wav inputfiles is allowed,support different samplerate (invalid params are simply corrected to valid ones) + + + + # How to install ? + #Install with pip: + + simply use pip to install this toolkit + + + + "pip install algorithmLib" + + # Build and Install with git: + + first step: + + git clone https://g.hz.netease.com/majianli/audiotestalgorithm + + second step: + + simply run move2sys.prefix.bat before you building the project + + + + # How to use? + + #just see ./demos/ + def compute_audio_quality(metrics,testFile=None,refFile=None,cleFile=None,samplerate=16000,bitwidth=2,channel=1,refOffset=0,testOffset=0,,maxComNLevel =-48.0,speechPauseLevel=-35.0,audioType=0, + aecStartPoint=0,aecTargetType=0,aecScenario=0,rmsCalsection=None): + + """ + :param metrics: G160/P563/POLQA/PESQ/STOI/STI/PEAQ/SDR/SII/LOUDNESS, + # G160 no samplerate limiting, WAV/PCM input , three inputfiles :clean,ref,test no duration limiting; + # P563 8000hz( only 8k spectrum is being calculated), WAV/PCM input , single inputfile, duration < 20s; + # POLQA nb mode 8k swb mode 48k :WAV/PCM input , 2 inputfiles: ref,test: duration < 20s; + # PESQ nb mode 8k wb mode 16k ,WAV/PCM input ,2 inputfiles: ref,test: duration < 20s; + # STOI no samplerate limiting; 2 inputfiles: ref,test, no duration limiting; + # STI >8k(only 8k spectrum is being calculated), WAV/PCM input , 2 inputfiles: ref,test ,duration > 20s; + # PEAQ no samplerate limiting, WAV/PCM ,2 inputfiles: ref, test , no duration limiting; + # SDR no samplerate limiting; WAV/PCM input ,2 inputfiles:ref,test: no duration limiting; + # MATCH no samplerate limiting; WAV/PCM input;3 inputfiles:ref,test,out; no duration limiting; + # MUSIC no samplerate limiting;WAV/PCM input;2 inputfiles:ref,test;no duration limiting; + # TRANSIENT no samplerate limiting; WAV/PCM input;3 inputfiles: cle,noise,test; no duration limiting; + # GAINTABLE , no samplerate limiting; WAV/PCM input;2 inputfiles: ref, test ; specific files; + # ATTACKRELEASE no samplerate limiting; WAV/PCM input;2 inputfiles: ref, test ; specific files; + # MUSICSTA no samplerate limiting; WAV/PCM input;2 inputfiles: ref, test ; no duration limiting; + # AGCDELAY no samplerate limiting; WAV/PCM input 2 inputfiles锛歳ef ,test; no duration limiting; + # MATCHAEC no samplerate limiting; WAV/PCM input;3 inputfiles:ref,mic,test; no duration limiting; + # ELRE no samplerate limiting; WAV/PCM input;3 inputfiles:mic,ref,test; no duration limiting; + # SLIENCE no samplerate limiting; WAV/PCM/MP4 input;1 input file锛歵est; no duration limiting; + # FORMAT no samplerate limiting; WAV/MP4 input;1 input file锛歵est; no duration limiting; + # AECMOS no samplerate limiting; WAV/PCM input ;3 inputfiles:mic,ref,test ; no duration limiting; + # AIMOS no samplerate limiting; WAV/PCM input ;1 input file: test; no duration limiting; + # TRMS no samplerate limiting; WAV/PCM input ;1 input file:test; no duration limiting; + # ARMS no samplerate limiting; WAV/PCM input ;1 input file:test; no duration limiting; + # NOISE no samplerate limiting; WAV/PCM input ;1 input file:ref銆乼est; no duration limiting; + there are different params for different metrics,if params you speend is valid,they will be corrected to valid ones while calculating + :param testFile: the files under test , + :param refFile: the reference file ,FR metrics need POLQA/PESQ/PEAQ + :param cleFile: clean file ,G160 need + :param noiseFile noise file,option, TRANSIENT NOISE + :param outFile out file,option, MATCH SIG + :param samplerate: samplerate,option ,pcmfile default = 16000 + :param bitwidth: bitwidth, option,pcmfile default = 2 + :param channel: channels, option,pcmfile default = 1 + :param refOffset: offset for ref file,option + :param testOffset: offset for test file ,option + :param maxComNLevel: G160 + :param speechPauseLevel G160 + :param audioType 0:speech 1:music MATCH/GAINTABLE + :param aecStartPoint AECMOS + :param aecTargetType 0:Chiness 1:English 2:Single Digit 3:Music MATCHAEC/ELRE + :param aecScenario aec mos 0:'doubletalk_with_movement', 1:'doubletalk', 2:'farend_singletalk_with_movement', 3:'farend_singletalk', 4:'nearend_singletalk' + :param rmsCalsection TRMS/ARMS + :return + """ + + # PESQ example + src = "a.pcm" + test = "b.pcm" + + score = compute_audio_quality('PESQ',testFile=test,refFile=src,samplerate=16000) + + + or + + src = "a.wav" + test = "b.wav" + + score = compute_audio_quality('PESQ',testFile=test,refFile=src) + + + # G160 example + + src = "a.wav" + test = "b.wav" + cle = "c.wav" + tnlr,nplr,snri,dsn = compute_audio_quality("G160",testFile=test,refFile=src,cleFile=cle) + + or + + src = "a.pcm" + test = "b.pcm" + cle = "c.pcm" + + tnlr,nplr,snri,dsn = compute_audio_quality("G160",testFile=test,refFile=src,cleFile=cle,samplerate=48000) + + + #p563 example + + test = "a.wav" + + Mos,SpeechLevel,Snr,NoiseLevel = compute_audio_quality('P563',testFile=test) + + or + + test = "a.pcm" + + Mos,SpeechLevel,Snr,NoiseLevel = compute_audio_quality('P563',testFile=test,samplerate=32000) + + + +%prep +%autosetup -n AlgorithmLib-3.9.30 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-AlgorithmLib -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Fri May 05 2023 Python_Bot - 3.9.30-1 +- Package Spec generated diff --git a/sources b/sources new file mode 100644 index 0000000..2ca450d --- /dev/null +++ b/sources @@ -0,0 +1 @@ +722a31d8637c864953e59db2a0da223b AlgorithmLib-3.9.30.tar.gz -- cgit v1.2.3