root/Trunk/Scripts/AcousticModel_scripts/Prompts/MasterPrompts.pm
| Revision 2270, 2.1 kB (checked in by kmaclean, 1 year ago) |
|---|
| Line | |
|---|---|
| 1 | #! /usr/bin/perl |
| 2 | #################################################################### |
| 3 | ### |
| 4 | ### script name : MasterPrompts.pm |
| 5 | ### version: 0.1 |
| 6 | ### created by: Ken MacLean |
| 7 | ### mail: contact@voxforge.org |
| 8 | ### Date: 2007.04.25 |
| 9 | ### Command: perl ./MasterPrompts.pm |
| 10 | ### |
| 11 | ### Copyright (C) 2007 Ken MacLean |
| 12 | ### |
| 13 | ### This program is free software; you can redistribute it and/or |
| 14 | ### modify it under the terms of the GNU General Public License |
| 15 | ### as published by the Free Software Foundation; either version 3 |
| 16 | ### of the License, or (at your option) any later version. |
| 17 | ### |
| 18 | ### This program is distributed in the hope that it will be useful, |
| 19 | ### but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 21 | ### GNU General Public License for more details. |
| 22 | ### |
| 23 | ### Change History: |
| 24 | ### April 25, 2007 - renamed from fix_master_prompts.pl to MasterPrompts.pm |
| 25 | #################################################################### |
| 26 | package MasterPrompts; |
| 27 | use strict; |
| 28 | |
| 29 | sub Fix { |
| 30 | my ($parms,$targetrate) = @_; |
| 31 | my $debug = $$parms{"debug"}; |
| 32 | # my $prompts_file = $$parms{"PromptsFile"}; |
| 33 | my $prompts_16kHz_16bit = $$parms{"PromptsFile_16kHz-16bit"}; |
| 34 | my $prompts_8kHz_16bit = $$parms{"PromptsFile_8kHz-16bit"}; |
| 35 | my $HTKdir = $$parms{"HTK_dir"}; |
| 36 | my $AudioDirectory = $$parms{"AudioDirectory"}; |
| 37 | my $line; |
| 38 | # !!!!!! |
| 39 | # open(INPUT, "$prompts_file") or die ("cannot open $prompts_file for reading"); # open for input |
| 40 | if ($targetrate eq "16kHz_16bit") { |
| 41 | open(INPUT, $prompts_16kHz_16bit) or die ("cannot open $prompts_16kHz_16bit for reading\n"); # open for input |
| 42 | } elsif ($targetrate eq "8kHz_16bit") { |
| 43 | open(INPUT, $prompts_8kHz_16bit) or die ("cannot open $prompts_8kHz_16bit for reading\n"); # open for input |
| 44 | } else { |
| 45 | die ("$targetrate not set up!\n"); |
| 46 | } |
| 47 | # !!!!!! |
| 48 | open(OUTPUT, ">$HTKdir/interim_files/master_prompts") or die ("cannot open $HTKdir/interim_files/master_prompts for output"); # open for output |
| 49 | my $mfcc_location = "$AudioDirectory/MFCC/$targetrate/MFCC_0_D"; |
| 50 | while ($line = <INPUT>) { |
| 51 | print OUTPUT ("$mfcc_location/$line"); |
| 52 | } |
| 53 | close(INPUT); |
| 54 | close(OUTPUT); |
| 55 | } |
| 56 | 1; |
Note: See TracBrowser for help on using the browser.