[med-svn] [Git][med-team/praat][upstream] New upstream version 6.0.47

Rafael Laboissiere gitlab at salsa.debian.org
Mon Feb 18 17:47:25 GMT 2019


Rafael Laboissiere pushed to branch upstream at Debian Med / praat


Commits:
f9abb34d by Rafael Laboissiere at 2019-02-17T12:23:38Z
New upstream version 6.0.47
- - - - -


13 changed files:

- dwsys/NUM2.cpp
- dwtools/DTW.cpp
- dwtools/VowelEditor.cpp
- fon/Pitch.cpp
- fon/Pitch.h
- fon/Sound.cpp
- fon/manual_Script.cpp
- fon/manual_tutorials.cpp
- fon/praat_Fon.cpp
- sys/Ui.cpp
- sys/praat_objectMenus.cpp
- sys/praat_version.h
- + test/dwtools/CPPS.praat


Changes:

=====================================
dwsys/NUM2.cpp
=====================================
@@ -2032,7 +2032,7 @@ void NUMlineFit_theil (constVEC x, constVEC y, double *out_m, double *out_interc
 						mbs [++ index] = (y [j] - y [i]) / (x [j] - x [i]);
 			}
 			VECsort_inplace (mbs.part (1, numberOfCombinations));
-			m = NUMquantile (mbs.get(), 0.5);
+			m = NUMquantile (mbs.part (1, numberOfCombinations), 0.5);
 			for (integer i = 1; i <= x.size; i ++)
 				mbs [i] = y [i] - m * x [i];
 			VECsort_inplace (mbs.part (1, x.size));


=====================================
dwtools/DTW.cpp
=====================================
@@ -991,7 +991,7 @@ static void DTW_checkSlopeConstraints (DTW me, double band, int slope) {
         if (dtw_slope < 1.0)
             dtw_slope = 1.0 / dtw_slope;
 
-        Melder_require (dtw_slope <= slopes [slope], U"There is a conflict between the chosen slope constraint and the relative duration. The duration ratio of the integerest and the shortest object is ", dtw_slope, U". This implies that the largest slope in the constraint must have a value greater or equal to this ratio.");
+        Melder_require (dtw_slope <= slopes [slope], U"There is a conflict between the chosen slope constraint and the relative duration. The duration ratio of the longest and the shortest object is ", dtw_slope, U". This implies that the largest slope in the constraint must have a value greater or equal to this ratio.");
     } catch (MelderError) {
         Melder_throw (U"Slope constraints cannot be met.");
     }


