Bug 777 - Squeezebox pitch change does not work correctly for pcm streams
: Squeezebox pitch change does not work correctly for pcm streams
Status: RESOLVED WONTFIX
Product: Logitech Media Server
Classification: Unclassified
Component: Audio
: unspecified
: All All
: P3 normal (vote)
: ---
Assigned To: Adrian Smith
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2005-01-10 13:34 UTC by Adrian Smith
Modified: 2008-08-18 10:53 UTC (History)
0 users

See Also:
Category: ---


Attachments
patch for pitch fault (1.37 KB, patch)
2005-01-16 14:40 UTC, Adrian Smith
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Adrian Smith 2005-01-10 13:34:57 UTC
The current code for sendPitch does not use the correct reference frequency 
for pcm streams leading to Squeezebox playing too fast when set to 100% 
pitch.  The following should fix this: 

--- ../../../slimserver-20041216nightly/Slim/Player/Squeezebox.pm	2004-
12-16 22:14:49.000000000 +0000
+++ Squeezebox.pm	2005-01-08 13:12:21.334415101 +0000
@@ -612,18 +612,24 @@
 	my $pitch = shift;
 	my $pause = shift;
 	
-	my $freq = int(18432 / ($pitch / 100));
-	my $freqHex = sprintf('%05X', $freq);
-	$::d_control && msg("Pitch frequency set to $freq ($freqHex), pause: 
$pause\n");
-
 	if ($client->streamformat()) {
 		if ($client->streamformat() eq 'mp3') {
+			my $freq = int(18432 / ($pitch / 100));
+			#my $freq = 18432 + ($pitch - 100); # alternative for 
small variation to synch with dac
+			my $freqHex = sprintf('%05X', $freq);
+			$::d_control && msg("Pitch frequency set to $freq 
($freqHex), pause: $pause\n");	
+			
 			$client->i2c(
 				Slim::Hardware::mas35x9::masWrite
('OfreqControl', $freqHex).
 					Slim::Hardware::mas35x9::masWrite
('OutClkConfig', '00001').
 					Slim::Hardware::mas35x9::masWrite
('IOControlMain', '00015')     # MP3
 			);
 		} else {
+			my $freq = int(20062 / ($pitch / 100));
+			#my $freq = 20062 + ($pitch - 100); # alternative for 
small variation to synch with dac
+		        my $freqHex = sprintf('%05X', $freq);
+			$::d_control && msg("Pitch frequency set to $freq 
($freqHex), pause: $pause\n");
+			
 			if ($pause && ($client->playmode() =~ /^play/)) {
 				if (Slim::Utils::Timers::killTimers($client, 
\&resume) == 0) {
 					$client->pause();
Comment 1 Adrian Smith 2005-01-16 14:40:17 UTC
Created attachment 253 [details]
patch for pitch fault

Previous patch attached in more readable format (now I know how to do it!)
Comment 2 Blackketter Dean 2005-03-11 15:47:14 UTC
Triode: can you apply this patch?
Comment 3 Blackketter Dean 2005-03-23 14:57:50 UTC
Sean seems to think that this isn't reallly solvable.  Triode:  If your patch makes things better, than I'm 
fine with it (post-6.0).  Reopen the bug in that case.  otherwise, let's just leave it.
Comment 4 Adrian Smith 2005-04-04 13:22:47 UTC
Removed PCM pitch change code in svn 2866 to avoid user problems caused by 
using pitch change while playing in pcm mode.  [Whenever in pcm mode, now 
stream at reference frequency set by firmware.]