
    Vh5                         d Z ddlmZ ddlZddZddZddZ	 	 	 	 	 	 	 ddZddZ		 	 	 	 	 	 	 ddZ
ddZ	 	 	 	 	 	 	 ddZdS )aO  
![sigsep logo](https://sigsep.github.io/hero.png)
Open-Unmix is a deep neural network reference implementation for music source separation, applicable for researchers, audio engineers and artists. Open-Unmix provides ready-to-use models that allow users to separate pop music into four stems: vocals, drums, bass and the remaining other instruments. The models were pre-trained on the MUSDB18 dataset. See details at apply pre-trained model.

This is the python package API documentation. 
Please checkout [the open-unmix website](https://sigsep.github.io/open-unmix) for more information.
    )utilsNcpuTc                 ^   ddd}ddl m} | ddg} t          j        dd	d
          }i }| D ]} |ddd|          }|rRt          j                            ||         |          }	|                    |	d           |                                 |	                    |           |||<   |S )Nz<https://zenodo.org/records/3786908/files/speech_f5e0d9f9.pthz;https://zenodo.org/records/3786908/files/noise_04a6fc2d.pth)speechnoise   	OpenUnmixr   r        @@   >  raten_fft	bandwidthi     nb_binsnb_channelshidden_sizemax_binmap_locationFstrict
modelr
   r   bandwidth_to_max_bintorchhubload_state_dict_from_urlload_state_dictevalto)
targetsdevice
pretrainedtarget_urlsr
   r   target_modelstargettarget_unmix
state_dicts
             X/var/www/html/movieo_spanner_bot/venv/lib/python3.11/site-packages/openunmix/__init__.py
umxse_specr.      s    PN K
 !     W% (gTUSSSG M 
- 
- yASV`ghhh  	 ;;K<O^d;eeJ((E(BBB ,f    Fr   r   ,  c                     ddl m} t          | ||          } ||||dddd||	  	                            |          }	|	S )aG  
    Open Unmix Speech Enhancemennt 1-channel BiLSTM Model
    trained on the 28-speaker version of Voicebank+Demand
    (Sampling rate: 16kHz)

    Args:
        targets (str): select the targets for the source to be separated.
                a list including: ['speech', 'noise'].
                If you don't pick them all, you probably want to
                activate the `residual=True` option.
                Defaults to all available targets per model.
        pretrained (bool): If True, returns a model pre-trained on MUSDB18-HQ
        residual (bool): if True, a "garbage" target is created
        niter (int): the number of post-processingiterations, defaults to 0
        device (str): selects device to be used for inference
        wiener_win_len (int or None): The size of the excerpts
            (number of frames) on which to apply filtering
            independently. This means assuming time varying stereo models and
            localization of sources.
            None means not batching but using the whole signal. It comes at the
            price of a much larger memory usage.
        filterbank (str): filterbank implementation method.
            Supported are `['torch', 'asteroid']`. `torch` is about 30% faster
            compared to `asteroid` on large FFT sizes such as 4096. However,
            asteroids stft can be exported to onnx, which makes is practical
            for deployment.

    Reference:
        Uhlich, Stefan, & Mitsufuji, Yuki. (2020).
        Open-Unmix for Speech Enhancement (UMX SE).
        Zenodo. http://doi.org/10.5281/zenodo.3786908
    r   	Separatorr%   r&   r'   r      r   	r)   niterresidualr   n_hopr   sample_ratewiener_win_len
filterbank)r   r3   r.   r$   )
r%   r8   r7   r&   r'   r<   r;   r3   r)   	separators
             r-   umxser>   +   st    B !     wv*UUUM	#%
 
 
 	bjj  r/   c                 b   ddl m} ddddd}| g d} t          j        d	d
d          }i }| D ]} |ddd|          }|rRt          j                            ||         |          }	|                    |	d           |                                 |	                    |           |||<   |S )Nr   r	   z:https://zenodo.org/records/3370489/files/bass-8d85a5bd.pthz;https://zenodo.org/records/3370489/files/drums-9619578f.pthz;https://zenodo.org/records/3370489/files/other-b52fbbf7.pthz<https://zenodo.org/records/3370489/files/vocals-b62c91ce.pthbassdrumsothervocalsrD   rB   rA   rC       @   r   r        r5   r   r   Fr   r   
r%   r&   r'   r
   r(   r   r)   r*   r+   r,   s
             r-   
umxhq_specrK   _             MNNP	 K 666 (gTUSSSGM - - yASV`ghhh  	 ;;K<O^d;eeJ((E(BBB ,fr/   c                     ddl m} t          | ||          } ||||dddd||	  	                            |          }	|	S )	a_  
    Open Unmix 2-channel/stereo BiLSTM Model trained on MUSDB18-HQ

    Args:
        targets (str): select the targets for the source to be separated.
                a list including: ['vocals', 'drums', 'bass', 'other'].
                If you don't pick them all, you probably want to
                activate the `residual=True` option.
                Defaults to all available targets per model.
        pretrained (bool): If True, returns a model pre-trained on MUSDB18-HQ
        residual (bool): if True, a "garbage" target is created
        niter (int): the number of post-processingiterations, defaults to 0
        device (str): selects device to be used for inference
        wiener_win_len (int or None): The size of the excerpts
            (number of frames) on which to apply filtering
            independently. This means assuming time varying stereo models and
            localization of sources.
            None means not batching but using the whole signal. It comes at the
            price of a much larger memory usage.
        filterbank (str): filterbank implementation method.
            Supported are `['torch', 'asteroid']`. `torch` is about 30% faster
            compared to `asteroid` on large FFT sizes such as 4096. However,
            asteroids stft can be exported to onnx, which makes is practical
            for deployment.
    r   r2   r4   rG   r   rI   rF   r6   )r   r3   rK   r$   
