image-right

A PhD student at KTH that I am supervising did as his master's project an annotated human database with a thousand samples. A number of composers and researchers submitted sounds an annotated them as can be seen from the huggingface database version of the dataset.

Together with my collegue Rikard Lindell in the IRESAP project we set out to create an machine learning algorithm that would be able to classify sounds according to Pierre Sceaffer's.1 The first step was to map the sounds of the dataset to Schaeffer's typology in the picture to the right. Table 1 below is a reduced version of this mapping excercise that we set up where for an N category sound, the sample must have been annotated both with Harmonic sound and Flat sustain. The preliminary results of this was quite convincing but I will return to the actual model that I created from this set in a later post.

Table 1: Mapping sounds in the SCHAEFFER dataset to the categories of Scheffer's typology.
  formed impulse formed
  held sounds   iterative sounds
database categories sustain.Flat sustain pulse-typology.Impulse sustain.Iteration
.mass-type.Harmonic sound N N’ N’’
.mass-type.Noisy sound X X’ X’’
.mass-type.Vacillating sustain Y Y’ Y’’

Here's a simple shell script to extract data from the downloaded database according to two dimensions of the table above. In this case it is Impulse and Iteration, of N' and N'' in Schaeffer's typology.

#!/bin/bash
dataset="../../dataset/SCHAEFFER/"
keyA=Impulse
keyB=Iteration
base="../classification/training_data/"
dirA="$base""$keyA"
dirB="$base""$keyB"

echo "Clearing directories...\n\n"
rm -rf $dirB/*.wav
rm -rf $dirA/*.wav

echo "Copying files from dataset...\n\n"
for d in "$dataset"*/; do
    for j in "$d"*.json; do
        if test -f "$j"
        then
            if [[ "$(cat "$j" | jq '.object.labels.sustain')" == "\""$keyB"\"" ]]; then
                if [ ! -d "$dirB" ]; then
                    mkdir "$dirB"
                fi
                cp "$d""`cat "$j" | jq -r '.object.filename'`" "$dirB"
            fi
            if [[ "$(cat "$j" | jq '.object.labels."pulse-typology"')" == "\""$keyA"\"" ]]; then
                if [ ! -d "$dirA" ]; then
                    mkdir "$dirA"
                fi
                cp "$d""`cat "$j" | jq -r '.object.filename'`" "$dirA"
            fi
        fi
    done
done

echo "Done!\n"

Footnotes:

1

Schaeffer (1966) Traité des objets musicaux:essai interdisciplines, Editions du Seuil, Paris.

Click the tag/category for related posts

Tags:

Categories:

Updated: