getAugmenterParams
Syntax
Description
returns parameters of the augmentation algorithm associated with the augmenterParams = getAugmenterParams(aug,algorithmName)audioDataAugmenter
object.
returns the parameters of all augmentation algorithms associated with the augmenterParams = getAugmenterParams(aug)audioDataAugmenter
object.
Examples
Modify the default parameters of the shiftPitch and stretchAudio augmentation algorithms.
Read in an audio signal and listen to it.
[audioIn,fs] = audioread('FemaleSpeech-16-8-mono-3secs.wav');
soundsc(audioIn,fs)Create an audioDataAugmenter object that applies a pitch shift of 3 semitones and a time stretch with a SpeedupFactor of 1.5.
aug = audioDataAugmenter('AugmentationParameterSource','specify', ... 'ApplyPitchShift',true, ... 'SemitoneShift',3, ... 'ApplyTimeStretch',true, ... 'SpeedupFactor',1.5, ... 'ApplyVolumeControl',false, ... 'ApplyAddNoise',false, ... 'ApplyTimeShift',false)
aug =
audioDataAugmenter with properties:
AugmentationMode: 'sequential'
AugmentationParameterSource: 'specify'
ApplyTimeStretch: 1
SpeedupFactor: 1.5000
ApplyPitchShift: 1
SemitoneShift: 3
ApplyVolumeControl: 0
ApplyAddNoise: 0
ApplyTimeShift: 0
Call setAugmenterParams to set the LockPhase and PreserveFormants parameters of the shiftPitch augmentation algorithm to false. Set the LockPhase parameter of the stretchAudio augmentation algorithm to false. Set the CepstralOrder parameter of the shiftPitch algorithm to 30.
Augment the original signal and listen to the result. The resulting file has an audible distortion that sounds unnatural. View the parameters of the augmentation algorithms.
setAugmenterParams(aug,'shiftPitch','LockPhase',false,'PreserveFormants',false,'CepstralOrder',30); setAugmenterParams(aug,'stretchAudio','LockPhase',false); data = augment(aug,audioIn,fs); pause(3) augmentationPre = data.Audio{1}; soundsc(augmentationPre,fs) data.AugmentationInfo(1)
ans = struct with fields:
SpeedupFactor: 1.5000
SemitoneShift: 3
augmenterParamsPre = getAugmenterParams(aug); augmenterParamsPre.stretchAudio
ans = struct with fields:
LockPhase: 0
augmenterParamsPre.shiftPitch
ans = struct with fields:
LockPhase: 0
PreserveFormants: 0
CepstralOrder: 30
Plot the time-domain representation of the original and the augmented signals.
t = (0:(numel(audioIn)-1))/fs; taug = (0:(numel(augmentationPre)-1))/fs; plot(t,audioIn,taug,augmentationPre) legend("Original Audio","Augmented Audio") ylabel("Amplitude") xlabel("Time (s)")

To partially compensate for the audible distortion and increase the fidelity of the augmentation algorithms, apply formant preservation to the shiftPitch algorithm, apply phase-locking to both algorithms, and change the cepstral order of the shiftPitch algorithm to 25. Listen to the processed audio.
setAugmenterParams(aug,'shiftPitch','LockPhase',true,'PreserveFormants',true,'CepstralOrder',25); setAugmenterParams(aug,'stretchAudio','LockPhase',true); data = augment(aug,audioIn,fs); augmentationPost = data.Audio{1}; soundsc(augmentationPost,fs) data.AugmentationInfo(1)
ans = struct with fields:
SpeedupFactor: 1.5000
SemitoneShift: 3
augmenterParamsPost = getAugmenterParams(aug); augmenterParamsPost.stretchAudio
ans = struct with fields:
LockPhase: 1
augmenterParamsPost.shiftPitch
ans = struct with fields:
LockPhase: 1
PreserveFormants: 1
CepstralOrder: 25
Plot the original audio as well as the augmented data before and after formant preservation, phase-locking, and cepstral order modification.
taug = (0:(numel(augmentationPost)-1))/fs; plot(t,audioIn,taug,augmentationPre) hold on plot(taug,augmentationPost,'LineStyle',':') legend("Original Audio","Pre Formant Preservation," + ... " Phase-Locking, and Cepstral Order", ... "Post Formant Preservation, Phase-Locking, and Cepstral Order") ylabel("Amplitude") xlabel("Time (s)") legend('Location','best')

Return the augmentation algorithm parameters to their default values. Call getAugmenterParams to display the current parameter values for the audioAugmenter object.
setAugmenterParams(aug,'shiftPitch') setAugmenterParams(aug,'stretchAudio') augmenterParamsDefault = getAugmenterParams(aug); augmenterParamsDefault.stretchAudio
ans = struct with fields:
LockPhase: 0
augmenterParamsDefault.shiftPitch
ans = struct with fields:
LockPhase: 0
PreserveFormants: 0
CepstralOrder: 30
Input Arguments
Audio data augmenter, specified as an audioDataAugmenter object.
Algorithm name, specified as 'stretchAudio' or
'shiftPitch.
Data Types: char | string
Output Arguments
Audio augmenter parameters, returned as a structure array.
Data Types: struct
Version History
Introduced in R2021a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.
Amériques
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)