=====================================
dwtools/VowelEditor.cpp
=====================================
@@ -1,6 +1,6 @@
 /* VowelEditor.cpp
  *
- * Copyright (C) 2008-2017 David Weenink, 2015,2017,2018 Paul Boersma
+ * Copyright (C) 2008-2019 David Weenink, 2015,2017,2018 Paul Boersma
  *
  * This code is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -91,9 +91,6 @@ Thing_implement (VowelEditor, Editor, 0);
 #define BUFFER_SIZE_SEC 4
 #define SAMPLING_FREQUENCY 44100
 
-#define STATUSINFO_STARTINTR0 U"Start (F1,F2,F0) = ("
-#define STATUSINFO_ENDINTR0 U"End (F1,F2,F0) = ("
-#define STATUSINFO_ENDING U")"
 #define MICROSECPRECISION(x) (round((x)*1000000)/1000000)
 
 // To prevent the generation of inaudible short Sounds we set a minimum duration
@@ -981,8 +978,8 @@ static void menu_cb_showVowelMarksFromTableFile (VowelEditor me, EDITOR_ARGS_FOR
 }
 
 static void menu_cb_setF0 (VowelEditor me, EDITOR_ARGS_FORM) {
-	EDITOR_FORM (U"Set F0", nullptr);
-		POSITIVE (startF0, U"Start F0 (Hz)", U"150.0")
+	EDITOR_FORM (U"Set f0", nullptr);
+		POSITIVE (startF0, U"Start f0 (Hz)", U"150.0")
 		REAL (slope, U"Slope (oct/s)", U"0.0")
 	EDITOR_OK
 	EDITOR_DO
@@ -1139,13 +1136,13 @@ static void gui_drawingarea_cb_expose (VowelEditor me, GuiDrawingArea_ExposeEven
 		return;   // could be the case in the very beginning
 	Graphics_clearWs (my graphics.get());
 
-	appendF1F2F0 (& statusInfo, STATUSINFO_STARTINTR0, FormantTier_getValueAtTime (ft, 1, ts),
-		FormantTier_getValueAtTime (ft, 2, ts), getF0 (& my f0, ts), STATUSINFO_ENDING);
+	appendF1F2F0 (& statusInfo, U"Start (F1,F2,f0) = (", FormantTier_getValueAtTime (ft, 1, ts),
+		FormantTier_getValueAtTime (ft, 2, ts), getF0 (& my f0, ts), U")");
 	GuiLabel_setText (my startInfo, statusInfo.string);
 	MelderString_empty (& statusInfo);
 
-	appendF1F2F0 (& statusInfo, STATUSINFO_ENDINTR0, FormantTier_getValueAtTime (ft, 1, te),
-		FormantTier_getValueAtTime (ft, 2, te), getF0 (& my f0, te), STATUSINFO_ENDING);
+	appendF1F2F0 (& statusInfo, U"End (F1,F2,f0) = (", FormantTier_getValueAtTime (ft, 1, te),
+		FormantTier_getValueAtTime (ft, 2, te), getF0 (& my f0, te), U")");
 	GuiLabel_setText (my endInfo, statusInfo.string);
 	MelderString_empty (& statusInfo);
 
@@ -1313,7 +1310,7 @@ void structVowelEditor :: v_createMenus () {
 	Editor_addCommand (this, U"File", U"Draw trajectory...", 0, menu_cb_drawTrajectory);
 	Editor_addCommand (this, U"File", U"-- scripting --", 0, nullptr);
 	Editor_addCommand (this, U"Edit", U"-- f0 --", 0, nullptr);
-	Editor_addCommand (this, U"Edit", U"Set F0...", 0, menu_cb_setF0);
+	Editor_addCommand (this, U"Edit", U"Set f0...", 0, menu_cb_setF0);
 	Editor_addCommand (this, U"Edit", U"Set F3 & F4...", 0, menu_cb_setF3F4);
 	Editor_addCommand (this, U"Edit", U"-- trajectory commands --", 0, nullptr);
 	Editor_addCommand (this, U"Edit", U"Reverse trajectory", 0, menu_cb_reverseTrajectory);
@@ -1338,7 +1335,7 @@ void structVowelEditor :: v_createHelpMenuItems (EditorMenu menu) {
 
 void structVowelEditor :: v_createChildren ()
 {
-	const int button_width = 90, text_width = 95, status_info_width = 290;
+	const int button_width = 90, text_width = 95, status_info_width = 330;
 	int top, bottom, bottom_widgets_top, bottom_widgets_bottom, bottom_widgets_halfway;
 
 	// Three buttons on a row: Play, Reverse, Publish
@@ -1349,8 +1346,8 @@ void structVowelEditor :: v_createChildren ()
 	reverseButton = GuiButton_createShown (our windowForm, left, right, top, bottom, U"Reverse", gui_button_cb_reverse, this, 0);
 	left = right + 10; right = left + button_width;
 	publishButton = GuiButton_createShown (our windowForm, left, right, top, bottom, U"Publish", gui_button_cb_publish, this, 0);
-	// Four Text widgets with the label on top: Duration, Extend, F0, Slope
-	// Make the F0 slope button 10 wider to accomodate the text
+	// Four Text widgets with the label on top: Duration, Extend, f0, Slope
+	// Make the f0 slope button 10 wider to accomodate the text
 	// We wil not use a callback from a Text widget. It will get called multiple times during the editing
 	// of the text. Better to have all editing done and then query the widget for its value!
 	left = right + 10; right = left + text_width; bottom_widgets_halfway = bottom = (top + bottom) / 2; top = bottom_widgets_top;
@@ -1364,21 +1361,25 @@ void structVowelEditor :: v_createChildren ()
 	extendTextField = GuiText_createShown (our windowForm, left, right, top, bottom, 0);
 
 	left = right + 10; right = left + text_width; top = bottom_widgets_top; bottom = bottom_widgets_halfway;
-	GuiLabel_createShown (our windowForm, left, right, top, bottom, U"Start F0 (Hz):", 0);
+	GuiLabel_createShown (our windowForm, left, right, top, bottom, U"Start f0 (Hz):", 0);
 	top = bottom; bottom = bottom_widgets_bottom;
 	f0TextField = GuiText_createShown (our windowForm, left, right, top, bottom, 0);
 
 	left = right + 10; right = left + text_width + 10; top = bottom_widgets_top; bottom = bottom_widgets_halfway;
-	GuiLabel_createShown (our windowForm, left, right, top, bottom, U"F0 slope (oct/s):", 0);
+	GuiLabel_createShown (our windowForm, left, right, top, bottom, U"Slope f0 (oct/s):", 0);
 	top = bottom; bottom = bottom_widgets_bottom;
 	f0SlopeTextField = GuiText_createShown (our windowForm, left, right, top, bottom, 0);
 
 	// The status startInfo and endInfo widget at the bottom:
 
-	bottom = - (STATUS_INFO - Gui_LABEL_HEIGHT) / 2; top = bottom - Gui_LABEL_HEIGHT; left = MARGIN_LEFT; right = left + status_info_width;
+	bottom = - (STATUS_INFO - Gui_LABEL_HEIGHT) / 2;
+	top = bottom - Gui_LABEL_HEIGHT;
+	left = MARGIN_LEFT;
+	right = left + status_info_width;
 	startInfo = GuiLabel_createShown (our windowForm, left, right, top, bottom, U"", 0);
 
-	left = right; right = left + status_info_width;
+	left = right;
+	right = left + status_info_width;
 	endInfo = GuiLabel_createShown (our windowForm, left, right, top, bottom, U"", 0);
 
 	/***** Create drawing area. *****/


