Commit b9289bf5 authored by Sonia BADENE's avatar Sonia BADENE
Browse files

Initial simple Speech application built using Sphinx-4

parent ca263c0b
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>sbadene</groupId>
<artifactId>reco</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>reco</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>edu.cmu.sphinx</groupId>
<artifactId>sphinx4-core</artifactId>
<version>5prealpha-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>edu.cmu.sphinx</groupId>
<artifactId>sphinx4-data</artifactId>
<version>5prealpha-SNAPSHOT</version>
</dependency>
</dependencies>
<repositories>
<repository>
<id>snapshots-repo</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</project>
\ No newline at end of file
package RecoPack;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import edu.cmu.sphinx.api.Configuration;
import edu.cmu.sphinx.api.SpeechResult;
import edu.cmu.sphinx.api.StreamSpeechRecognizer;
import edu.cmu.sphinx.decoder.adaptation.Stats;
import edu.cmu.sphinx.decoder.adaptation.Transform;
/**
* A simple example that shows how to transcribe a continuous .wav audio file (an
* InputStream as the speech source) that has multiple utterances in it.
* This script split the audio and transcript each segment.
*/
public class Transcriber {
public static void main(String[] args) throws Exception {
Configuration configuration = new Configuration();
File f = null;
File[] paths;
// gen (generated) is the folder where all the output is saved (transcription and audio files for this app)
File gen = new File("./gen");
gen.mkdirs();
File trans = new File("./gen/transcription.txt");
BufferedWriter bw = new BufferedWriter(new FileWriter(trans));
PrintWriter pw = new PrintWriter(bw);
// create new folder for the segmented audio
f = new File("./gen/ResultsWav");
f.mkdirs();
// Load model
System.out.println("# Loading models...");
configuration
.setAcousticModelPath("./data/cmusphinxFR52");
configuration
.setDictionaryPath("./data/LiumLM/words_dict.utf8");
configuration
.setLanguageModelPath("./data/LiumLM/smallFrenchLium.lm.bin");
StreamSpeechRecognizer recognizer = new StreamSpeechRecognizer(configuration);
// Segmenter l'input .wav en plusieurs segments
try
{
Runtime rtime = Runtime.getRuntime();
Process child = rtime.exec("bash ./src/script/split.sh ./data/Wav/39_45_eva_14right.wav ./src/script/segments ./gen/ResultsWav");
InputStream is = child.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
e.printStackTrace();
}
// returns pathnames for files and directory
paths = f.listFiles();
// for each pathname in pathname array
for(File path:paths) {
// prints file and directory paths
System.out.println("## File and directory paths...");
System.out.println(path);
InputStream stream = new FileInputStream(path);
stream.skip(44);
// Simple recognition with generic model
// And Live adaptation to speaker with speaker profiles
// Stats class is used to collect speaker-specific data
Stats stats = recognizer.createStats(1);
System.out.println("Recognition...");
recognizer.startRecognition(stream);
System.out.println("Result running...");
SpeechResult result;
System.out.println("Collecting Speaker-specific data.");
while ((result = recognizer.getResult()) != null) {
stats.collect(result);
}
recognizer.stopRecognition();
// Transform represents the speech profile
Transform transform = stats.createTransform();
recognizer.setTransform(transform);
// Decode again with updated transform
InputStream streamMain = new FileInputStream(path);
streamMain.skip(44);
recognizer.startRecognition(streamMain);
while ((result = recognizer.getResult()) != null) {
System.out.format("Hypothesis: %s\n", result.getHypothesis());
pw.print(path.getName()+" ");
pw.println(result.getHypothesis());
pw.flush();
}
recognizer.stopRecognition();
}
pw.close();
}
}
package RecoPack;
import edu.cmu.sphinx.api.Configuration;
import edu.cmu.sphinx.api.LiveSpeechRecognizer;
import edu.cmu.sphinx.api.SpeechResult;
/**
* LiveSpeechRecognizer uses microphone as the speech source.
*/
public class test {
public static void main(String[] args) throws Exception {
Configuration configuration = new Configuration();
// Load model
System.out.println("# Loading models...");
configuration
.setAcousticModelPath("./data/cmusphinxFR52");
configuration
.setDictionaryPath("./data/LiumLM/words_dict.utf8");
configuration
.setLanguageModelPath("./data/LiumLM/smallFrenchLium.lm.bin");
LiveSpeechRecognizer recognizer = new LiveSpeechRecognizer(configuration);
SpeechResult result=null;
// Start recognition process pruning previously cached data.
// recognizer.startRecognition(true);
// SpeechResult result = recognizer.getResult();
// // Pause recognition process. It can be resumed then with startRecognition(false).
// recognizer.stopRecognition();
System.out.println("Say something in French Language ");
// loop the recognition until the programm exits.
while (true) {
System.out.println("Start speaking. Press Ctrl-C to quit.\n");
result = recognizer.getResult();
if (result != null) {
String resultText = result.getHypothesis();
System.out.println("You said: " + resultText + '\n');
} else {
System.out.println("I can't hear what you said.\n");
}
}
// while ((result = recognizer.getResult()) != null) {
// System.out.format("Hypothesis: %s\n", result.getHypothesis());
// }
// System.exit(0);
}
}
39_45_eva_14_spk-002_Turn-001_seg-0000000 39_45_eva_14 4.919 9.181
39_45_eva_14_spk-002_Turn-001_seg-0000001 39_45_eva_14 0 4.919
39_45_eva_14_spk-002_Turn-002_seg-0000000 39_45_eva_14 956.792 961.583
39_45_eva_14_spk-002_Turn-002_seg-0000001 39_45_eva_14 9.181 14.247
39_45_eva_14_spk-002_Turn-002_seg-0000002 39_45_eva_14 14.247 19.92
39_45_eva_14_spk-002_Turn-002_seg-0000003 39_45_eva_14 19.92 24.262
39_45_eva_14_spk-002_Turn-002_seg-0000004 39_45_eva_14 24.262 29.89
39_45_eva_14_spk-002_Turn-002_seg-0000005 39_45_eva_14 29.89 34.377
39_45_eva_14_spk-002_Turn-002_seg-0000006 39_45_eva_14 34.377 37.952
39_45_eva_14_spk-002_Turn-002_seg-0000007 39_45_eva_14 37.952 44.105
39_45_eva_14_spk-002_Turn-002_seg-0000008 39_45_eva_14 44.105 47.987
39_45_eva_14_spk-002_Turn-002_seg-0000009 39_45_eva_14 47.987 54.515
39_45_eva_14_spk-002_Turn-002_seg-0000010 39_45_eva_14 54.515 58.825
39_45_eva_14_spk-002_Turn-002_seg-0000011 39_45_eva_14 58.825 63.422
39_45_eva_14_spk-002_Turn-002_seg-0000012 39_45_eva_14 63.422 65.343
39_45_eva_14_spk-002_Turn-002_seg-0000013 39_45_eva_14 65.343 70.471
39_45_eva_14_spk-002_Turn-002_seg-0000014 39_45_eva_14 70.471 73.475
39_45_eva_14_spk-002_Turn-002_seg-0000015 39_45_eva_14 73.475 77.305
39_45_eva_14_spk-002_Turn-002_seg-0000016 39_45_eva_14 77.305 81.111
39_45_eva_14_spk-002_Turn-002_seg-0000017 39_45_eva_14 81.111 86.086
39_45_eva_14_spk-002_Turn-002_seg-0000018 39_45_eva_14 86.086 90.735
39_45_eva_14_spk-002_Turn-002_seg-0000019 39_45_eva_14 90.735 95.818
39_45_eva_14_spk-002_Turn-002_seg-0000020 39_45_eva_14 95.818 99.358
39_45_eva_14_spk-002_Turn-002_seg-0000021 39_45_eva_14 99.358 102.708
39_45_eva_14_spk-002_Turn-002_seg-0000022 39_45_eva_14 102.708 107.387
39_45_eva_14_spk-002_Turn-002_seg-0000023 39_45_eva_14 107.387 111.723
39_45_eva_14_spk-002_Turn-002_seg-0000024 39_45_eva_14 111.723 114.488
39_45_eva_14_spk-002_Turn-002_seg-0000025 39_45_eva_14 114.488 117.363
39_45_eva_14_spk-002_Turn-002_seg-0000026 39_45_eva_14 117.363 120.504
39_45_eva_14_spk-002_Turn-002_seg-0000027 39_45_eva_14 120.504 124.152
39_45_eva_14_spk-002_Turn-002_seg-0000028 39_45_eva_14 124.152 127.313
39_45_eva_14_spk-002_Turn-002_seg-0000029 39_45_eva_14 127.313 129.472
39_45_eva_14_spk-002_Turn-002_seg-0000030 39_45_eva_14 129.472 132.986
39_45_eva_14_spk-002_Turn-002_seg-0000031 39_45_eva_14 132.986 137.53
39_45_eva_14_spk-002_Turn-002_seg-0000032 39_45_eva_14 137.53 140.974
39_45_eva_14_spk-002_Turn-002_seg-0000033 39_45_eva_14 140.974 143.003
39_45_eva_14_spk-002_Turn-002_seg-0000034 39_45_eva_14 143.003 146.223
39_45_eva_14_spk-002_Turn-002_seg-0000035 39_45_eva_14 146.223 149.859
39_45_eva_14_spk-002_Turn-002_seg-0000036 39_45_eva_14 149.859 153.74
39_45_eva_14_spk-002_Turn-002_seg-0000037 39_45_eva_14 153.74 154.98
39_45_eva_14_spk-002_Turn-002_seg-0000038 39_45_eva_14 154.98 161.386
39_45_eva_14_spk-002_Turn-002_seg-0000039 39_45_eva_14 161.386 163.577
39_45_eva_14_spk-002_Turn-002_seg-0000040 39_45_eva_14 163.577 166.088
39_45_eva_14_spk-002_Turn-002_seg-0000041 39_45_eva_14 166.088 169.862
39_45_eva_14_spk-002_Turn-002_seg-0000042 39_45_eva_14 169.862 171.982
39_45_eva_14_spk-002_Turn-002_seg-0000043 39_45_eva_14 171.982 174.837
39_45_eva_14_spk-002_Turn-002_seg-0000044 39_45_eva_14 174.837 176.16
39_45_eva_14_spk-002_Turn-002_seg-0000045 39_45_eva_14 176.16 179.398
39_45_eva_14_spk-002_Turn-002_seg-0000046 39_45_eva_14 179.398 182.537
39_45_eva_14_spk-002_Turn-002_seg-0000047 39_45_eva_14 182.537 184.344
39_45_eva_14_spk-002_Turn-002_seg-0000048 39_45_eva_14 184.344 187.442
39_45_eva_14_spk-002_Turn-002_seg-0000049 39_45_eva_14 187.442 190.019
39_45_eva_14_spk-002_Turn-002_seg-0000050 39_45_eva_14 190.019 195.987
39_45_eva_14_spk-002_Turn-002_seg-0000051 39_45_eva_14 195.987 198.881
39_45_eva_14_spk-002_Turn-002_seg-0000052 39_45_eva_14 198.881 200.573
39_45_eva_14_spk-002_Turn-002_seg-0000053 39_45_eva_14 200.573 203.067
39_45_eva_14_spk-002_Turn-002_seg-0000054 39_45_eva_14 203.067 206.35
39_45_eva_14_spk-002_Turn-002_seg-0000055 39_45_eva_14 206.35 210.33
39_45_eva_14_spk-002_Turn-002_seg-0000056 39_45_eva_14 210.33 213.528
39_45_eva_14_spk-002_Turn-002_seg-0000057 39_45_eva_14 213.528 218.703
39_45_eva_14_spk-002_Turn-002_seg-0000058 39_45_eva_14 218.703 222.414
39_45_eva_14_spk-002_Turn-002_seg-0000059 39_45_eva_14 222.414 225.118
39_45_eva_14_spk-002_Turn-002_seg-0000060 39_45_eva_14 225.118 228.136
39_45_eva_14_spk-002_Turn-002_seg-0000061 39_45_eva_14 228.136 233.574
39_45_eva_14_spk-002_Turn-002_seg-0000062 39_45_eva_14 233.574 237.972
39_45_eva_14_spk-002_Turn-002_seg-0000063 39_45_eva_14 237.972 240.98
39_45_eva_14_spk-002_Turn-002_seg-0000064 39_45_eva_14 240.98 244.387
39_45_eva_14_spk-002_Turn-002_seg-0000065 39_45_eva_14 244.387 249.891
39_45_eva_14_spk-002_Turn-002_seg-0000066 39_45_eva_14 249.891 251.984
39_45_eva_14_spk-002_Turn-002_seg-0000067 39_45_eva_14 251.984 254.78
39_45_eva_14_spk-002_Turn-002_seg-0000068 39_45_eva_14 254.78 258.65
39_45_eva_14_spk-002_Turn-002_seg-0000069 39_45_eva_14 258.65 260.779
39_45_eva_14_spk-002_Turn-002_seg-0000070 39_45_eva_14 260.779 265.613
39_45_eva_14_spk-002_Turn-002_seg-0000071 39_45_eva_14 265.613 268.316
39_45_eva_14_spk-002_Turn-002_seg-0000072 39_45_eva_14 268.316 273.599
39_45_eva_14_spk-002_Turn-002_seg-0000073 39_45_eva_14 273.599 276.692
39_45_eva_14_spk-002_Turn-002_seg-0000074 39_45_eva_14 276.692 279.598
39_45_eva_14_spk-002_Turn-002_seg-0000075 39_45_eva_14 279.598 285.072
39_45_eva_14_spk-002_Turn-002_seg-0000076 39_45_eva_14 285.072 289.515
39_45_eva_14_spk-002_Turn-002_seg-0000077 39_45_eva_14 289.515 292.688
39_45_eva_14_spk-002_Turn-002_seg-0000078 39_45_eva_14 292.688 294.539
39_45_eva_14_spk-002_Turn-002_seg-0000079 39_45_eva_14 294.539 297.792
39_45_eva_14_spk-002_Turn-002_seg-0000080 39_45_eva_14 297.792 302.029
39_45_eva_14_spk-002_Turn-002_seg-0000081 39_45_eva_14 302.029 304.972
39_45_eva_14_spk-002_Turn-002_seg-0000082 39_45_eva_14 304.972 308.639
39_45_eva_14_spk-002_Turn-002_seg-0000083 39_45_eva_14 308.639 311.964
39_45_eva_14_spk-002_Turn-002_seg-0000084 39_45_eva_14 311.964 317.52
39_45_eva_14_spk-002_Turn-002_seg-0000085 39_45_eva_14 317.52 320.954
39_45_eva_14_spk-002_Turn-002_seg-0000086 39_45_eva_14 320.954 323.436
39_45_eva_14_spk-002_Turn-002_seg-0000087 39_45_eva_14 323.436 327.558
39_45_eva_14_spk-002_Turn-002_seg-0000088 39_45_eva_14 327.558 329.869
39_45_eva_14_spk-002_Turn-002_seg-0000089 39_45_eva_14 329.869 334.338
39_45_eva_14_spk-002_Turn-002_seg-0000090 39_45_eva_14 334.338 338.314
39_45_eva_14_spk-002_Turn-002_seg-0000091 39_45_eva_14 338.314 341.497
39_45_eva_14_spk-002_Turn-002_seg-0000092 39_45_eva_14 341.497 346.079
39_45_eva_14_spk-002_Turn-002_seg-0000093 39_45_eva_14 346.079 348.943
39_45_eva_14_spk-002_Turn-002_seg-0000094 39_45_eva_14 348.943 351.423
39_45_eva_14_spk-002_Turn-002_seg-0000095 39_45_eva_14 351.423 356.645
39_45_eva_14_spk-002_Turn-002_seg-0000096 39_45_eva_14 356.645 359.457
39_45_eva_14_spk-002_Turn-002_seg-0000097 39_45_eva_14 359.457 361.897
39_45_eva_14_spk-002_Turn-002_seg-0000098 39_45_eva_14 361.897 364.357
39_45_eva_14_spk-002_Turn-002_seg-0000099 39_45_eva_14 364.357 367.205
39_45_eva_14_spk-002_Turn-002_seg-0000100 39_45_eva_14 367.205 369.851
39_45_eva_14_spk-002_Turn-002_seg-0000101 39_45_eva_14 369.851 373.306
39_45_eva_14_spk-002_Turn-002_seg-0000102 39_45_eva_14 373.306 375.458
39_45_eva_14_spk-002_Turn-002_seg-0000103 39_45_eva_14 375.458 378.923
39_45_eva_14_spk-002_Turn-002_seg-0000104 39_45_eva_14 378.923 381.467
39_45_eva_14_spk-002_Turn-002_seg-0000105 39_45_eva_14 381.467 384.233
39_45_eva_14_spk-002_Turn-002_seg-0000106 39_45_eva_14 384.233 388.789
39_45_eva_14_spk-002_Turn-002_seg-0000107 39_45_eva_14 388.789 391.816
39_45_eva_14_spk-002_Turn-002_seg-0000108 39_45_eva_14 391.816 396.093
39_45_eva_14_spk-002_Turn-002_seg-0000109 39_45_eva_14 396.093 397.877
39_45_eva_14_spk-002_Turn-002_seg-0000110 39_45_eva_14 397.877 400.331
39_45_eva_14_spk-002_Turn-002_seg-0000111 39_45_eva_14 400.331 404.885
39_45_eva_14_spk-002_Turn-002_seg-0000112 39_45_eva_14 404.885 408.404
39_45_eva_14_spk-002_Turn-002_seg-0000113 39_45_eva_14 408.404 410.521
39_45_eva_14_spk-002_Turn-002_seg-0000114 39_45_eva_14 410.521 413.291
39_45_eva_14_spk-002_Turn-002_seg-0000115 39_45_eva_14 413.291 416.808
39_45_eva_14_spk-002_Turn-002_seg-0000116 39_45_eva_14 416.808 420.042
39_45_eva_14_spk-002_Turn-002_seg-0000117 39_45_eva_14 420.042 422.408
39_45_eva_14_spk-002_Turn-002_seg-0000118 39_45_eva_14 422.408 425.87
39_45_eva_14_spk-002_Turn-002_seg-0000119 39_45_eva_14 425.87 431.938
39_45_eva_14_spk-002_Turn-002_seg-0000120 39_45_eva_14 431.938 435.662
39_45_eva_14_spk-002_Turn-002_seg-0000121 39_45_eva_14 435.662 438.062
39_45_eva_14_spk-002_Turn-002_seg-0000122 39_45_eva_14 438.062 440.265
39_45_eva_14_spk-002_Turn-002_seg-0000123 39_45_eva_14 440.265 444.26
39_45_eva_14_spk-002_Turn-002_seg-0000124 39_45_eva_14 444.26 446.748
39_45_eva_14_spk-002_Turn-002_seg-0000125 39_45_eva_14 446.748 449.149
39_45_eva_14_spk-002_Turn-002_seg-0000126 39_45_eva_14 449.149 453.349
39_45_eva_14_spk-002_Turn-002_seg-0000127 39_45_eva_14 453.349 456.974
39_45_eva_14_spk-002_Turn-002_seg-0000128 39_45_eva_14 456.974 462.483
39_45_eva_14_spk-002_Turn-002_seg-0000129 39_45_eva_14 462.483 465.138
39_45_eva_14_spk-002_Turn-002_seg-0000130 39_45_eva_14 465.138 468.593
39_45_eva_14_spk-002_Turn-002_seg-0000131 39_45_eva_14 468.593 470.634
39_45_eva_14_spk-002_Turn-002_seg-0000132 39_45_eva_14 470.634 474.908
39_45_eva_14_spk-002_Turn-002_seg-0000133 39_45_eva_14 474.908 479.502
39_45_eva_14_spk-002_Turn-002_seg-0000134 39_45_eva_14 479.502 483.565
39_45_eva_14_spk-002_Turn-002_seg-0000135 39_45_eva_14 483.565 489.47
39_45_eva_14_spk-002_Turn-002_seg-0000136 39_45_eva_14 489.47 494.023
39_45_eva_14_spk-002_Turn-002_seg-0000137 39_45_eva_14 494.023 499.076
39_45_eva_14_spk-002_Turn-002_seg-0000138 39_45_eva_14 499.076 505.549
39_45_eva_14_spk-002_Turn-002_seg-0000139 39_45_eva_14 505.549 511.407
39_45_eva_14_spk-002_Turn-002_seg-0000140 39_45_eva_14 511.407 513.784
39_45_eva_14_spk-002_Turn-002_seg-0000141 39_45_eva_14 513.784 516.581
39_45_eva_14_spk-002_Turn-002_seg-0000142 39_45_eva_14 516.581 519.558
39_45_eva_14_spk-002_Turn-002_seg-0000143 39_45_eva_14 519.558 522.209
39_45_eva_14_spk-002_Turn-002_seg-0000144 39_45_eva_14 522.209 527.664
39_45_eva_14_spk-002_Turn-002_seg-0000145 39_45_eva_14 527.664 529.962
39_45_eva_14_spk-002_Turn-002_seg-0000146 39_45_eva_14 529.962 533.278
39_45_eva_14_spk-002_Turn-002_seg-0000147 39_45_eva_14 533.278 536.271
39_45_eva_14_spk-002_Turn-002_seg-0000148 39_45_eva_14 536.271 538.567
39_45_eva_14_spk-002_Turn-002_seg-0000149 39_45_eva_14 538.567 541.375
39_45_eva_14_spk-002_Turn-002_seg-0000150 39_45_eva_14 541.375 543.564
39_45_eva_14_spk-002_Turn-002_seg-0000151 39_45_eva_14 543.564 549.796
39_45_eva_14_spk-002_Turn-002_seg-0000152 39_45_eva_14 549.796 554.185
39_45_eva_14_spk-002_Turn-002_seg-0000153 39_45_eva_14 554.185 558.813
39_45_eva_14_spk-002_Turn-002_seg-0000154 39_45_eva_14 558.813 564.683
39_45_eva_14_spk-002_Turn-002_seg-0000155 39_45_eva_14 564.683 570.103
39_45_eva_14_spk-002_Turn-002_seg-0000156 39_45_eva_14 570.103 573.425
39_45_eva_14_spk-002_Turn-002_seg-0000157 39_45_eva_14 573.425 577.0
39_45_eva_14_spk-002_Turn-002_seg-0000158 39_45_eva_14 577.0 580.866
39_45_eva_14_spk-002_Turn-002_seg-0000159 39_45_eva_14 580.866 583.652
39_45_eva_14_spk-002_Turn-002_seg-0000160 39_45_eva_14 583.652 585.848
39_45_eva_14_spk-002_Turn-002_seg-0000161 39_45_eva_14 585.848 591.349
39_45_eva_14_spk-002_Turn-002_seg-0000162 39_45_eva_14 591.349 594.031
39_45_eva_14_spk-002_Turn-002_seg-0000163 39_45_eva_14 594.031 597.235
39_45_eva_14_spk-002_Turn-002_seg-0000164 39_45_eva_14 597.235 599.968
39_45_eva_14_spk-002_Turn-002_seg-0000165 39_45_eva_14 599.968 602.464
39_45_eva_14_spk-002_Turn-002_seg-0000166 39_45_eva_14 602.464 606.104
39_45_eva_14_spk-002_Turn-002_seg-0000167 39_45_eva_14 606.104 610.035
39_45_eva_14_spk-002_Turn-002_seg-0000168 39_45_eva_14 610.035 615.375
39_45_eva_14_spk-002_Turn-002_seg-0000169 39_45_eva_14 615.375 619.611
39_45_eva_14_spk-002_Turn-002_seg-0000170 39_45_eva_14 619.611 623.067
39_45_eva_14_spk-002_Turn-002_seg-0000171 39_45_eva_14 623.067 624.968
39_45_eva_14_spk-002_Turn-002_seg-0000172 39_45_eva_14 624.968 627.72
39_45_eva_14_spk-002_Turn-002_seg-0000173 39_45_eva_14 627.72 633.604
39_45_eva_14_spk-002_Turn-002_seg-0000174 39_45_eva_14 633.604 641.995
39_45_eva_14_spk-002_Turn-002_seg-0000175 39_45_eva_14 641.995 647.779
39_45_eva_14_spk-002_Turn-002_seg-0000176 39_45_eva_14 647.779 652.226
39_45_eva_14_spk-002_Turn-002_seg-0000177 39_45_eva_14 652.226 658.15
39_45_eva_14_spk-002_Turn-002_seg-0000178 39_45_eva_14 658.15 662.314
39_45_eva_14_spk-002_Turn-002_seg-0000179 39_45_eva_14 662.314 665.996
39_45_eva_14_spk-002_Turn-002_seg-0000180 39_45_eva_14 665.996 670.234
39_45_eva_14_spk-002_Turn-002_seg-0000181 39_45_eva_14 670.234 674.533
39_45_eva_14_spk-002_Turn-002_seg-0000182 39_45_eva_14 674.533 677.271
39_45_eva_14_spk-002_Turn-002_seg-0000183 39_45_eva_14 677.271 681.154
39_45_eva_14_spk-002_Turn-002_seg-0000184 39_45_eva_14 681.154 685.631
39_45_eva_14_spk-002_Turn-002_seg-0000185 39_45_eva_14 685.631 687.916
39_45_eva_14_spk-002_Turn-002_seg-0000186 39_45_eva_14 687.916 690.065
39_45_eva_14_spk-002_Turn-002_seg-0000187 39_45_eva_14 690.065 695.173
39_45_eva_14_spk-002_Turn-002_seg-0000188 39_45_eva_14 695.173 698.232
39_45_eva_14_spk-002_Turn-002_seg-0000189 39_45_eva_14 698.232 704.012
39_45_eva_14_spk-002_Turn-002_seg-0000190 39_45_eva_14 704.012 711.442
39_45_eva_14_spk-002_Turn-002_seg-0000191 39_45_eva_14 711.442 714.218
39_45_eva_14_spk-002_Turn-002_seg-0000192 39_45_eva_14 714.218 718.432
39_45_eva_14_spk-002_Turn-002_seg-0000193 39_45_eva_14 718.432 722.952
39_45_eva_14_spk-002_Turn-002_seg-0000194 39_45_eva_14 722.952 725.232
39_45_eva_14_spk-002_Turn-002_seg-0000195 39_45_eva_14 725.232 727.411
39_45_eva_14_spk-002_Turn-002_seg-0000196 39_45_eva_14 727.411 732.168
39_45_eva_14_spk-002_Turn-002_seg-0000197 39_45_eva_14 732.168 735.201
39_45_eva_14_spk-002_Turn-002_seg-0000198 39_45_eva_14 735.201 739.661
39_45_eva_14_spk-002_Turn-002_seg-0000199 39_45_eva_14 739.661 743.759
39_45_eva_14_spk-002_Turn-002_seg-0000200 39_45_eva_14 743.759 746.272
39_45_eva_14_spk-002_Turn-002_seg-0000201 39_45_eva_14 746.272 749.461
39_45_eva_14_spk-002_Turn-002_seg-0000202 39_45_eva_14 749.461 752.797
39_45_eva_14_spk-002_Turn-002_seg-0000203 39_45_eva_14 752.797 755.178
39_45_eva_14_spk-002_Turn-002_seg-0000204 39_45_eva_14 755.178 757.165
39_45_eva_14_spk-002_Turn-002_seg-0000205 39_45_eva_14 757.165 759.012
39_45_eva_14_spk-002_Turn-002_seg-0000206 39_45_eva_14 759.012 763.039
39_45_eva_14_spk-002_Turn-002_seg-0000207 39_45_eva_14 763.039 767.077
39_45_eva_14_spk-002_Turn-002_seg-0000208 39_45_eva_14 767.077 771.307
39_45_eva_14_spk-002_Turn-002_seg-0000209 39_45_eva_14 771.307 774.439
39_45_eva_14_spk-002_Turn-002_seg-0000210 39_45_eva_14 774.439 779.081
39_45_eva_14_spk-002_Turn-002_seg-0000211 39_45_eva_14 779.081 784.332
39_45_eva_14_spk-002_Turn-002_seg-0000212 39_45_eva_14 784.332 789.113
39_45_eva_14_spk-002_Turn-002_seg-0000213 39_45_eva_14 789.113 792.15
39_45_eva_14_spk-002_Turn-002_seg-0000214 39_45_eva_14 792.15 795.185
39_45_eva_14_spk-002_Turn-002_seg-0000215 39_45_eva_14 795.185 797.452
39_45_eva_14_spk-002_Turn-002_seg-0000216 39_45_eva_14 797.452 800.221
39_45_eva_14_spk-002_Turn-002_seg-0000217 39_45_eva_14 800.221 803.519
39_45_eva_14_spk-002_Turn-002_seg-0000218 39_45_eva_14 803.519 806.149
39_45_eva_14_spk-002_Turn-002_seg-0000219 39_45_eva_14 806.149 810.389
39_45_eva_14_spk-002_Turn-002_seg-0000220 39_45_eva_14 810.389 812.869
39_45_eva_14_spk-002_Turn-002_seg-0000221 39_45_eva_14 812.869 817.976
39_45_eva_14_spk-002_Turn-002_seg-0000222 39_45_eva_14 817.976 821.308
39_45_eva_14_spk-002_Turn-002_seg-0000223 39_45_eva_14 821.308 824.073
39_45_eva_14_spk-002_Turn-002_seg-0000224 39_45_eva_14 824.073 827.226
39_45_eva_14_spk-002_Turn-002_seg-0000225 39_45_eva_14 827.226 831.637
39_45_eva_14_spk-002_Turn-002_seg-0000226 39_45_eva_14 831.637 837.153
39_45_eva_14_spk-002_Turn-002_seg-0000227 39_45_eva_14 837.153 841.431
39_45_eva_14_spk-002_Turn-002_seg-0000228 39_45_eva_14 841.431 844.129
39_45_eva_14_spk-002_Turn-002_seg-0000229 39_45_eva_14 844.129 847.571
39_45_eva_14_spk-002_Turn-002_seg-0000230 39_45_eva_14 847.571 850.613
39_45_eva_14_spk-002_Turn-002_seg-0000231 39_45_eva_14 850.613 853.308
39_45_eva_14_spk-002_Turn-002_seg-0000232 39_45_eva_14 853.308 856.084
39_45_eva_14_spk-002_Turn-002_seg-0000233 39_45_eva_14 856.084 858.737
39_45_eva_14_spk-002_Turn-002_seg-0000234 39_45_eva_14 858.737 862.393
39_45_eva_14_spk-002_Turn-002_seg-0000235 39_45_eva_14 862.393 868.101
39_45_eva_14_spk-002_Turn-002_seg-0000236 39_45_eva_14 868.101 870.877
39_45_eva_14_spk-002_Turn-002_seg-0000237 39_45_eva_14 870.877 873.193
39_45_eva_14_spk-002_Turn-002_seg-0000238 39_45_eva_14 873.193 877.419
39_45_eva_14_spk-002_Turn-002_seg-0000239 39_45_eva_14 877.419 880.693
39_45_eva_14_spk-002_Turn-002_seg-0000240 39_45_eva_14 880.693 884.49
39_45_eva_14_spk-002_Turn-002_seg-0000241 39_45_eva_14 884.49 887.376
39_45_eva_14_spk-002_Turn-002_seg-0000242 39_45_eva_14 887.376 892.915
39_45_eva_14_spk-002_Turn-002_seg-0000243 39_45_eva_14 892.915 896.064
39_45_eva_14_spk-002_Turn-002_seg-0000244 39_45_eva_14 896.064 899.575
39_45_eva_14_spk-002_Turn-002_seg-0000245 39_45_eva_14 899.575 901.165
39_45_eva_14_spk-002_Turn-002_seg-0000246 39_45_eva_14 901.165 903.112
39_45_eva_14_spk-002_Turn-002_seg-0000247 39_45_eva_14 903.112 906.667
39_45_eva_14_spk-002_Turn-002_seg-0000248 39_45_eva_14 906.667 910.524
39_45_eva_14_spk-002_Turn-002_seg-0000249 39_45_eva_14 910.524 915.254
39_45_eva_14_spk-002_Turn-002_seg-0000250 39_45_eva_14 915.254 918.537
39_45_eva_14_spk-002_Turn-002_seg-0000251 39_45_eva_14 918.537 923.952
39_45_eva_14_spk-002_Turn-002_seg-0000252 39_45_eva_14 923.952 928.926
39_45_eva_14_spk-002_Turn-002_seg-0000253 39_45_eva_14 928.926 933.921
39_45_eva_14_spk-002_Turn-002_seg-0000254 39_45_eva_14 933.921 940.209
39_45_eva_14_spk-002_Turn-002_seg-0000255 39_45_eva_14 940.209 943.456
39_45_eva_14_spk-002_Turn-002_seg-0000256 39_45_eva_14 943.456 947.433
39_45_eva_14_spk-002_Turn-002_seg-0000257 39_45_eva_14 947.433 949.312
39_45_eva_14_spk-002_Turn-002_seg-0000258 39_45_eva_14 949.312 952.807
39_45_eva_14_spk-002_Turn-002_seg-0000259 39_45_eva_14 952.807 956.792
39_45_eva_14_spk-002_Turn-004_seg-0000001 39_45_eva_14 962.475 964.209
39_45_eva_14_spk-003_Turn-003_seg-0000000 39_45_eva_14 961.583 962.475
#!/bin/bash
# wav de 15 min 15*60 = 900s, chaque tram 10sec ===> 90 segments
#for i in $(seq 1 90); do
#ffmpeg -ss $((($i-1) * 10)) -t 10 -i a.wav split_debat/deb_seg$i.wav
# we assume that audio_file is 16k mono
#done
audio_file=$1
rep=$3
if [ ! -d $rep ]; then
mkdir -p $rec
fi
#ffmpeg -i $audio_file -ar 16000 -ac 1 a.wav
i=1
while read -r line
do
# echo $line
nb_seg=$(printf "%03d" $i)
deb_seg=`echo $line | awk '{print $3}'`
name_seg=`echo $line | awk '{print $1}'`
duration_seg=`echo $line | awk '{print $4-$3}'`
if ((`bc <<< "$duration_seg<10.0"`)); then
sox $audio_file -t wav $rep/$name_seg trim $deb_seg 00:$duration_seg
else
echo "le fichier dépasse 10sec"
echo $name_seg
echo $duration_seg
echo "============="
fi
# if [ "$i" -eq "50" ]; then
# exit;
# fi
i=$(($i+1))
done < $2
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment