Skip to content

Commit 5c02ac6

Browse files
committed
Tools
1 parent 5c5886f commit 5c02ac6

File tree

6 files changed

+85
-25
lines changed

6 files changed

+85
-25
lines changed

examples/audio-csv/audio-csv.ino

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
2+
/**
3+
* @file audio-csv.ino
4+
* @author Phil Schatzmann
5+
* @brief We generate the CSV output that can be used as input to the provided tools
6+
* @version 0.1
7+
* @date 2022-02-19
8+
*
9+
* @copyright Copyright (c) 2022
10+
*
11+
*/
12+
#include "SimpleTTS.h"
13+
14+
NumberToText ntt;
15+
TimeToText ttt;
16+
17+
void setup() {
18+
Serial.begin(115200);
19+
Serial.println("Name, Text");
20+
ntt.printCSV(Serial);
21+
ttt.printCSV(Serial);
22+
}
23+
24+
void loop(){
25+
26+
}

src/AudioDictionarySD.h

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -97,19 +97,6 @@ class AudioDictionarySD : public AudioDictionaryBase {
9797
return nullptr;
9898
}
9999

100-
// Creates all missing audio recording files for the indicated source
101-
void printCSV(SimpleTTSBase &source, const char *url, const char *mime) {
102-
auto texts = source.allTexts();
103-
Serial.println();
104-
Serial.println("Audio Data:");
105-
for (auto txt : texts) {
106-
Serial.print(txt);
107-
Serial.print(", ");
108-
Serial.println(getFileWithPath(txt));
109-
}
110-
Serial.println();
111-
}
112-
113100
protected:
114101
audio_tools::StrExt url_with_text;
115102
AudioFile file;

src/SimpleTTSBase.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@ class SimpleTTSBase {
2121
reference = ref;
2222
}
2323

24+
// Creates all missing audio recording files for the indicated source
25+
void printCSV(Print &out) {
26+
for (auto txt : allTexts()) {
27+
if (txt!=nullptr && strlen(txt)>0){
28+
out.print(txt);
29+
out.print(", ");
30+
StrExt str = txt;
31+
str.toLowerCase(); // convert txt to lowercase
32+
out.println(str.c_str());
33+
}
34+
}
35+
}
36+
2437
protected:
2538
void (*callback)(audio_tools::Vector<const char*> word, void* ref) = nullptr;
2639
void* reference = nullptr;

src/TimeToText.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,6 @@ class TimeToText : public SimpleTTSBase {
4646
for (int j = 0; j < 10; j++) {
4747
add(j);
4848
}
49-
// add all numbers
50-
addAll(ntt.allTexts());
51-
52-
// provide result to callback
53-
if (callback) {
54-
callback(result, reference);
55-
}
5649
return result;
5750
}
5851

File renamed without changes.

tools/audio.csv

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
1-
Name,Text
2-
one,one
3-
two,two
4-
@menu1,This is menu 1
5-
@menu2,This is menu 2
1+
Name, Text
2+
ZERO, zero
3+
ONE, one
4+
TWO, two
5+
THREE, three
6+
FOUR, four
7+
FIVE, five
8+
SIX, six
9+
SEVEN, seven
10+
EIGHT, eight
11+
NINE, nine
12+
TEN, ten
13+
ELEVEN, eleven
14+
TWELVE, twelve
15+
THIRTEEN, thirteen
16+
FOURTEEN, fourteen
17+
FIFTEEN, fifteen
18+
SIXTEEN, sixteen
19+
SEVENTEEN, seventeen
20+
EIGHTTEEN, eightteen
21+
NINETEEN, nineteen
22+
TEN, ten
23+
TWENTY, twenty
24+
THIRTY, thirty
25+
FORTY, forty
26+
FIFTY, fifty
27+
SIXTY, sixty
28+
SEVENTY, seventy
29+
EIGHTY, eighty
30+
NINETY, ninety
31+
HUNDRED, hundred
32+
THOUSAND, thousand
33+
MILLION, million
34+
AND, and
35+
DOT, dot
36+
MINUS, minus
37+
ITS, its
38+
NOON, noon
39+
MIDNIGHT, midnight
40+
OCLOCK, oclock
41+
TO, to
42+
PAST, past
43+
AM, am
44+
PM, pm
45+
HALF, half
46+
QUARTER, quarter

0 commit comments

Comments
 (0)