=====================================
fon/Pitch.cpp
=====================================
@@ -458,6 +458,33 @@ integer Pitch_getMaxnCandidates (Pitch me) {
 	return result;
 }
 
+static void Pitch_checkFrameNumber (Pitch me, integer frameNumber) {
+    Melder_require (frameNumber >= 1,
+    	U"The frame number should be at least 1, but is ", frameNumber, U" instead.");
+    Melder_require (frameNumber <= my nx,
+    	U"The frame number should at most the number of frames (", my nx, U"), but is ", frameNumber, U" instead.");
+}
+
+autoMAT Pitch_Frame_getAllCandidates (Pitch_Frame me) {
+	integer numberOfCandidates = my nCandidates;
+	autoMAT candidates = newMATraw (2, numberOfCandidates);
+	for (integer icand = 1; icand <= numberOfCandidates; icand ++) {
+		candidates [1] [icand] = my candidate [icand]. frequency;
+		candidates [2] [icand] = my candidate [icand]. strength;
+	}
+	return candidates;
+}
+
+autoMAT Pitch_getAllCandidatesInFrame (Pitch me, integer frameNumber) {
+	try {
+    	Pitch_checkFrameNumber (me, frameNumber);
+    	Pitch_Frame frame = & my frame [frameNumber];
+    	return Pitch_Frame_getAllCandidates (frame);
+	} catch (MelderError) {
+		Melder_throw (U"Candidate matrix not created.");
+	}
+}
+
 void Pitch_pathFinder (Pitch me, double silenceThreshold, double voicingThreshold,
 	double octaveCost, double octaveJumpCost, double voicedUnvoicedCost,
 	double ceiling, int pullFormants)


=====================================
fon/Pitch.h
=====================================
@@ -122,6 +122,9 @@ void Pitch_setCeiling (Pitch me, double ceiling);
 		my ceiling = ceiling;
 */
 
