Advertisement
Guest User

Untitled

a guest
Feb 17th, 2015
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.96 KB | None | 0 0
  1. public static void extractFeatures(){
  2.         DataModel dm = new DataModel("C:/Users/Gasper/workspace/cmrlji/features.xml",null);
  3.         Batch batch = new Batch();
  4.         batch.setSettings(512, 0.0, 16000.0, true, false, true, 2);
  5.         //DataModel dm = batch.getDataModel();
  6.         //System.out.println("WTF "+dm);
  7.        
  8.         HashMap<String, Boolean> activated = new HashMap<String, Boolean>();
  9.         activated.put("Spectral Centroid", true);
  10.         activated.put("Spectral Rolloff Point", true);
  11.         activated.put("Spectral Flux", true);
  12.         activated.put("Compactness", true);
  13.        
  14.         HashMap<String, String[]> attributes = new HashMap<String, String[]>();
  15.         /*
  16.         attributes.put("Spectral Centroid", value);
  17.         attributes.put("Spectral Rolloff Point", valueDouble);
  18.         attributes.put("Spectral Flux", value);
  19.         attributes.put("Compactness", value);
  20.         */
  21.        
  22.        
  23.         batch.setFeatures(activated, attributes);
  24.        
  25.         RecordingInfo[][] recording_table = new RecordingInfo[1][1];
  26.         RecordingInfo recording = new RecordingInfo("C:/Users/Gasper/Downloads/beeTEST.wav");
  27.         recording_table[0][0] = recording;
  28.        
  29.         batch.setRecording(new RecordingInfo[]{recording});
  30.        
  31.         int[] windowSize = {512};
  32.         double[] windowOverlap = {0.0};
  33.         double[] sampleRate = {16.0};
  34.         boolean[] normalise = {true};
  35.         boolean[] perWindow = {true};
  36.         boolean[] overall = {false};
  37.         String[] destinationFeatDef = {"C:/Users/Gasper/Desktop/jAudio"};
  38.         String[] destinationFeatValues = {"C:/Users/Gasper/Desktop/jAudio"};
  39.         int[] outputType = {2};
  40.         System.out.println("TEST1");
  41.        
  42.         batch.applySettings(
  43.                 recording_table,
  44.                 windowSize,
  45.                 windowOverlap,
  46.                 sampleRate,
  47.                 normalise,
  48.                 perWindow,
  49.                 overall,
  50.                 destinationFeatDef,
  51.                 destinationFeatValues,
  52.                 outputType
  53.                 );
  54.         System.out.println("TEST2");
  55.         try {
  56.             System.out.println("TEST3");
  57.             batch.execute();
  58.             System.out.println("TEST4");
  59.         } catch (Exception e) {
  60.             System.out.println("We tried boys, but we failed.");
  61.             e.printStackTrace();
  62.         }
  63.        
  64.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement