Skip to content

Commit

Permalink
Finish adding Flite Text-to-sppech support
Browse files Browse the repository at this point in the history
  • Loading branch information
nostar committed Nov 21, 2021
1 parent 27284d9 commit b6bff5c
Show file tree
Hide file tree
Showing 16 changed files with 206 additions and 89 deletions.
149 changes: 75 additions & 74 deletions DroidStar.pro
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ win32:LIBS += -L/mnt/data/src/mxe/usr/lib64
win32:QMAKE_LFLAGS += -static
QMAKE_LFLAGS_WINDOWS += --enable-stdcall-fixup
RC_ICONS = images/droidstar.ico
ICON = images/droidstar.icns
macx:QT += serialport
macx::INCLUDEPATH += /usr/local/include
macx:LIBS += -L/usr/local/lib -framework AVFoundation
Expand All @@ -24,80 +25,6 @@ DEFINES += VERSION_NUMBER=\"\\\"$${VERSION_BUILD}\\\"\"
DEFINES += QT_DEPRECATED_WARNINGS
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
#DEFINES += USE_FLITE
ICON = images/droidstar.icns

SOURCES += \
CRCenc.cpp \
DMRData.cpp \
Golay24128.cpp \
M17Convolution.cpp \
SHA256.cpp \
YSFConvolution.cpp \
YSFFICH.cpp \
androidserialport.cpp \
audioengine.cpp \
cbptc19696.cpp \
cgolay2087.cpp \
chamming.cpp \
codec.cpp \
codec2/codebooks.cpp \
codec2/codec2.cpp \
codec2/kiss_fft.cpp \
codec2/lpc.cpp \
codec2/nlp.cpp \
codec2/pack.cpp \
codec2/qbase.cpp \
codec2/quantise.cpp \
crs129.cpp \
dcscodec.cpp \
dmrcodec.cpp \
droidstar.cpp \
httpmanager.cpp \
iaxcodec.cpp \
m17codec.cpp \
main.cpp \
nxdncodec.cpp \
p25codec.cpp \
refcodec.cpp \
serialambe.cpp \
serialmodem.cpp \
xrfcodec.cpp \
ysfcodec.cpp
macx:OBJECTIVE_SOURCES += micpermission.mm
ios:OBJECTIVE_SOURCES += micpermission.mm
RESOURCES += qml.qrc

QML_IMPORT_PATH =
QML_DESIGNER_IMPORT_PATH =

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

DISTFILES += \
android/AndroidManifest.xml \
android/build.gradle \
android/gradle/wrapper/gradle-wrapper.jar \
android/gradle/wrapper/gradle-wrapper.properties \
android/gradlew \
android/gradlew.bat \
android/res/values/libs.xml \
images/log.png

contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
LIBS += -L$$(HOME)/Android/local/lib
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
OTHER_FILES += android/src
}

contains(ANDROID_TARGET_ARCH,arm64-v8a) {
LIBS += -L$$(HOME)/Android/local/lib64
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
OTHER_FILES += android/src
}

ANDROID_ABIS = armeabi-v7a arm64-v8a

HEADERS += \
CRCenc.h \
Expand Down Expand Up @@ -142,6 +69,80 @@ HEADERS += \
ysfcodec.h
macx:HEADERS += micpermission.h

SOURCES += \
CRCenc.cpp \
DMRData.cpp \
Golay24128.cpp \
M17Convolution.cpp \
SHA256.cpp \
YSFConvolution.cpp \
YSFFICH.cpp \
androidserialport.cpp \
audioengine.cpp \
cbptc19696.cpp \
cgolay2087.cpp \
chamming.cpp \
codec.cpp \
codec2/codebooks.cpp \
codec2/codec2.cpp \
codec2/kiss_fft.cpp \
codec2/lpc.cpp \
codec2/nlp.cpp \
codec2/pack.cpp \
codec2/qbase.cpp \
codec2/quantise.cpp \
crs129.cpp \
dcscodec.cpp \
dmrcodec.cpp \
droidstar.cpp \
httpmanager.cpp \
iaxcodec.cpp \
m17codec.cpp \
main.cpp \
nxdncodec.cpp \
p25codec.cpp \
refcodec.cpp \
serialambe.cpp \
serialmodem.cpp \
xrfcodec.cpp \
ysfcodec.cpp

macx:OBJECTIVE_SOURCES += micpermission.mm
ios:OBJECTIVE_SOURCES += micpermission.mm
RESOURCES += qml.qrc

QML_IMPORT_PATH =
QML_DESIGNER_IMPORT_PATH =

# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

DISTFILES += \
android/AndroidManifest.xml \
android/build.gradle \
android/gradle/wrapper/gradle-wrapper.jar \
android/gradle/wrapper/gradle-wrapper.properties \
android/gradlew \
android/gradlew.bat \
android/res/values/libs.xml \
images/log.png

contains(ANDROID_TARGET_ARCH,armeabi-v7a) {
LIBS += -L$$(HOME)/Android/local/lib
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
OTHER_FILES += android/src
}

contains(ANDROID_TARGET_ARCH,arm64-v8a) {
LIBS += -L$$(HOME)/Android/local/lib64
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
OTHER_FILES += android/src
}

ANDROID_ABIS = armeabi-v7a arm64-v8a

contains(DEFINES, USE_FLITE){
LIBS += -lflite_cmu_us_slt -lflite_cmu_us_kal16 -lflite_cmu_us_awb -lflite_cmu_us_rms -lflite_usenglish -lflite_cmulex -lflite -lasound
}
Expand Down
86 changes: 83 additions & 3 deletions MainTab.qml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,25 @@ import QtQuick.Controls 2.3

