Skip to content

Commit bb116df

Browse files
committed
Add Opus DRED and OSCE AI audio effects
1 parent 986aed6 commit bb116df

43 files changed

Lines changed: 497 additions & 9 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ChangeLog.txt

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,17 @@
44

55
Version 5.22.1, unreleased
66
Default Qt Client
7-
-
7+
- Option to enable AI packet loss recovery (DRED), making outgoing voice more resilient on unstable networks
8+
- Option to enable AI speech enhancement (OSCE) to improve clarity of received voice
89
Android Client
9-
-
10+
- Option to enable AI packet loss recovery (DRED), making outgoing voice more resilient on unstable networks
11+
- Option to enable AI speech enhancement (OSCE) to improve clarity of received voice
1012
iOS Client
11-
-
13+
- Option to enable AI packet loss recovery (DRED), making outgoing voice more resilient on unstable networks
14+
- Option to enable AI speech enhancement (OSCE) to improve clarity of received voice
15+
Accessible Windows Client
16+
- Option to enable AI packet loss recovery (DRED), making outgoing voice more resilient on unstable networks
17+
- Option to enable AI speech enhancement (OSCE) to improve clarity of received voice
1218
Server
1319
-
1420

Client/TeamTalkAndroid/src/main/java/dk/bearware/backend/TeamTalkService.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
import javax.xml.xpath.XPathExpressionException;
7676
import javax.xml.xpath.XPathFactory;
7777

78+
import dk.bearware.AIAudioEffect;
7879
import dk.bearware.AudioPreprocessor;
7980
import dk.bearware.AudioPreprocessorType;
8081
import dk.bearware.Channel;
@@ -869,6 +870,12 @@ private void setupAudioPreprocessor() {
869870
int gain = prefs.getInt(Preferences.PREF_SOUNDSYSTEM_MICROPHONEGAIN, SoundLevel.SOUND_GAIN_DEFAULT);
870871
ttclient.setSoundInputGainLevel(gain);
871872
}
873+
874+
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
875+
AIAudioEffect aiEffect = new AIAudioEffect();
876+
aiEffect.bEnableDRED = prefs.getBoolean(Preferences.PREF_SOUNDSYSTEM_AI_DRED, false);
877+
aiEffect.bEnableOSCE = prefs.getBoolean(Preferences.PREF_SOUNDSYSTEM_AI_OSCE, false);
878+
ttclient.setAIAudioEffect(aiEffect);
872879
}
873880

874881
@Override

