audioDatastore Object Pointing to Audio Files
To create an audioDatastore object, first specify the file path to the audio samples included with Audio Toolbox™.
folder = fullfile(matlabroot,'toolbox','audio','samples');
Create an audioDatastore object that points to the specified folder of audio files.
ADS = audioDatastore(folder)
ADS =
audioDatastore with properties:
Files: {
' .../matlab/toolbox/audio/samples/Ambiance-16-44p1-mono-12secs.wav';
' .../matlab/toolbox/audio/samples/AudioArray-16-16-4channels-20secs.wav';
' .../toolbox/audio/samples/ChurchImpulseResponse-16-44p1-mono-5secs.wav'
... and 36 more
}
Folders: {
' .../Bdoc25b.2988451/build/runnable/matlab/toolbox/audio/samples'
}
AlternateFileSystemRoots: {}
OutputDataType: 'double'
OutputEnvironment: 'cpu'
Labels: {}
SupportedOutputFormats: ["wav" "flac" "ogg" "opus" "mp3" "mp4" "m4a"]
DefaultOutputFormat: "wav"
Generate a subset of the audio datastore that only includes audio files containing 'Guitar' in the file name.
fileContainsGuitar = cellfun(@(c)contains(c,'Guitar'),ADS.Files);
ADSsubset = subset(ADS,fileContainsGuitar)ADSsubset =
audioDatastore with properties:
Files: {
' .../matlab/toolbox/audio/samples/RockGuitar-16-44p1-stereo-72secs.wav';
' .../matlab/toolbox/audio/samples/RockGuitar-16-96-stereo-72secs.flac';
' .../runnable/matlab/toolbox/audio/samples/SoftGuitar-44p1_mono-10mins.ogg'
}
Folders: {
' .../Bdoc25b.2988451/build/runnable/matlab/toolbox/audio/samples'
}
AlternateFileSystemRoots: {}
OutputDataType: 'double'
OutputEnvironment: 'cpu'
Labels: {}
SupportedOutputFormats: ["wav" "flac" "ogg" "opus" "mp3" "mp4" "m4a"]
DefaultOutputFormat: "wav"
Use the subset audio datastore as the source for a labeledSignalSet object.
audioLabSigSet = labeledSignalSet(ADSsubset)
audioLabSigSet =
labeledSignalSet with properties:
Source: {3×1 cell}
NumMembers: 3
TimeInformation: "inherent"
Labels: [3×0 table]
Description: ""
Use labelDefinitionsHierarchy to see a list of labels and sublabels.
Use setLabelValue to add data to the set.
Open Signal Labeler and use Import From Workspace to import the labeledSignalSet.