examples/hpss.py
def hpss_demo(input_file, output_harmonic, output_percussive):
    '''HPSS demo function.

    :parameters:
      - input_file : str
          path to input audio
      - output_harmonic : str
          path to save output harmonic (wav)
      - output_percussive : str
          path to save output harmonic (wav)
    '''

    # 1. Load the wav file, resample
    print('Loading ', input_file)

    y, sr = librosa.load(input_file)

    # Separate components with the effects module
    print('Separating harmonics and percussives... ')
    y_harmonic, y_percussive = librosa.effects.hpss(y)

    # 5. Save the results
    print('Saving harmonic audio to: ', output_harmonic)
    librosa.output.write_wav(output_harmonic, y_harmonic, sr)

    print('Saving percussive audio to: ', output_percussive)
    librosa.output.write_wav(output_percussive, y_percussive, sr)
def hpss_demo(input_file, output_harmonic, output_percussive):
    '''HPSS demo function.

    :parameters:
      - input_file : str
          path to input audio
      - output_harmonic : str
          path to save output harmonic (wav)
      - output_percussive : str
          path to save output harmonic (wav)
    '''

    # 1. Load the wav file, resample
    print('Loading ', input_file)

    y, sr = librosa.load(input_file)

    # Separate components with the effects module
    print('Separating harmonics and percussives... ')
    y_harmonic, y_percussive = librosa.effects.hpss(y)

    # 5. Save the results
    print('Saving harmonic audio to: ', output_harmonic)
    librosa.output.write_wav(output_harmonic, y_harmonic, sr)

    print('Saving percussive audio to: ', output_percussive)
    librosa.output.write_wav(output_percussive, y_percussive, sr)
def hpss_demo ( input_file , output_harmonic , output_percussive ) : # 1. Load the wav file, resample print ( 'Loading ' , input_file ) y , sr = librosa . load ( input_file ) # Separate components with the effects module print ( 'Separating harmonics and percussives... ' ) y_harmonic , y_percussive = librosa . effects . hpss ( y ) # 5. Save the results print ( 'Saving harmonic audio to: ' , output_harmonic ) librosa . output . write_wav ( output_harmonic , y_harmonic , sr ) print ( 'Saving percussive audio to: ' , output_percussive ) librosa . output . write_wav ( output_percussive , y_percussive , sr )
HPSS demo function.

    :parameters:
      - input_file : str
          path to input audio
      - output_harmonic : str
          path to save output harmonic (wav)
      - output_percussive : str
          path to save output harmonic (wav)
HPSS demo function .