voxforge.org
VoxForge Dev

Changeset 2290

Show
Ignore:
Timestamp:
09/09/07 22:04:40 (1 year ago)
Author:
kmaclean
Message:

Speech Submission System SnapShot? - works with AssetProxy? in WebGUI

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • Trunk/SpeechSubmission/VFSpeechSubmission/java/src/moodlespeex

    • Property svn:ignore set to
      SamplingGraph-Moodlespeex.java
      SamplingGraph-Sun.java
  • Trunk/SpeechSubmission/VFSpeechSubmission/java/src/moodlespeex/CapturePlayback.java

    r2278 r2290  
    7878    public static int BUFFER_SIZE = 10240; 
    7979    public static final String fileType = "wav";      
    80     public static final int samplingRate = 48000;        
     80    public static final int samplingRate = 48000; 
     81//    public static final int samplingRate = 44100;  // jre 1.4.2 only supports max of 44100 
    8182    public static final int samplingRateFormat = 16;       
    8283    public static final int numberChannels = 1;       
     84/*this code snippet might work to query audio card for sampling rate ...  
     85 *     DataLine.Info info = new DataLine.Info(TargetDataLine.class,  
     86                samplingRateFormat); // format is an AudioFormat object 
     87        if (!AudioSystem.isLineSupported(info)) { 
     88            // Handle the error. 
     89            } 
     90            // Obtain and open the line. 
     91        try { 
     92            line = (TargetDataLine) AudioSystem.getLine(info); 
     93            line.open(format); 
     94        } catch (LineUnavailableException ex) { 
     95                // Handle the error. 
     96            //...  
     97        } 
     98     
     99*/     
     100     
    83101    AudioFormat format = new AudioFormat(samplingRate, samplingRateFormat, numberChannels, true, false); 
     102  
    84103// !!!!!!     
    85104    Capture capture = new Capture(); 
     
    440459                System.err.println("CapturePlayback's WAV file for recording wavFile4 is:" + wavFile4); 
    441460                System.err.println("CapturePlayback's WAV file for recording wavFile5 is:" + wavFile5); 
     461                System.err.println("CapturePlayback's WAV file for recording wavFile1 is:" + wavFile6); 
     462                System.err.println("CapturePlayback's WAV file for recording wavFile2 is:" + wavFile7); 
     463                System.err.println("CapturePlayback's WAV file for recording wavFile3 is:" + wavFile8); 
     464                System.err.println("CapturePlayback's WAV file for recording wavFile4 is:" + wavFile9); 
     465                System.err.println("CapturePlayback's WAV file for recording wavFile5 is:" + wavFile10);                 
    442466                System.err.println("CapturePlayback's WAV file for recording uploadWavFile1 is:" + uploadWavFile1); 
    443467                System.err.println("CapturePlayback's WAV file for recording uploadWavFile2 is:" + uploadWavFile2); 
     
    445469                System.err.println("CapturePlayback's WAV file for recording uploadWavFile4 is:" + uploadWavFile4); 
    446470                System.err.println("CapturePlayback's WAV file for recording uploadWavFile5 is:" + uploadWavFile5); 
     471                System.err.println("CapturePlayback's WAV file for recording uploadWavFile1 is:" + uploadWavFile6); 
     472                System.err.println("CapturePlayback's WAV file for recording uploadWavFile2 is:" + uploadWavFile7); 
     473                System.err.println("CapturePlayback's WAV file for recording uploadWavFile3 is:" + uploadWavFile8); 
     474                System.err.println("CapturePlayback's WAV file for recording uploadWavFile4 is:" + uploadWavFile9); 
     475                System.err.println("CapturePlayback's WAV file for recording uploadWavFile5 is:" + uploadWavFile10);             
    447476        setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); 
    448477        //setLayout(new GridBagLayout()); 
     
    18051834                return; 
    18061835            } 
    1807             // reset to the beginnning of the stream 
     1836            // reset to the beginning of the stream 
    18081837            try { 
    18091838                audioInputStream.reset(); 
     
    18581887            sentBytes = 0; 
    18591888 
    1860 System.err.println("Destination URL is " + destinationURL); 
    1861 if(subject != null) { 
    1862   System.err.println("Adding subject to URL"); 
     1889 
     1890//if(subject != null) { 
     1891//  System.err.println("Adding subject to URL"); 
    18631892  try { 
    18641893// !!!!!! 
     
    18711900  } 
    18721901  System.err.println("Destination URL is " + destinationURL); 
    1873 
     1902//
    18741903 
    18751904File[] files = new File[15]; 
     
    18991928try { 
    19001929        BufferedWriter out_prompts = new BufferedWriter(new FileWriter(promptsFile)); 
    1901         out_prompts.write(promptID1 + " " + prompt1); 
    1902         out_prompts.append(System.getProperty("line.separator")); 
    1903         out_prompts.write(promptID2 + " " +prompt2); 
    1904         out_prompts.append(System.getProperty("line.separator"));        
    1905         out_prompts.write(promptID3 + " " +prompt3); 
    1906         out_prompts.append(System.getProperty("line.separator"));        
    1907         out_prompts.write(promptID4 + " " +prompt4); 
    1908         out_prompts.append(System.getProperty("line.separator"));        
    1909     out_prompts.write(promptID5 + " " +prompt5);         
    1910     out_prompts.append(System.getProperty("line.separator")); 
    1911         out_prompts.write(promptID6 + " " + prompt6); 
    1912         out_prompts.append(System.getProperty("line.separator")); 
    1913         out_prompts.write(promptID7 + " " +prompt7); 
    1914         out_prompts.append(System.getProperty("line.separator"));        
    1915         out_prompts.write(promptID8 + " " +prompt8); 
    1916         out_prompts.append(System.getProperty("line.separator"));        
    1917         out_prompts.write(promptID9 + " " +prompt9); 
    1918         out_prompts.append(System.getProperty("line.separator"));        
    1919     out_prompts.write(promptID10 + " " +prompt10);       
    1920     out_prompts.append(System.getProperty("line.separator"));     
     1930        out_prompts.write(promptID1 + " " + prompt1 + System.getProperty("line.separator")); 
     1931        out_prompts.write(promptID2 + " " + prompt2 + System.getProperty("line.separator")); 
     1932        out_prompts.write(promptID3 + " " + prompt3 + System.getProperty("line.separator")); 
     1933        out_prompts.write(promptID4 + " " + prompt4 + System.getProperty("line.separator")); 
     1934    out_prompts.write(promptID5 + " " + prompt5 + System.getProperty("line.separator"));         
     1935        out_prompts.write(promptID6 + " " + prompt6 + System.getProperty("line.separator")); 
     1936        out_prompts.write(promptID7 + " " + prompt7 + System.getProperty("line.separator")); 
     1937        out_prompts.write(promptID8 + " " + prompt8 + System.getProperty("line.separator")); 
     1938        out_prompts.write(promptID9 + " " + prompt9 + System.getProperty("line.separator")); 
     1939    out_prompts.write(promptID10 + " " + prompt10 + System.getProperty("line.separator"));       
    19211940    out_prompts.close(); 
    19221941        } catch (IOException e) { 
     
    19271946try { 
    19281947        BufferedWriter out_readme = new BufferedWriter(new FileWriter(readmeFile)); 
    1929         out_readme.write("User Name:" + userName);out_readme.append(System.getProperty("line.separator")); 
    1930         out_readme.append(System.getProperty("line.separator"));         
    1931  
    1932         out_readme.write("Speaker Characteristics:");out_readme.append(System.getProperty("line.separator")); 
    1933         out_readme.append(System.getProperty("line.separator"));         
    1934         out_readme.write("Gender: " + gender);out_readme.append(System.getProperty("line.separator")); 
    1935         out_readme.write("Age Range: " + ageRange); out_readme.append(System.getProperty("line.separator")); 
    1936         out_readme.write("Pronunciation dialect: " + dialect);  out_readme.append(System.getProperty("line.separator")); 
    1937         out_readme.append(System.getProperty("line.separator")); 
    1938  
    1939         out_readme.write("Recording Information:");     out_readme.append(System.getProperty("line.separator")); 
    1940         out_readme.append(System.getProperty("line.separator")); 
    1941         out_readme.write("Microphone make: n/a" );out_readme.append(System.getProperty("line.separator"));       
    1942         out_readme.write("Microphone type:" + microphone);out_readme.append(System.getProperty("line.separator"));       
    1943         out_readme.write("Audio card make:");out_readme.append(System.getProperty("line.separator"));    
    1944         out_readme.write("Audio card type:");out_readme.append(System.getProperty("line.separator"));    
    1945         out_readme.write("Audio Recording Software:");out_readme.append(System.getProperty("line.separator"));   
    1946         out_readme.write("O/S:");out_readme.append(System.getProperty("line.separator"));        
    1947  
    1948         out_readme.write("File Info:"); out_readme.append(System.getProperty("line.separator")); 
    1949         out_readme.append(System.getProperty("line.separator")); 
    1950         out_readme.write("File type: " + fileType);out_readme.append(System.getProperty("line.separator"));      
    1951         out_readme.write("Sampling Rate: " + samplingRate);out_readme.append(System.getProperty("line.separator"));      
    1952         out_readme.write("Sample rate format: " + samplingRateFormat);out_readme.append(System.getProperty("line.separator"));   
    1953         out_readme.write("Number of channels: " + numberChannels);out_readme.append(System.getProperty("line.separator"));       
     1948        out_readme.write("User Name:" + userName + System.getProperty("line.separator")); 
     1949        out_readme.write(System.getProperty("line.separator"));  
     1950 
     1951        out_readme.write("Speaker Characteristics:" + System.getProperty("line.separator") ); 
     1952        out_readme.write(System.getProperty("line.separator"));  
     1953        out_readme.write("Gender: " + gender + System.getProperty("line.separator") ); 
     1954        out_readme.write("Age Range: " + ageRange + System.getProperty("line.separator"));  
     1955        out_readme.write("Pronunciation dialect: " + dialect + System.getProperty("line.separator"));    
     1956        out_readme.write(System.getProperty("line.separator")); 
     1957 
     1958        out_readme.write("Recording Information:" + System.getProperty("line.separator"));       
     1959        out_readme.write(System.getProperty("line.separator")); 
     1960        out_readme.write("Microphone make: n/a" + System.getProperty("line.separator"));         
     1961        out_readme.write("Microphone type:" + microphone + System.getProperty("line.separator"));        
     1962        out_readme.write("Audio card make: unknown" + System.getProperty("line.separator"));     
     1963        out_readme.write("Audio card type: unknown" + System.getProperty("line.separator")); 
     1964        out_readme.write("Audio Recording Software: VoxForge Speech Submission Application" + System.getProperty("line.separator")); 
     1965        out_readme.write("O/S:" + System.getProperty("line.separator"));         
     1966        out_readme.write(System.getProperty("line.separator"));  
    19541967         
    1955         out_readme.write("License Info:");      out_readme.append(System.getProperty("line.separator")); 
    1956         out_readme.append(System.getProperty("line.separator")); 
    1957         out_readme.write("Copyright name: " + copyrightName);out_readme.append(System.getProperty("line.separator"));    
    1958         out_readme.write("Accepted that speech be covered by the GPL license: " + gplAccepted);out_readme.append(System.getProperty("line.separator"));  
     1968        out_readme.write("File Info:" + System.getProperty("line.separator")); 
     1969        out_readme.write(System.getProperty("line.separator")); 
     1970        out_readme.write("File type: " + fileType + System.getProperty("line.separator")); 
     1971        out_readme.write("Sampling Rate: " + samplingRate + System.getProperty("line.separator")); 
     1972        out_readme.write("Sample rate format: " + samplingRateFormat + System.getProperty("line.separator")); 
     1973        out_readme.write("Number of channels: " + numberChannels + System.getProperty("line.separator"));        
     1974        out_readme.write(System.getProperty("line.separator")); 
     1975         
     1976        out_readme.write("License Info:" + System.getProperty("line.separator"));        
     1977        out_readme.write(System.getProperty("line.separator")); 
     1978        out_readme.write("Copyright name: " + copyrightName + System.getProperty("line.separator")); 
     1979        out_readme.write("Accepted that speech be covered by the GPL license: " + gplAccepted + System.getProperty("line.separator")); 
    19591980         
    19601981        out_readme.close();      
     
    19972018int SMALL_LETTERS_BASE_VALUE = 97; 
    19982019// int CAPITAL_LETTERS_BASE_VALUE = 65; 
    1999 StringBuilder randomID = new StringBuilder("");  
     2020StringBuffer randomID = new StringBuffer("");  // required for jvm 1.4.2 
     2021//StringBuilder randomID = new StringBuilder(""); // will not work with JVM 1.4.2  
    20002022for ( int i = 0; randomID.length() < 3; i++ ) 
    20012023{ 
     
    20302052                                u = new UploadManager(archiveFiles, capturePlayback, destinationURL, fileFieldName); 
    20312053                        } 
     2054                        System.err.println("Uploading to " + destinationURL); 
    20322055// !!!!!!                         
    20332056                        u.start(); 
     
    24312454            // Reset the applet 
    24322455            progBar.setValue(0); 
    2433             if(subject != null) { // Will be non-null if passed in as a param - even if blank 
    2434               subjectBox.setEnabled(true); 
    2435             } 
     2456          //  if(subject != null) { // Will be non-null if passed in as a param - even if blank 
     2457          //    subjectBox.setEnabled(true); 
     2458          //  } 
    24362459        } else { 
    24372460//FORDEBUG 
     
    24432466                // If passed in as a param then we don't need to worry about trying to fetch it from the context 
    24442467                System.err.println("CapturePlayback Cookie: " + cookie +":\n");   
    2445                 System.err.println("CapturePlayback Cookie: " + this.cookie +":\n");  
    2446 //      if (cookie != null && !cookie.equals("")) 
    2447 //                      return cookie; 
    2448           cookie = "test"; 
     2468                System.err.println("CapturePlayback Cookie: " + this.cookie +":\n"); 
     2469// !!!!!!                
     2470        if (cookie != null && !cookie.equals("")) 
     2471                        return cookie; 
     2472//        cookie = "test"; 
     2473// !!!!!!!               
    24492474                // Method reads the cookie in from the Browser using the LiveConnect object. 
    24502475                // May also add an option to set the cookie using an applet parameter FIXME! 
  • Trunk/SpeechSubmission/VFSpeechSubmission/java/src/moodlespeex/License.java

    r2256 r2290  
    1313                        + System.getProperty("line.separator"); 
    1414                 
    15                 licenseNotice = "These files are free software: you can redistribute them and/or modify" + System.getProperty("line.separator") 
     15                licenseNotice =  "Copyright (C) <year>  Free Software Foundation" + System.getProperty("line.separator") 
     16                         + System.getProperty("line.separator") 
     17                    + "These files are free software: you can redistribute them and/or modify" + System.getProperty("line.separator") 
    1618                        + "them under the terms of the GNU General Public License as published by" + System.getProperty("line.separator") 
    1719                        + "the Free Software Foundation, either version 3 of the License, or" + System.getProperty("line.separator") 
  • Trunk/SpeechSubmission/VFSpeechSubmission/java/src/moodlespeex/MoodleSpeexRecorderApplet.java

    r2279 r2290  
    7575// !!!!!! 
    7676 
    77         cookie = null;  
     77 //       cookie = null;  
    7878//        getContentPane().add("Center",  
    7979//            theRecorder = new CapturePlayback(subject, fileFieldName, 
     
    162162         
    163163        try { 
    164             // cookie = getParameter("cookie"); 
    165                 cookie = "kenmacleantest"; 
     164// !!!!!!                
     165          cookie = getParameter("cookie"); 
     166 //             cookie = "kenmacleantest"; 
     167// !!!!!!           
    166168                System.err.println("MoodleSpeexRecorderApplet Cookie: " + cookie +":\n");             
    167169        } catch (NullPointerException nullLang){ 
     
    184186        /*  DESTINATION  */ 
    185187        try { 
    186          //    destinationURL = new URL(getParameter("destination")); 
     188            // !!!!!!            
     189                destinationURL = new URL(getParameter("destination")); 
    187190            // Following line is for testing, and to hard code the applet to postlet.com 
    188             // !!!!!! 
    189             destinationURL = new URL("http://localhost:90/httpd/postlet/javaUpload.php"); 
     191 
     192        //    destinationURL = new URL("http://localhost:90/httpd/postlet/javaUpload.php"); 
    190193            // !!!!!! 
    191194        } catch(java.net.MalformedURLException malurlex){ 
  • Trunk/SpeechSubmission/VFSpeechSubmission/java/src/net/sf/postlet/UploadManager.java

    r2245 r2290  
    7979                // Output a message explaining that the URL has failed. 
    8080                // This should stop all the threads! 
     81        System.err.println("urlFailure "); 
     82 
    8183        } 
    8284} 
  • Trunk/SpeechSubmission/VFSpeechSubmission/java/src/org/voxforge/JavaVersionDisplayApplet.java

    r2280 r2290  
    22import java.applet.*; 
    33 import java.awt.*; 
    4  public class JavaVersionDisplayApplet extends Applet 
    5  { private Label m_labVersionVendor;  
    6    public JavaVersionDisplayApplet() //constructor 
    7    { Color colFrameBackground = Color.pink; 
    8      this.setBackground(colFrameBackground); 
    9      m_labVersionVendor = new Label (" Java Version: " + 
     4  
     5public class JavaVersionDisplayApplet extends Applet {  
     6        private Label m_labVersionVendor;  
     7 
     8        public JavaVersionDisplayApplet()  { //constructor 
     9                Color colFrameBackground = Color.lightGray; 
     10        this.setBackground(colFrameBackground); 
     11        m_labVersionVendor = new Label (" Java Version: " + 
    1012                                    System.getProperty("java.version")+ 
    1113                           " from "+System.getProperty("java.vendor")); 
    12      this.add(m_labVersionVendor); 
    13    
     14       this.add(m_labVersionVendor); 
     15      
    1416 } 
  • Trunk/SpeechSubmission/VFSpeechSubmission/server/WebGUI/WebGUI-SpeechSubmissionArticle

    r2283 r2290  
    1 <?php 
    2 setcookie("user", "VoxForge", time()+3600); 
    3 if (isset($_COOKIE["user"])) 
    4   echo "Welcome to the " . $_COOKIE["user"] . " Speech Submissions System" . "!<br />"; 
    5 else 
    6   echo "Welcome guest!<br />"; 
    7 setcookie("user", "VoxForge", time()+3600); 
    8  
    9 ?> 
    10 <?php 
    11  
    12  
    13 $destination = 'http://www.repository.voxforge1.org/SubmitSpeech/javaUploadServer.php'; 
    14 $endpage = 'http://www.repository.voxforge1.org/SubmitSpeech/endpage.html'; 
    15 $width=600; 
    16 $height=200; 
    17 $isforumpost=false; 
    18 $subject=''; 
    19 $filefieldname='userfile'; 
    20 $compressionmode=1; 
    21 $compressionmodes='1,2,3'; 
    22   global $CFG; 
    23 /* The htmlspecialchars() function converts some predefined characters to HTML entities.*/ 
    24 /* $_SERVER is an array containing information such as headers, paths, and script locations. The entries in this array are created by the web server. There is no guarantee that every web server will provide any of these; servers may omit some, or provide others not listed here */ 
    25 /* $_COOKIE An associative array of variables passed to the current script via HTTP cookies. Automatically global in any scope. */ 
    26 /*  $cookie = htmlspecialchars($_SERVER['_COOKIE']); */ 
    27 $cookie = ($_COOKIE["user"]); 
    28 /* print ("</br>ken:$cookie</br>"); */ 
    29  
    30   $code =  <<<ENDHTMLFRAGMENT 
    311<applet name="Speexuploader" width ="800" height ="800" mayscript="mayscript" 
    322      code="moodlespeex/MoodleSpeexRecorderApplet.class" style="border: 1px solid rgb(153,153,153);"> 
    33  <param name="archive"  value="moodlespeex.jar"/> 
     3 <param name="archive"  value="http://www.repository.voxforge1.org/SubmitSpeech/moodlespeex.jar"/> 
    344 <param name="type"  value="application/x-java-applet;version=1.4"/> 
    355 <param name="scriptable"  value="true"/> 
    36 ENDHTMLFRAGMENT; 
    37   $code .=  <<<ENDHTMLFRAGMENT 
    38  <param name="destination" value="$destination"/> 
    39  <param name="filefieldname"  value=" 
    40 ENDHTMLFRAGMENT; 
    41   $code .= htmlspecialchars($filefieldname); 
    42   $code .=  <<<ENDHTMLFRAGMENT 
    43 "/> 
    44  <param name="endpage"  value="$endpage"/> 
    45  <param name="cookie"  value="$cookie"/> 
    46  <param name="compressionmode"  value="$compressionmode"/> 
    47  <param name="compressionmodes"  value="$compressionmodes"/> 
    48  The Moodle Speex audio recorder applet should appear here. Please check that you have Java enabled in your web browser - this is 
    49  required in order to use the audio recorder. 
     6 <param name="destination" value="http://www.repository.voxforge1.org/SubmitSpeech/javaUploadServer.php"/> 
     7 <param name="endpage"  value="http://www.repository.voxforge1.org/SubmitSpeech/endpage.html"/> 
     8 <param name="cookie"  value="VoxForgeTest"/> 
    509 </applet> 
    51 ENDHTMLFRAGMENT; 
    52  
    53  
    54 echo $code; 
    55  
    56 ?> 
  • Trunk/SpeechSubmission/VFSpeechSubmission/server/submitSpeechServerTest.php

    r2284 r2290  
    3030  $code =  <<<ENDHTMLFRAGMENT 
    3131<applet name="Speexuploader" width ="800" height ="800" mayscript="mayscript" 
    32       code="moodlespeex/MoodleSpeexRecorderApplet.class" style="border: 1px solid rgb(153,153,153);"> 
     32      code="moodlespeex/MoodleSpeexRecorderApplet.class" codebase="http://www.repository.voxforge1.org/SubmitSpeech" style="border: 1px solid rgb(153,153,153);"> 
    3333 <param name="archive"  value="moodlespeex.jar"/> 
    3434 <param name="type"  value="application/x-java-applet;version=1.4"/> 
     
    4646 <param name="compressionmode"  value="$compressionmode"/> 
    4747 <param name="compressionmodes"  value="$compressionmodes"/> 
    48  The Moodle Speex audio recorder applet should appear here. Please check that you have Java enabled in your web browser - this is 
     48 The VoxForge Speech Recognition audio recorder applet should appear here. Please check that you have Java enabled in your web browser - this is 
    4949 required in order to use the audio recorder. 
    5050 </applet>