A method comprising: obtaining training data, wherein the training data comprises a plurality of sound recordings; generating a plurality of training triplets, wherein each training triplet of the plurality of training triplets includes a respective anchor audio segment, a positive audio segment, and a negative audio segment from the plurality of sound recordings, wherein generating the plurality of training triplets comprises: (i) performing a first triplet sampling operation to generate a first subset of training triplets of the plurality of training triplets; and (ii) performing a second triplet sampling operation to generate a second subset of training triplets of the plurality of training triplets, wherein the second triplet sampling operation is a different triplet sampling operation from the first triplet sampling operation; generating, in an unsupervised manner, a mapping between each audio segment of each training triplet of the plurality of training triplets and a respective feature vector in an n-dimensional feature space, wherein the mapping is a machine learning algorithm; and updating the mapping based on the determined feature vectors such that a loss function is reduced, wherein the loss function comprises a sum of a plurality of terms, wherein each term in the plurality of terms corresponds to a respective training triplet in the plurality of training triplets, and wherein a term of the loss function that corresponds to a particular training triplet is increased by increasing a first distance relative to a second distance when the first distance is not less than the second distance by at least a specified threshold amount, wherein the first distance is between the feature vector of the anchor audio segment of the particular training triplet and the feature vector of the positive audio segment of the particular training triplet, and wherein the second distance is between the feature vector of the anchor audio segment of the particular training triplet and the feature vector of the negative audio segment of the particular training triplet. obtaining training data, wherein the training data comprises a plurality of sound recordings; generating a plurality of training triplets, wherein each training triplet of the plurality of training triplets includes a respective anchor audio segment, a positive audio segment, and a negative audio segment from the plurality of sound recordings, wherein generating the plurality of training triplets comprises: (i) performing a first triplet sampling operation to generate a first subset of training triplets of the plurality of training triplets; and (ii) performing a second triplet sampling operation to generate a second subset of training triplets of the plurality of training triplets, wherein the second triplet sampling operation is a different triplet sampling operation from the first triplet sampling operation; generating, in an unsupervised manner, a mapping between each audio segment of each training triplet of the plurality of training triplets and a respective feature vector in an n-dimensional feature space, wherein the mapping is a machine learning algorithm; and updating the mapping based on the determined feature vectors such that a loss function is reduced, wherein the loss function comprises a sum of a plurality of terms, wherein each term in the plurality of terms corresponds to a respective training triplet in the plurality of training triplets, and wherein a term of the loss function that corresponds to a particular training triplet is increased by increasing a first distance relative to a second distance when the first distance is not less than the second distance by at least a specified threshold amount, wherein the first distance is between the feature vector of the anchor audio segment of the particular training triplet and the feature vector of the positive audio segment of the particular training triplet, and wherein the second distance is between the feature vector of the anchor audio segment of the particular training triplet and the feature vector of the negative audio segment of the particular training triplet.