r%   r8   r7   r&   r'   r;   r<   r3   r)   r=   s
             r-   umxhqrO      st    F !     wv*UUUM	#%
 
 
 	bjj  r/   c                 b   ddl m} ddddd}| g d} t          j        d	d
d          }i }| D ]} |ddd|          }|rRt          j                            ||         |          }	|                    |	d           |                                 |	                    |           |||<   |S )Nr   r	   z:https://zenodo.org/records/3370486/files/bass-646024d3.pthz;https://zenodo.org/records/3370486/files/drums-5a48008b.pthz;https://zenodo.org/records/3370486/files/other-f8e132cc.pthz<https://zenodo.org/records/3370486/files/vocals-c8df74a5.pthr@   rE   rF   rG   r   r   rH   rI   r5   r   r   Fr   r   rJ   s
             r-   umx_specrQ      rL   r/   c                     ddl m} t          | ||          } ||||dddd||	  	                            |          }	|	S )	a]  
    Open Unmix 2-channel/stereo BiLSTM Model trained on MUSDB18

    Args:
        targets (str): select the targets for the source to be separated.
                a list including: ['vocals', 'drums', 'bass', 'other'].
                If you don't pick them all, you probably want to
                activate the `residual=True` option.
                Defaults to all available targets per model.
        pretrained (bool): If True, returns a model pre-trained on MUSDB18-HQ
        residual (bool): if True, a "garbage" target is created
        niter (int): the number of post-processingiterations, defaults to 0
        device (str): selects device to be used for inference
        wiener_win_len (int or None): The size of the excerpts
            (number of frames) on which to apply filtering
            independently. This means assuming time varying stereo models and
            localization of sources.
            None means not batching but using the whole signal. It comes at the
            price of a much larger memory usage.
        filterbank (str): filterbank implementation method.
            Supported are `['torch', 'asteroid']`. `torch` is about 30% faster
            compared to `asteroid` on large FFT sizes such as 4096. However,
            asteroids stft can be exported to onnx, which makes is practical
            for deployment.

    r   r2   r4   rG   r   rI   rF   r6   )r   r3   rQ   r$   rN   s
             r-   umxrS      st    H !     WV
SSSM	#%
 
 
 	bjj  r/   c                 b   ddl m} ddddd}| g d} t          j        d	d
d          }i }| D ]} |ddd|          }|rRt          j                            ||         |          }	|                    |	d           |                                 |	                    |           |||<   |S )Nr   r	   z:https://zenodo.org/records/5069601/files/bass-2ca1ce51.pthz;https://zenodo.org/records/5069601/files/drums-69e0ebd4.pthz;https://zenodo.org/records/5069601/files/other-c8c5b3e6.pthz<https://zenodo.org/records/5069601/files/vocals-bccbd9aa.pthr@   rE   rF   rG   r   r   rH   rI   r   r   r   Fr   r   rJ   s
             r-   	umxl_specrU     s          MNNP	 K 666 (gTUSSSGM - - yASWahiii  	 ;;K<O^d;eeJ((E(BBB ,fr/   c                     ddl m} t          | ||          } ||||dddd||	  	                            |          }	|	S )	a  
    Open Unmix Extra (UMX-L), 2-channel/stereo BLSTM Model trained on a private dataset
    of ~400h of multi-track audio.


    Args:
        targets (str): select the targets for the source to be separated.
                a list including: ['vocals', 'drums', 'bass', 'other'].
                If you don't pick them all, you probably want to
                activate the `residual=True` option.
                Defaults to all available targets per model.
        pretrained (bool): If True, returns a model pre-trained on MUSDB18-HQ
        residual (bool): if True, a "garbage" target is created
        niter (int): the number of post-processingiterations, defaults to 0
        device (str): selects device to be used for inference
        wiener_win_len (int or None): The size of the excerpts
            (number of frames) on which to apply filtering
            independently. This means assuming time varying stereo models and
            localization of sources.
            None means not batching but using the whole signal. It comes at the
            price of a much larger memory usage.
        filterbank (str): filterbank implementation method.
            Supported are `['torch', 'asteroid']`. `torch` is about 30% faster
            compared to `asteroid` on large FFT sizes such as 4096. However,
            asteroids stft can be exported to onnx, which makes is practical
            for deployment.

    r   r2   r4   rG   r   rI   rF   r6   )r   r3   rU   r$   rN   s
             r-   umxlrW   .  st    L !     gfTTTM	#%
 
 
 	bjj  r/   )Nr   T)NFr   r   Tr   r0   )NFr   r   Tr0   r   )__doc__	openunmixr   	torch.hubr   r.   r>   rK   rO   rQ   rS   rU   rW    r/   r-   <module>r\      s$                <1 1 1 1h   D 
3 3 3 3l   D 
3 3 3 3l   D 
5 5 5 5 5 5r/   