mySQL Tutorial for SAP2
We will start by creating a very small Syllable Table. Open SAP2 'explore & score' and
click 'New table'. Call the table table1. Now set the amplitude (yellow slider) threshold
to
42Db. Next, click 'open sound' and open the sound 'bird102_long.wav' (you may
download this file from http://). Select
and then outline the
entire sound (click to the left of the first syllable and then move the scroll bar below all
the way to the right before clicking at the end of the last syllable). You should now see
45 records (syllables) in the table. 7c. The SELECT keyword
Once you understand how to use SELECT keyword, you can already achieve a lot. Open
MCC and navigate to sap database, and then click the SQL button or open Matlab (after
installing the mySQL interface), open sap as shown above and then type
MCC: select duration, mean_pitch from table1; and click !
Matlab: [duration pitch]=mysql('select duration, mean_pitch from table1');
In MCC you should see the result of your query like this:
If you use MCC select the entire output table, click Control-C (to copy the fields to the
clipboard) and then open Excel and type Control-V to paste. Click data->Text to column
and choose delaminated and then 'next' and in 'other' type '|'
And then click finish. You can now create a X-Y plot of duration versus pitch.
In Matlab, type
plot(duration, pitch, '.r');
Although the sample size is really small you can already see that some of the data are
clustered. Let's query to obtain data that belong to one cluster, for example we can ask
for data where duration is between 100-150ms and pitch is between 600-1100Hz:
MCC: select duration, mean_pitch from table1 where duration>100 and
duration<150 and mean_pitch>600 and mean_pitch<1100;
Matlab: [c1_duration, c1_pitch]=mysql('select duration, mean_pitch from table1
where duration>100 and duration<150 and mean_pitch>600 and
mean_pitch<1100;');
Created using Helpmatic Pro HTML