import loris # import the raw clarinet partials clar = loris.importSdif( 'clarinet.sdif' ) # channelize and distill, assume 415 Hz fundamental loris.channelize( clar, 415 ) loris.distill( clar ) # shift pitch of clarinet partials by 600 cents loris.shiftPitch( clar, -600 ) # import the raw flute partials flut = loris.importSdif( 'flute.sdif' ) # channelize and distill, track and estimate fundamental refenv = loris.createF0Estimate( flut, 291*.8, 291*1.2, 0.01 ) loris.channelize( flut, refenv, 1 ) loris.distill( flut ) # perform temporal dilation, align onsets flute_times = [0.4, 1.] clar_times = [0.2, 1.] tgt_times = [0.3, 1.2] print 'dilating sounds to to align onsets' loris.dilate( flut, flute_times, tgt_times ) loris.dilate( clar, clar_times, tgt_times ) # perform morph print 'morphing clarinet with flute' morphenv = loris.LinearEnvelope() morphenv.insertBreakpoint( 0.6, 0 ) morphenv.insertBreakpoint( 2, 1 ) mrph = loris.morph( clar, flut, morphenv, morphenv, morphenv ) # synthesize and export samples fout = loris.AiffFile( mrph, 44100 ) fout.write( 'morph.aiff' ) print 'Done, bye.'