@@ -49,35 +49,58 @@ streamlit run test/streamlit.py
4949
5050### Python Examples
5151
52- - * test/test.py* :
52+ Run the following test script after cloning this repo.
53+
54+ ``` shell script
55+ git clone https://github.com/haoheliu/voicefixer.git
56+ cd voicefixer
57+ python3 test/test.py # test script
58+ ```
59+ We expect it will give you the following output:
60+ ``` shell script
61+ Initializing VoiceFixer...
62+ Test voicefixer mode 0, Pass
63+ Test voicefixer mode 1, Pass
64+ Test voicefixer mode 2, Pass
65+ Initializing 44.1kHz speech vocoder...
66+ Test vocoder using groundtruth mel spectrogram...
67+ Pass
68+ ```
69+ * test/test.py* mainly contains the test of the following two APIs:
70+ - voicefixer.restore
71+ - vocoder.oracle
5372
5473``` python
5574...
5675
5776# TEST VOICEFIXER
5877# # Initialize a voicefixer
78+ print (" Initializing VoiceFixer..." )
5979voicefixer = VoiceFixer()
60- # # Mode 0: Original Model (suggested by default)
61- # # Mode 1: Add preprocessing module (remove higher frequency)
62- # # Mode 2: Train mode (might work sometimes on seriously degraded real speech)
80+ # Mode 0: Original Model (suggested by default)
81+ # Mode 1: Add preprocessing module (remove higher frequency)
82+ # Mode 2: Train mode (might work sometimes on seriously degraded real speech)
6383for mode in [0 ,1 ,2 ]:
84+ print (" Testing mode" ,mode)
6485 voicefixer.restore(input = os.path.join(git_root," test/utterance/original/original.flac" ), # low quality .wav/.flac file
6586 output = os.path.join(git_root," test/utterance/output/output_mode_" + str (mode)+ " .flac" ), # save file path
6687 cuda = False , # GPU acceleration
6788 mode = mode)
89+ if (mode != 2 ):
90+ check(" output_mode_" + str (mode)+ " .flac" )
91+ print (" Pass" )
6892
6993# TEST VOCODER
70- # # Initialize a vocoder. Only 44100 sampling rate is supported.
94+ # # Initialize a vocoder
95+ print (" Initializing 44.1kHz speech vocoder..." )
7196vocoder = Vocoder(sample_rate = 44100 )
7297
7398# ## read wave (fpath) -> mel spectrogram -> vocoder -> wave -> save wave (out_path)
74- vocoder.oracle(fpath = os.path.join(git_root," test/utterance/original/original.flac" ),
99+ print (" Test vocoder using groundtruth mel spectrogram..." )
100+ vocoder.oracle(fpath = os.path.join(git_root," test/utterance/original/p360_001_mic1.flac" ),
75101 out_path = os.path.join(git_root," test/utterance/output/oracle.flac" ),
76102 cuda = False ) # GPU acceleration
77103
78- # Other interfaces
79- # voicefixer.restore_inmem
80- # vocoder.forward
81104...
82105```
83106
0 commit comments