#NEWLINE# def test_resample_stereo( ) : #NEWLINE# #INDENT# def __test( y , sr_in , sr_out , res_type , fix ) : #NEWLINE# #INDENT# y2 = librosa . resample ( y , sr_in , sr_out , res_type = res_type , fix = fix ) #NEWLINE# librosa . util . valid_audio ( y2 , mono = False ) #NEWLINE# eq_ ( y2 . ndim , y . ndim ) #NEWLINE# if ( sr_out == sr_in ) : #NEWLINE# #INDENT# assert np . allclose ( y , y2 ) #NEWLINE# #UNINDENT# assert y2 . flags [ 'C_CONTIGUOUS' ] #NEWLINE# target_length = ( ( y . shape [ ( - 1 ) ] * sr_out ) // sr_in ) #NEWLINE# assert ( np . abs ( ( y2 . shape [ ( - 1 ) ] - target_length ) ) <= 1 ) #NEWLINE# #UNINDENT# ( y , sr_in ) = librosa . load ( 'data/test1_44100.wav' , mono = False , sr = None , duration = 5 ) #NEWLINE# for sr_out in [ 8000 , 22050 ] : #NEWLINE# #INDENT# for res_type in [ 'sinc_fastest' , 'scipy' ] : #NEWLINE# #INDENT# for fix in [ False , True ] : #NEWLINE# #INDENT# ( yield ( __test , y , sr_in , sr_out , res_type , fix ) )