Item {
id: mainTab
property int rows: 18;
//property int rows: 18;
//property bool tts: false;
property int rows: {
if(USE_FLITE){
rows = 20;
}
else{
rows = 18;
}
}
property bool tts: {
if(USE_FLITE){
tts = true;
}
else{
tts = false;
}
}

onWidthChanged:{
if(_comboMode.currentText == "DMR"){
_comboMode.width = (mainTab.width / 5) - 5;
Expand Down Expand Up @@ -616,7 +634,69 @@ Item {
border.width: 1
radius: 5
}

ButtonGroup {
id: ttsvoicegroup
onClicked: {
droidstar.tts_changed(button.text);
}
}
CheckBox {
id: mic
visible: tts ? true : false;
x: 5
y: (parent.height / rows + 1) * 15;
height: 25
spacing: 1
text: qsTr("Mic")
checked: true
ButtonGroup.group: ttsvoicegroup
}
CheckBox {
id: tts1
visible: tts ? true : false;
x: parent.width / 4
y: (parent.height / rows + 1) * 15;
height: 25
spacing: 1
text: qsTr("TTS1")
ButtonGroup.group: ttsvoicegroup
}
CheckBox {
id: tts2
visible: tts ? true : false;
x: parent.width * 2 / 4
y: (parent.height / rows + 1) * 15;
height: 25
spacing: 1
text: qsTr("TTS2")
checked: true
ButtonGroup.group: ttsvoicegroup
}
CheckBox {
id: tts3
visible: tts ? true : false;
x: parent.width * 3 / 4
y: (parent.height / rows + 1) * 15;
height: 25
spacing: 1
text: qsTr("TTS3")
ButtonGroup.group: ttsvoicegroup
}
TextField {
id: _ttstxtedit
visible: tts ? true : false;
x: 5
y: (parent.height / rows + 1) * 16;
width: parent.width - 10
height: parent.height / rows
font.pixelSize: parent.height / 35
selectByMouse: true
inputMethodHints: "ImhPreferNumbers"
text: qsTr("")
onEditingFinished: {
droidstar.tts_text_changed(_ttstxtedit.text)
}
}
Button {
Timer {
id: _txtimer
Expand Down Expand Up @@ -649,7 +729,7 @@ Item {
}
}
x: 10
y: (parent.height / rows + 1) * 15;
y: (parent.height / rows + 1) * ( tts ? 17 : 15);
//y: parent.height - ((parent.height / 5) + 5);
width: parent.width - 20
height: parent.height - y - 10
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ Port: UDP port of node, usually 4569.
Add DTMF commands like \*3node, \*1node, \*70, etc in the IAX DTMF box and hit send to send the DTMF string. The asterisk (*) character is already added on the Droidstar app, so only input the numeric portion of the command (70 instead of *70, etc). Details on various commands can be found at the AllStar wiki and others.

# General building instructions
This software is written primarily in C++ on Linux and requires Qt5 >= Qt5.15, and natually the devel packages to build. Java, QML (Javascript based), and C# code is also used where necessary. The preffered way to obtain Qt 5.15 is to use the Qt open source online installer from the Qt website. Run this installer as a user (not root) to keep the Qt installation separate from your system libs. Select the option as shown in this pic https://imgur.com/i0WuFCY which will install everything under ~/Qt.
This software is written primarily in C++ on Linux and requires Qt5 >= Qt5.15, and natually the devel packages to build. Java, QML (Javascript based), and C# code is also used where necessary. The preferred way to obtain Qt 5.15 is to use the Qt open source online installer from the Qt website. Run this installer as a user (not root) to keep the Qt installation separate from your system libs. Select the option as shown in this pic https://imgur.com/i0WuFCY which will install everything under ~/Qt.

## Note for building on Raspbian/RaspiOS
The Qt online installer does not support RPi, but fortunately there is a great Qt 5.15.2 installer for RaspiOS:
Expand Down
2 changes: 1 addition & 1 deletion android/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0"?>
<manifest package="org.dudetronics.droidstar" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="60" android:installLocation="auto">
<manifest package="org.dudetronics.droidstar" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="-- %%INSERT_VERSION_NAME%% --" android:versionCode="61" android:installLocation="auto">
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="30"/>

<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Expand Down
1 change: 0 additions & 1 deletion dcscodec.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ private slots:
void transmit();
void format_callsign(QString &s);
void hostname_lookup(QHostInfo i);
void input_src_changed(int id, QString t) { m_ttsid = id; m_ttstext = t; }
void module_changed(int m) { m_module = 0x41 + m; m_modeinfo.streamid = 0; }
void usrtxt_changed(QString t) { m_txusrtxt = t; }
void send_frame(uint8_t *);
Expand Down
2 changes: 1 addition & 1 deletion dmrcodec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -965,7 +965,7 @@ void DMRCodec::process_rx_data()
emit update_output_level(m_audio->level());
}
}
else if ( (m_modeinfo.stream_state == STREAM_END) || (m_modeinfo.stream_state == STREAM_LOST) ){
else if ( ((m_modeinfo.stream_state == STREAM_END) || (m_modeinfo.stream_state == STREAM_LOST)) && (m_rxmodemq.size() > 50) ){
m_rxtimer->stop();
m_audio->stop_playback();
m_rxwatchdog = 0;
Expand Down
Loading

0 comments on commit b6bff5c

Please sign in to comment.