[FEATURE] Audio normalization#268
Conversation
|
As we discussed, this might benefit from adding a "full-scale" normalization mode |
🐳 What's new?The fetched audio data can now be normalized according to 4 presets given by the
The automatic dc rejection in the 🐳 How to use it?The
from osekit.utils.audio_utils import Normalization
n = Normalization.DC_REJECT | Normalization.PEAK # OK
n = Normalization.DC_REJECT | Normalization.ZSCORE # OK
n = Normalization.ZSCORE| Normalization.PEAK # raises a ValueError
n =Normalization.DC_REJECT | Normalization.ZSCORE| Normalization.PEAK # raises a ValueError🐬 Core APISimply set the from osekit.core_api.audio_dataset import AudioDataset
from osekit.utils.audio_utils import Normalization
ads = AudioDataset(
...,
normalization=Normalization.ZSCORE
)
ads.write(...) # The written audio files will be normalized z-scores.🐬 Public APISimply set the from osekit.public_api.dataset import Dataset
from osekit.public_api.analysis import Analysis
from osekit.utils.audio_utils import Normalization
dataset = Dataset(...)
analysis = Analysis(
...,
normalization=Normalization.ZSCORE,
)
dataset.run_analysis(analysis=analysis) # The audio data is turned to z-score during the analysis |



🐳 What's new?
The fetched audio data can now be normalized according to 3 presets:
The automatic dc rejection in the
AudioData.get_value()method was removed, as it now is controlable through the normalization property.🐳 How to use it?
The
normalizationproperty onAudioData,AudioDatasetandAnalysiscan be set to either"raw","dc_reject"or"zscore".The fetched audio data will then be normalized accordingly when
AudioData.get_value()is called.🐬 Core API
Simply set the
normalizationproperty ofAudioDataorAudioDatasetobjects:🐬 Public API
Simply set the
normalizationproperty of theAnalysisobject: