autoSound Sound_and_Covariance_whitenChannels (Sound me, Covariance thee, double varianceFraction) { try { autoPCA pca = SSCP_to_PCA (thee); long numberOfComponents = Eigen_getDimensionOfFraction (pca.peek(), varianceFraction); autoSound him = Sound_and_PCA_whitenChannels (me, pca.peek(), numberOfComponents); return him; } catch (MelderError) { Melder_throw (me, U": not whitened from ", thee); } }
FORM (Sound_and_PCA_projectChannels, L"Sound & PCA: To Sound (project channels)", 0) NATURAL (L"Number of components", L"10") OK DO Sound me = FIRST (Sound); PCA thee = FIRST (PCA); praat_new (Sound_and_PCA_projectChannels (me, thee, GET_INTEGER (L"Number of components")), Thing_getName (me), L"_projected"); END FORM (Sound_and_PCA_whitenChannels, L"Sound & PCA: To Sound (whiten channels)", 0) NATURAL (L"Number of components", L"10") OK DO Sound me = FIRST (Sound); PCA thee = FIRST (PCA); praat_new (Sound_and_PCA_whitenChannels (me, thee, GET_INTEGER (L"Number of components")), Thing_getName (me), L"_white"); END DIRECT (CrossCorrelationTable_to_CrossCorrelationTables) autoCrossCorrelationTables thee = CrossCorrelationTables_create (); long nrows = 0, ncols = 0, nselected = 0; LOOP { iam (CrossCorrelationTable); nselected++; if (nselected == 1) { nrows = my numberOfRows; ncols = my numberOfColumns; } if (my numberOfRows != nrows || my numberOfColumns != ncols) Melder_throw ("Dimensions of table ", IOBJECT, " differs from the rest."); autoCrossCorrelationTable myc = Data_copy (me); Collection_addItem (thee.peek(), myc.transfer());
NATURAL (U"Number of components", U"10") OK DO Sound me = FIRST (Sound); PCA thee = FIRST (PCA); autoSound him = Sound_and_PCA_principalComponents (me, thee, GET_INTEGER (U"Number of components")); praat_new (him.move(), my name, U"_pc"); END FORM (Sound_and_PCA_whitenChannels, U"Sound & PCA: To Sound (white channels)", 0) NATURAL (U"Number of components", U"10") OK DO Sound me = FIRST (Sound); PCA thee = FIRST (PCA); autoSound him = Sound_and_PCA_whitenChannels (me, thee, GET_INTEGER (U"Number of components")); praat_new (him.move(), my name, U"_white"); END DIRECT (CrossCorrelationTable_to_CrossCorrelationTableList) autoCrossCorrelationTableList thee = CrossCorrelationTableList_create (); long nrows = 0, ncols = 0, nselected = 0; LOOP { iam (CrossCorrelationTable); nselected++; if (nselected == 1) { nrows = my numberOfRows; ncols = my numberOfColumns; } if (my numberOfRows != nrows || my numberOfColumns != ncols) { Melder_throw (U"Dimensions of table ", IOBJECT, U" differs from the rest.");