@@ -940,8 +940,22 @@ def decode(self, source) -> torch.Tensor:
940940 )
941941 return frames
942942
943- def test_round_trip (self , tmp_path ):
944- asset = SINE_MONO_S32
943+ # def test_round_trip(self, tmp_path):
944+ # asset = NASA_AUDIO_MP3
945+
946+ # encoded_path = tmp_path / "output.mp3"
947+ # encoder = create_encoder(
948+ # sample_rate=asset.sample_rate, filename=str(encoded_path)
949+ # )
950+
951+ # source_samples = self.decode(asset)
952+ # encode(encoder, source_samples)
953+
954+ # torch.testing.assert_close(self.decode(encoded_path), source_samples)
955+
956+ def test_against_cli (self , tmp_path ):
957+
958+ asset = NASA_AUDIO_MP3
945959
946960 encoded_by_ffmpeg = tmp_path / "ffmpeg_output.mp3"
947961 encoded_by_us = tmp_path / "our_output.mp3"
@@ -951,9 +965,10 @@ def test_round_trip(self, tmp_path):
951965 "-i" ,
952966 str (asset .path ),
953967 # '-vn',
954- # '-ar', '44100 ', # Set audio sampling rate
968+ # '-ar', '16000 ', # Set audio sampling rate
955969 # '-ac', '2', # Set number of audio channels
956970 # '-b:a', '192k', # Set audio bitrate
971+ '-b:a' , '0' , # Set audio bitrate
957972 str (encoded_by_ffmpeg ),
958973 ]
959974 subprocess .run (command , check = True )
@@ -964,8 +979,6 @@ def test_round_trip(self, tmp_path):
964979
965980 encode (encoder , self .decode (asset ))
966981
967- print (encoded_by_ffmpeg )
968- print (encoded_by_us )
969982 from_ffmpeg = self .decode (encoded_by_ffmpeg )
970983 from_us = self .decode (encoded_by_us )
971984 torch .testing .assert_close (from_us , from_ffmpeg )
0 commit comments