Ticket #268 (closed defect: fixed)

Opened 12 years ago

Last modified 12 years ago

README sampling rate in kHz

Reported by: kmaclean Owned by: kmaclean
Priority: minor Milestone: SpeechSubmission 0.1.8
Component: SpeechSubmission Version: SpeechSubmission 0.1
Keywords: Cc:

Description

Readme info generated from from CapturePlayback? is in Hz not in kHz ... acoustic model creation scripts assume kHz

error:

Use of uninitialized value in string ne at
        /home/kmaclean/VoxForge-dev/Main/Scripts/Audio_scripts/UserSubmission/AUDIO.pm line 75 (#1)
Use of uninitialized value in concatenation (.) or string at
        /home/kmaclean/VoxForge-dev/Main/Scripts/Audio_scripts/UserSubmission/AUDIO.pm line 76 (#1)
Uncaught exception from user code:
        a0076.wav:48kHz does not match samplerate:"" in README
: error message: 0 at /home/kmaclean/VoxForge-dev/Main/Scripts/Audio_scripts/UserSubmission/AUDIO.pm line 78
        UserSubmission::AUDIO::AudioValidation('HASH(0x668e20)', 'HASH(0x9cd930)') called at /home/kmaclean/VoxForge-dev/Main/Scripts/Audio_scripts/UserSubmission.pm line 76
        UserSubmission::Main('HASH(0x668e20)') called at ./LocalUserSubmissionValidation.pl line 51
        main::ProcessUserSubmissions() called at ./LocalUserSubmissionValidation.pl line 44
 at /home/kmaclean/VoxForge-dev/Main/Scripts/Audio_scripts/UserSubmission/AUDIO.pm line 78
        UserSubmission::AUDIO::AudioValidation('HASH(0x668e20)', 'HASH(0x9cd930)') called at /home/kmaclean/VoxForge-dev/Main/Scripts/Audio_scripts/UserSubmission.pm line 76
        UserSubmission::Main('HASH(0x668e20)') called at ./LocalUserSubmissionValidation.pl line 51
        main::ProcessUserSubmissions() called at ./LocalUserSubmissionValidation.pl line 44

Contents of Readme is as follows:

User Name:anonymous

Speaker Characteristics:

Gender: Male
Age Range: Youth
Pronunciation dialect: American English

Recording Information:

Microphone make: n/a
Microphone type:unknown
Audio card make: unknown
Audio card type: unknown
Audio Recording Software: VoxForge Speech Submission Application
O/S:

File Info:

File type: wav
Sampling Rate: 48000
Sample rate format: 16
Number of channels: 1

code section in Audio.pm is as follows:

				if ($fileSuffix eq ("wav")) {
					if (lc $filetype ne lc $fileSuffix) {
						confess "audio file type does not match README: $?";
					}	
					my $wav = new Audio::Wav  || confess "wav AUDIO.pm error: $?";
					my $read = $wav -> read( "$QuarantineDir/$audio_dir_name/$line" ) || confess "wav AUDIO.pm error: $?";
				    my $details = $read -> details() || confess "wav AUDIO.pm error: $?";
					my $filesamplerate = ($$details{sample_rate})/1000;
					my $filesamplerateformat = $$details{bits_sample};
					if ($filesamplerate ne $samplingrate) {
						my $message = "$line:$filesamplerate" . "kHz does not match samplerate:\"$samplingrate\" in README\n";
						print FILEOUT $message;
						confess "$message: error message: $?";
					} elsif ($filesamplerateformat ne $samplingrateformat) {
						my $message = "$line:$filesamplerateformat" . "bps does not match samplerate format (bits per sample):\"$samplingrateformat\" in README\n";
						print FILEOUT $message;
						confess "$message: error message: $?";
					} else {
						print FILEOUT "$line:$filesamplerate" . "kHz" ."\-$filesamplerateformat" . "bits\n";
					}
				} 

Change History

comment:1 Changed 12 years ago by kmaclean

  • Status changed from new to closed
  • Resolution set to fixed

Change Reamme.pm to match Readme text on a case insentive basis:

		if ($line =~ /Sampling rate:/i) {
			$line =~ s/ //g; # remove spaces	
			$line =~ s/-//g; # remove dashes				
			($title, $samplingrate) =split(/\:/, $line);
			$samplingrate =~ s/\D//g; # removes anything other than a digit	
			$samplingrate =~ s/0//g; # removes trailing zeros	
			$samplingrate =~ s/441/44\.1/g; 
			$samplingrate = $samplingrate . "kHz";
		#	print "Samplingrate:$samplingrate\n" if $debug;	
		} elsif ($line =~ /Sample rate format:/i) {
			$line =~ s/ //g; # remove spaces	
			$line =~ s/-//g; # remove dashes	
			($title, $samplingrateformat) =split(/\:/, $line);
			$samplingrateformat =~ s/\D//g; # removes anything other than a digit	
			$samplingrateformat = $samplingrateformat ."bit";
		#	 print "Samplingrateformat:$samplingrateformat\n" if $debug;	
		} elsif ($line =~ /Pronunciation dialect:/i) {
			($title, $dialect) =split(/\:/, $line);
			$dialect =~ s/^ //g;		 # remove leading space	
		#	 print "dialect:$dialect\n" if $debug;
		} elsif ($line =~ /File type:/i) {
			$line =~ s/ //g; # remove spaces	
			($title, $filetype) =split(/\:/, $line);
			$filetype = lc $filetype; #lower case
		#	 print "filetype:$filetype\n" if $debug;					
		}

Note: See TracTickets for help on using tickets.