View Issue Details

IDProjectCategoryView StatusLast Update
0002016ardourbugspublic2012-01-10 17:57
Reportercolinf Assigned Topaul  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product VersionSVN/2.0-ongoing 
Summary0002016: Transpose is wrong
DescriptionTranspose doesn't transpose by the amount you choose: moreover there's no option to transpose down.

I've attached a patch that fixes both these issues.
TagsNo tags attached.

Activities

2008-01-10 19:26

 

correct-pitch-shift.patch (1,741 bytes)   
Index: gtk2_ardour/editor_timefx.cc
===================================================================
--- gtk2_ardour/editor_timefx.cc	(revision 2878)
+++ gtk2_ardour/editor_timefx.cc	(working copy)
@@ -62,9 +62,9 @@
 	: ArdourDialog (X_("time fx dialog")),
 	  editor (e),
 	  pitching (pitch),
-	  pitch_octave_adjustment (0.0, 0.0, 4.0, 1, 2.0),
-	  pitch_semitone_adjustment (0.0, 0.0, 12.0, 1.0, 4.0),
-	  pitch_cent_adjustment (0.0, 0.0, 150.0, 5.0, 15.0),
+	  pitch_octave_adjustment (0.0, -4.0, 4.0, 1, 2.0),
+	  pitch_semitone_adjustment (0.0, -12.0, 12.0, 1.0, 4.0),
+	  pitch_cent_adjustment (0.0, -499.0, 500.0, 5.0, 15.0),
 	  pitch_octave_spinner (pitch_octave_adjustment),
 	  pitch_semitone_spinner (pitch_semitone_adjustment),
 	  pitch_cent_spinner (pitch_cent_adjustment),
@@ -217,6 +217,7 @@
 	if (pitching) {
 
 		float cents = current_timefx->pitch_octave_adjustment.get_value() * 1200.0;
+		float pitch_fraction;
 		cents += current_timefx->pitch_semitone_adjustment.get_value() * 100.0;
 		cents += current_timefx->pitch_cent_adjustment.get_value();
 
@@ -226,19 +227,15 @@
 			return 0;
 		}
 
-		// we now have the pitch shift in cents. divide by 1200 to get octaves
-		// then multiply by 2.0 because 1 octave == doubling the frequency
-		
-		cents /= 1200.0;
-		cents /= 2.0;
+		// one octave == 1200 cents
+		// adding one octave doubles the frequency
+		// ratio is 2^^octaves
+				
+		pitch_fraction = pow(2, cents/1200);
 
-		// add 1.0 to convert to RB scale
-
-		cents += 1.0;
-
 		current_timefx->request.time_fraction = 1.0;
-		current_timefx->request.pitch_fraction = cents;
-
+		current_timefx->request.pitch_fraction = pitch_fraction;
+		
 	} else {
 
 		current_timefx->request.time_fraction = val;
correct-pitch-shift.patch (1,741 bytes)   

paul

2008-01-10 20:14

administrator   ~0004630

committed to svn, just before 2.2

colinf

2012-01-10 17:57

updater   ~0012532

Closing my old issues: this is long since fixed.

Issue History

Date Modified Username Field Change
2008-01-10 19:26 colinf New Issue
2008-01-10 19:26 colinf File Added: correct-pitch-shift.patch
2008-01-10 20:14 paul Status new => resolved
2008-01-10 20:14 paul Resolution open => fixed
2008-01-10 20:14 paul Assigned To => paul
2008-01-10 20:14 paul Note Added: 0004630
2012-01-10 17:57 colinf Note Added: 0012532
2012-01-10 17:57 colinf Status resolved => closed