+autoMAT Pitch_Frame_getAllCandidates (Pitch_Frame me);
+autoMAT Pitch_getAllCandidatesInFrame (Pitch me, integer frameNumber);
+
 void Pitch_pathFinder (Pitch me, double silenceThreshold, double voicingThreshold,
 	double octaveCost, double octaveJumpCost, double voicedUnvoicedCost,
 	double ceiling, int pullFormants);


=====================================
fon/Sound.cpp
=====================================
@@ -905,6 +905,8 @@ autoSound Sound_createAsPureTone (integer numberOfChannels, double startingTime,
 	double sampleRate, double frequency, double amplitude, double fadeInDuration, double fadeOutDuration)
 {
 	try {
+		Melder_require (numberOfChannels >= 1,
+			U"The number of channels has to be at least 1.");
 		double numberOfSamples_f = round ((endTime - startingTime) * sampleRate);
 		if (numberOfSamples_f > (double) INT32_MAX)
 			Melder_throw (U"Cannot create sounds with more than ", Melder_bigInteger (INT32_MAX), U" samples, because they cannot be saved to disk.");


=====================================
fon/manual_Script.cpp
=====================================
@@ -1770,7 +1770,7 @@ MAN_END
 MAN_BEGIN (U"Scripting 3. Simple language elements", U"ppgb", 20130421)
 INTRO (U"The Praat scripting language doesn't only call the menu commands "
 	"discussed in the @@Scripting 1. Your first scripts|first@ and @@Scripting 2. How to script settings windows|second@ chapters of this tutorial, "
-	"it is only a general procedural programming language that allows you to compute numbers, handle texts, and make custom analyses.")
+	"it is also a general procedural programming language that allows you to compute numbers, handle texts, and make custom analyses.")
 NORMAL (U"This chapter focuses on the things you need most. It is designed in such a way that you can work through it even if you haven't written computer programs before.")
 LIST_ITEM (U"@@Scripting 3.1. Hello world@ (writeInfoLine, appendInfoLine)")
 LIST_ITEM (U"@@Scripting 3.2. Numeric variables@ (assignments)")


=====================================
fon/manual_tutorials.cpp
=====================================
@@ -22,9 +22,11 @@
 void manual_tutorials_init (ManPages me);
 void manual_tutorials_init (ManPages me) {
 
-MAN_BEGIN (U"What's new?", U"ppgb", 20190103)
+MAN_BEGIN (U"What's new?", U"ppgb", 20190208)
 INTRO (U"Latest changes in Praat.")
 //LIST_ITEM (U"• Manual page about @@drawing a vowel triangle at .")
+NORMAL (U"##6.0.47# (8 February 2019)")
+LIST_ITEM (U"• Removed a bug introdu ed in 6.0.44 whereby a cepstral peak prominence would be computed incorrectly.")
 NORMAL (U"##6.0.46# (3 January 2019)")
 LIST_ITEM (U"• Removed a crashing bug in the LongSound window introduced in 6.0.44.")
 LIST_ITEM (U"• Removed a bug causing incorrect conversion from Formant to LPC introduced in 6.0.44.")


=====================================
fon/praat_Fon.cpp
=====================================
@@ -1550,7 +1550,16 @@ DO
 	MODIFY_EACH_WEAK_END
 }
 
-FORM (REAL_Pitch_getMinimum, U"Pitch: Get minimum", 0) {
+FORM (NUMMAT_Pitch_getAllCandidatesInFrame, U"Pitch: Get all candidates in frame", nullptr) {
+	NATURAL (frameNumber, U"Frame number", U"1")
+	OK
+DO
+	NUMMAT_ONE (Pitch)
+		autoMAT result = Pitch_getAllCandidatesInFrame (me, frameNumber);
+	NUMMAT_ONE_END
+}
+
+FORM (REAL_Pitch_getMinimum, U"Pitch: Get minimum", nullptr) {
 	praat_TimeFunction_RANGE (fromTime, toTime)
 	OPTIONMENU_ENUM (kPitch_unit, unit, U"Unit", kPitch_unit::DEFAULT)
 	RADIOx (interpolation, U"Interpolation", 2, 0)
@@ -3200,6 +3209,9 @@ praat_addAction1 (classFormant, 0, U"Hack", nullptr, 0, nullptr);
 		praat_addAction1 (classPitch, 1, U"Get slope without octave jumps", nullptr, 1, REAL_Pitch_getMeanAbsSlope_noOctave);
 		praat_addAction1 (classPitch, 2, U"-- query two --", nullptr, 1, nullptr);
 		praat_addAction1 (classPitch, 2, U"Count differences", nullptr, 1, INFO_Pitch_difference);
+		praat_addAction1 (classPitch, 2, U"-- hack --", nullptr, 1, nullptr);
+		praat_addAction1 (classPitch, 1, U"Internal", nullptr, 1, nullptr);
+			praat_addAction1 (classPitch, 1, U"Get all candidates in frame...", nullptr, 2, NUMMAT_Pitch_getAllCandidatesInFrame);
 	praat_addAction1 (classPitch, 0, U"Modify -", nullptr, 0, nullptr);
 		praat_TimeFunction_modify_init (classPitch);
 		praat_addAction1 (classPitch, 0, U"Formula...", nullptr, 1, MODIFY_Pitch_formula);


=====================================
sys/Ui.cpp
=====================================
@@ -1226,7 +1226,10 @@ static void UiField_argToValue (UiField me, Stackel arg, Interpreter /* interpre
 					Melder_throw (U"Argument \"", my name.get(), U"\" should be a number, not ", arg -> whichText(), U".");
 				}
 			} else if (arg -> which == Stackel_NUMBER) {
-				my integerValue = Melder_iround (arg -> number);
+				double realValue = arg -> number;
+				my integerValue = Melder_iround (realValue);
+				Melder_require (my integerValue == realValue,
+					U"Argument \"", my name.get(), U"\" should be a whole number.");
 				if (my type == _kUiField_type::NATURAL_ && my integerValue < 1)
 					Melder_throw (U"Argument \"", my name.get(), U"\" should be a positive whole number.");
 			} else {


=====================================
sys/praat_objectMenus.cpp
=====================================
@@ -640,8 +640,8 @@ void praat_addMenus (GuiWindow window) {
 	}
 	
 	MelderString_append (& itemTitle_about, U"About ", praatP.title.get(), U"...");
+	praat_addMenuCommand (U"Objects", U"Praat", itemTitle_about.string, nullptr, praat_UNHIDABLE, WINDOW_About);
 	#ifdef macintosh
-		praat_addMenuCommand (U"Objects", U"Praat", itemTitle_about.string, nullptr, praat_UNHIDABLE, WINDOW_About);
 		#if cocoa
 			/*
 			 * HACK: give the following command weird names,


=====================================
sys/praat_version.h
=====================================
@@ -1,5 +1,5 @@
-#define PRAAT_VERSION_STR 6.0.46
-#define PRAAT_VERSION_NUM 6046
+#define PRAAT_VERSION_STR 6.0.47
+#define PRAAT_VERSION_NUM 6047
 #define PRAAT_YEAR 2019
-#define PRAAT_MONTH January
-#define PRAAT_DAY 3
+#define PRAAT_MONTH February
+#define PRAAT_DAY 8


=====================================
test/dwtools/CPPS.praat
=====================================
@@ -0,0 +1,5 @@
+sound = Create Sound from formula: "sineWithNoise", 1, 0, 1, 44100, "1/2 * sin(2*pi*377*x) + randomGauss(0,0.1)"
+ceps = To PowerCepstrogram: 60, 0.002, 5000, 50
+cpps = Get CPPS: "yes", 0.02, 0.0005, 60, 330, 0.05, "Parabolic", 0.001, 0, "Exponential decay", "Robust"
+assert 4.0 < cpps and cpps < 4.9 ; 'cpps'
+removeObject: sound, ceps



View it on GitLab: https://salsa.debian.org/med-team/praat/commit/f9abb34d7672c4aa12e6b845533adef13e44bf7e

-- 
View it on GitLab: https://salsa.debian.org/med-team/praat/commit/f9abb34d7672c4aa12e6b845533adef13e44bf7e
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-med-commit/attachments/20190218/6ad48103/attachment-0001.html>


More information about the debian-med-commit mailing list