Consider a set of whale sound recordings. The recorded whale sounds consist of trills and moans. Trills sound like series of clicks. Moans are low-frequency cries similar to the sound made by a ship's horn. You want to look at each signal and label it to identify the whale type, the trill regions, and the moan regions. For each trill region, you also want to label the signal peaks higher than a certain threshold.
Signal Label Definitions
Define an attribute label to store whale types. The possible categories are blue whale, humpback whale, and white whale.
Define a region-of-interest (ROI) label to capture moan regions. Define another ROI label to capture trill regions.
Finally, define a point label to capture the trill peaks. Set this label as a sublabel of the dTrills
definition.
Labeled Signal Set
Create a labeledSignalSet
with the whale signals and the label definitions. Add label values to identify the whale type, the moan and trill regions, and the peaks of the trills.
Visualize the label hierarchy and label properties using labelDefinitionsHierarchy
and labelDefinitionsSummary
.
ans =
'WhaleType
Sublabels: []
MoanRegions
Sublabels: []
TrillRegions
Sublabels: TrillPeaks
'
ans=3×9 table
LabelName LabelType LabelDataType Categories ValidationFunction DefaultValue Sublabels Tag Description
______________ ___________ _____________ ____________ __________________ ____________ ___________________________ ___ ____________________________
"WhaleType" "attribute" "categorical" {3x1 string} {["N/A" ]} {0x0 double} {0x0 double } "" "Whale type"
"MoanRegions" "roi" "logical" {["N/A" ]} {0x0 double} {0x0 double} {0x0 double } "" "Regions where moans occur"
"TrillRegions" "roi" "logical" {["N/A" ]} {0x0 double} {0x0 double} {1x1 signalLabelDefinition} "" "Regions where trills occur"
The signals in the loaded data correspond to songs of two blue whales. Set the 'WhaleType'
values for both signals.
Visualize the 'Labels'
property. The table has the newly added 'WhaleType'
values for both signals.
ans=2×3 table
WhaleType MoanRegions TrillRegions
_________ ___________ ____________
Whale1 blue {0x2 table} {0x3 table}
Whale2 blue {0x2 table} {0x3 table}
Visualize Region Labels
Visualize the whale songs to identify the trill and moan regions.
Moan regions are sustained low-frequency wails.
whale1
has moans centered at about 7 seconds, 12 seconds, and 17 seconds.
whale2
has moans centered at about 3 seconds, 7 seconds, and 16 seconds.
Add the moan regions to the labeled set. Specify the ROI limits in seconds and the label values.
Trill regions have distinct bursts of sound punctuated by silence.
Add the trill regions to the labeled set.
Create a signalMask
object for each whale song and use it to visualize and label the different regions. For better visualization, change the label values from logical to categorical.
Visualize Point Labels
Label three peaks for each trill region. For point labels, you specify the point locations and the label values. In this example, the point locations are in seconds.
Explore Label Values
Explore the label values using getLabelValues
.
ans=2×3 table
WhaleType MoanRegions TrillRegions
_________ ___________ ____________
Whale1 blue {3x2 table} {1x3 table}
Whale2 blue {3x2 table} {1x3 table}
Retrieve the moan regions for the first member of the labeled set.
ans=3×2 table
ROILimits Value
____________ _____
6.1 7.7 {[1]}
11.4 13.1 {[1]}
16.5 18.1 {[1]}
Use a second output argument to list the sublabels of a label.
value=1×2 table
ROILimits Value
__________ _____
1.4 3.1 {[1]}
valueWithSublabel=1×3 table
ROILimits Value Sublabels
TrillPeaks
__________ _____ ___________
1.4 3.1 {[1]} {3x2 table}
To retrieve the values in a sublabel, express the label name as a two-element array.
ans=3×2 table
Location Value
________ __________
1.553 {[0.2110]}
1.626 {[0.2540]}
1.7 {[0.2110]}
Find the value of the third trill peak corresponding to the second member of the set.
ans=1×2 table
Location Value
________ __________
11.437 {[0.1500]}