Client/TeamTalkAndroid/src/main/java/dk/bearware/data/Preferences.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,9 @@ public class Preferences {
4444
PREF_SOUNDSYSTEM_MUTE_ON_TRANSMISSION = "mute_speakers_on_tx_checkbox",
4545
PREF_SOUNDSYSTEM_SPEAKERPHONE = "speakerphone_checkbox",
4646
PREF_SOUNDSYSTEM_BLUETOOTH_HEADSET = "bluetooth_headset_checkbox",
47-
PREF_SOUNDSYSTEM_VOICEPROCESSING = "voiceprocessing_checkbox";
47+
PREF_SOUNDSYSTEM_VOICEPROCESSING = "voiceprocessing_checkbox",
48+
PREF_SOUNDSYSTEM_AI_DRED = "ai_dred_checkbox",
49+
PREF_SOUNDSYSTEM_AI_OSCE = "ai_osce_checkbox";
4850
public static final String
4951
PREF_JOIN_ROOT_CHAN = "auto_join_root_checkbox",
5052
PREF_SUB_TEXTMESSAGE = "sub_txtmsg_checkbox",

Client/TeamTalkAndroid/src/main/res/values/strings.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,10 @@
163163
<string name="pref_summary_bluetooth_headset_checkbox">When bluetooth headset is connected use its microphone</string>
164164
<string name="pref_title_voice_processing_checkbox">Enable voice preprocessing</string>
165165
<string name="pref_summary_voice_processing_checkbox">Use echo cancellation and automatic gain control</string>
166+
<string name="pref_title_ai_dred_checkbox">Enable AI packet loss recovery (DRED)</string>
167+
<string name="pref_summary_ai_dred_checkbox">Make outgoing voice more resilient on unstable networks</string>
168+
<string name="pref_title_ai_osce_checkbox">Enable AI speech enhancement (OSCE)</string>
169+
<string name="pref_summary_ai_osce_checkbox">Improve clarity of received voice</string>
166170

167171
<string name="text_tts_loggedin">has logged in</string>
168172
<string name="text_tts_loggedout">has logged out</string>

Client/TeamTalkAndroid/src/main/res/xml/pref_soundsystem.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,18 @@
1919
android:title="@string/pref_title_voice_processing_checkbox"
2020
android:summary="@string/pref_summary_voice_processing_checkbox" />
2121

22+
<CheckBoxPreference
23+
android:key="ai_dred_checkbox"
24+
android:defaultValue="false"
25+
android:title="@string/pref_title_ai_dred_checkbox"
26+
android:summary="@string/pref_summary_ai_dred_checkbox" />
27+
28+
<CheckBoxPreference
29+
android:key="ai_osce_checkbox"
30+
android:defaultValue="false"
31+
android:title="@string/pref_title_ai_osce_checkbox"
32+
android:summary="@string/pref_summary_ai_osce_checkbox" />
33+
2234
<CheckBoxPreference
2335
android:key="bluetooth_headset_checkbox"
2436
android:defaultValue="false"

Client/iTeamTalk/iTeamTalk/PreferencesViewController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ let PREF_VOICEACTIVATION = "voiceactivationlevel_preference"
4949
let PREF_MEDIAFILE_VOLUME = "mediafile_volume_preference"
5050
let PREF_HEADSET_TXTOGGLE = "headset_tx_preference"
5151
let PREF_VOICEPROCESSINGIO = "voiceprocessing_preference"
52+
let PREF_AI_DRED = "ai_dred_preference"
53+
let PREF_AI_OSCE = "ai_osce_preference"
5254
let PREF_SNDINPUT_PORT = "sndinput_port_preference" // postfix of key is AVAudioSessionPortDescription.uid. Value is dataSourceID
5355

5456
let PREF_SNDEVENT_SERVERLOST = "snd_srvlost_preference"

Client/iTeamTalk/iTeamTalk/SoundDevicesViewController.swift

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,22 @@ class SoundDevicesViewController : UITableViewController {
5757
voiceprepswitch.addTarget(self, action: #selector(SoundDevicesViewController.voicepreprocessingChanged(_:)), for: .valueChanged)
5858
sound_items.append(voice_prepcell)
5959

60+
let dredcell = UITableViewCell(style: .subtitle, reuseIdentifier: nil)
61+
let dredswitch = newTableCellSwitch(dredcell, label: NSLocalizedString("AI Packet Loss Recovery (DRED)", comment: "preferences"),
62+
initial: settings.object(forKey: PREF_AI_DRED) != nil && settings.bool(forKey: PREF_AI_DRED))
63+
dredcell.detailTextLabel!.text = NSLocalizedString("Make outgoing voice more resilient on unstable networks",
64+
comment: "Sound Devices")
65+
dredswitch.addTarget(self, action: #selector(SoundDevicesViewController.aiDredChanged(_:)), for: .valueChanged)
66+
sound_items.append(dredcell)
67+
68+
let oscecell = UITableViewCell(style: .subtitle, reuseIdentifier: nil)
69+
let osceswitch = newTableCellSwitch(oscecell, label: NSLocalizedString("AI Speech Enhancement (OSCE)", comment: "preferences"),
70+
initial: settings.object(forKey: PREF_AI_OSCE) != nil && settings.bool(forKey: PREF_AI_OSCE))
71+
oscecell.detailTextLabel!.text = NSLocalizedString("Improve clarity of received voice",
72+
comment: "Sound Devices")
73+
osceswitch.addTarget(self, action: #selector(SoundDevicesViewController.aiOsceChanged(_:)), for: .valueChanged)
74+
sound_items.append(oscecell)
75+
6076
if #available(iOS 10.0, *) {
6177
let a2dpcell = UITableViewCell(style: .subtitle, reuseIdentifier: nil)
6278
let a2dpswitch = newTableCellSwitch(a2dpcell, label: NSLocalizedString("Bluetooth A2DP Playback", comment: "Sound Devices"),
@@ -219,13 +235,25 @@ class SoundDevicesViewController : UITableViewController {
219235
}
220236

221237
@objc func voicepreprocessingChanged(_ sender: UISwitch) {
222-
238+
223239
let defaults = UserDefaults.standard
224240
defaults.set(sender.isOn, forKey: PREF_VOICEPROCESSINGIO)
225-
241+
226242
setupSoundDevices()
227243
}
228244

245+
@objc func aiDredChanged(_ sender: UISwitch) {
246+
let defaults = UserDefaults.standard
247+
defaults.set(sender.isOn, forKey: PREF_AI_DRED)
248+
applyAIAudioEffect()
249+
}
250+
251+
@objc func aiOsceChanged(_ sender: UISwitch) {
252+
let defaults = UserDefaults.standard
253+
defaults.set(sender.isOn, forKey: PREF_AI_OSCE)
254+
applyAIAudioEffect()
255+
}
256+
229257
@objc func bluetoothA2DPChanged(_ sender: UISwitch) {
230258

231259
let defaults = UserDefaults.standard

Client/iTeamTalk/iTeamTalk/UtilSound.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,16 @@ func setupSoundDevices() {
298298
catch {
299299
print("Failed to set mode")
300300
}
301+
302+
applyAIAudioEffect()
303+
}
304+
305+
func applyAIAudioEffect() {
306+
let defaults = UserDefaults.standard
307+
var aiEffect = AIAudioEffect()
308+
aiEffect.bEnableDRED = (defaults.object(forKey: PREF_AI_DRED) != nil && defaults.bool(forKey: PREF_AI_DRED)) ? TRUE : FALSE
309+
aiEffect.bEnableOSCE = (defaults.object(forKey: PREF_AI_OSCE) != nil && defaults.bool(forKey: PREF_AI_OSCE)) ? TRUE : FALSE
310+
TT_SetAIAudioEffect(ttInst, &aiEffect)
301311
}
302312

303313
func playSound(_ s: Sounds) {

Client/qtTeamTalk/preferences.ui

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1346,6 +1346,20 @@
13461346
</property>
13471347
</widget>
13481348
</item>
1349+
<item>
1350+
<widget class="QCheckBox" name="aiDredBox">
1351+
<property name="text">
1352+
<string>Enable AI packet loss recovery (DRED)</string>
1353+
</property>
1354+
</widget>
1355+
</item>
1356+
<item>
1357+
<widget class="QCheckBox" name="aiOsceBox">
1358+
<property name="text">
1359+
<string>Enable AI speech enhancement (OSCE)</string>
1360+
</property>
1361+
</widget>
1362+
</item>
13491363
<item>
13501364
<layout class="QHBoxLayout" name="horizontalLayout_10">
13511365
<item>

Client/qtTeamTalk/preferencesdlg.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,10 @@ void PreferencesDlg::initDevices()
276276
ui.agcBox->setChecked(ttSettings->value(SETTINGS_SOUND_AGC, SETTINGS_SOUND_AGC_DEFAULT).toBool());
277277
ui.denoisingBox->setChecked(ttSettings->value(SETTINGS_SOUND_DENOISING,
278278
SETTINGS_SOUND_DENOISING_DEFAULT).toBool());
279+
ui.aiDredBox->setChecked(ttSettings->value(SETTINGS_SOUND_AI_DRED,
280+
SETTINGS_SOUND_AI_DRED_DEFAULT).toBool());
281+
ui.aiOsceBox->setChecked(ttSettings->value(SETTINGS_SOUND_AI_OSCE,
282+
SETTINGS_SOUND_AI_OSCE_DEFAULT).toBool());
279283
slotUpdateSoundCheckBoxes();
280284
}
281285

@@ -934,6 +938,13 @@ void PreferencesDlg::slotSaveChanges()
934938
ttSettings->setValueOrClear(SETTINGS_SOUND_ECHOCANCEL, ui.echocancelBox->isChecked(), SETTINGS_SOUND_ECHOCANCEL_DEFAULT);
935939
ttSettings->setValueOrClear(SETTINGS_SOUND_AGC, ui.agcBox->isChecked(), SETTINGS_SOUND_AGC_DEFAULT);
936940
ttSettings->setValueOrClear(SETTINGS_SOUND_DENOISING, ui.denoisingBox->isChecked(), SETTINGS_SOUND_DENOISING_DEFAULT);
941+
ttSettings->setValueOrClear(SETTINGS_SOUND_AI_DRED, ui.aiDredBox->isChecked(), SETTINGS_SOUND_AI_DRED_DEFAULT);
942+
ttSettings->setValueOrClear(SETTINGS_SOUND_AI_OSCE, ui.aiOsceBox->isChecked(), SETTINGS_SOUND_AI_OSCE_DEFAULT);
943+
944+
AIAudioEffect aiEffect = {};
945+
aiEffect.bEnableDRED = ui.aiDredBox->isChecked();
946+
aiEffect.bEnableOSCE = ui.aiOsceBox->isChecked();
947+
TT_SetAIAudioEffect(ttInst, &aiEffect);
937948

938949
ttSettings->setValueOrClear(SETTINGS_SOUND_MEDIASTREAM_VOLUME, ui.mediavsvoiceSlider->value(), SETTINGS_SOUND_MEDIASTREAM_VOLUME_DEFAULT);
939950

0 commit comments

Comments
 (0)