espnet2.enh.layers.dnsmos.DNSMOS_web
Less than 1 minute
espnet2.enh.layers.dnsmos.DNSMOS_web
class espnet2.enh.layers.dnsmos.DNSMOS_web(auth_key)
Bases: object
A class for evaluating audio quality using the DNSMOS web service.
This class sends audio data to the DNSMOS web service for quality scoring. It requires an authentication key to access the service and supports different scoring methods.
auth_key
The authentication key used for accessing the web service.
Type: str
Parameters:auth_key (str) – The authentication key for the DNSMOS web service.
__call__(aud, input_fs, fname='', method='p808')
Sends the audio data to the DNSMOS web service and retrieves the score.
Examples
>>> dnsmos = DNSMOS_web(auth_key="your_auth_key")
>>> audio_data = np.random.rand(16000 * 5) # 5 seconds of random audio
>>> score = dnsmos(audio_data, input_fs=16000)
>>> print(score)
NOTE
The audio data must be a 1D numpy array or a similar structure, and the sampling frequency must match the expected value (16000 Hz) or be resampled.
- Raises:requests.exceptions.RequestException – If there is an error during the HTTP request to the web service.