Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
92 changes: 59 additions & 33 deletions ios/NimbleEdgeAI Assistant.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1640"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
buildArchitectures = "Automatic">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F1713F2F2D1024220037358A"
BuildableName = "NimbleEdge AI.app"
BlueprintName = "NimbleEdgeAI Assistant"
ReferencedContainer = "container:NimbleEdgeAI Assistant.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES"
shouldAutocreateTestPlan = "YES">
</TestAction>
<LaunchAction
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F1713F2F2D1024220037358A"
BuildableName = "NimbleEdge AI.app"
BlueprintName = "NimbleEdgeAI Assistant"
ReferencedContainer = "container:NimbleEdgeAI Assistant.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "F1713F2F2D1024220037358A"
BuildableName = "NimbleEdge AI.app"
BlueprintName = "NimbleEdgeAI Assistant"
ReferencedContainer = "container:NimbleEdgeAI Assistant.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>
87 changes: 87 additions & 0 deletions ios/NimbleEdgeAI/EspeakNGService.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import libespeak_ng
class EspeakNGService {
var directory: String = ""
var internalStorage = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!.path()
static let shared = EspeakNGService()
private init(){
copyEspeakDataToInternalStorage()
}

func copyEspeakDataToInternalStorage(){
if let directoryURL = copyDirectoryToDocuments(directoryName: "espeak-ng-data") {
let directoryPath = directoryURL.path
directory = directoryPath
UserDefaults.standard.set(directoryURL.path, forKey: "CopiedDirectoryPath")
}
}

func set_espeak_initialize_callback() -> Int{

let internalStorageCString = strdup(internalStorage)
let res = libespeak_ng.espeak_Initialize(AUDIO_OUTPUT_SYNCHRONOUS, 300, internalStorageCString, 0)
libespeak_ng.espeak_SetVoiceByName("en");
if internalStorageCString != nil {
free(internalStorageCString)
}
return Int(res)
}

func set_espeak_text_to_phonemes_callback(text: String) -> String{
let utf8CString = text.utf8CString // Includes null terminator
var phonemeResult = ""
// Pass pointer-to-pointer to the function
utf8CString.withUnsafeBufferPointer { bufferPointer in
guard let baseAddress = bufferPointer.baseAddress else {
print("Failed to get base address")
return
}

// Create a pointer to the base address (const void**)
var rawPointer: UnsafeRawPointer? = UnsafeRawPointer(baseAddress)

// Allocate a pointer to that pointer
withUnsafeMutablePointer(to: &rawPointer) { textPtr in
let result = libespeak_ng.espeak_TextToPhonemes(
textPtr as UnsafeMutablePointer<UnsafeRawPointer?>,
espeakCHARS_UTF8,
24322
)

if let result = result {
let phonemes = String(cString: result)
print("Phoneme output:", phonemes)
phonemeResult = phonemes
} else {
print("Phoneme conversion failed")
}
}
}
return phonemeResult
}
}

func copyDirectoryToDocuments(directoryName: String) -> URL? {

guard let sourcePath = Bundle.main.path(forResource: directoryName, ofType: nil) else {
print("Directory \(directoryName) not found in bundle")
return nil
}

let sourceURL = URL(fileURLWithPath: sourcePath)

let documentsDirectory = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first!
let destinationURL = documentsDirectory.appendingPathComponent(directoryName)

do {
if FileManager.default.fileExists(atPath: destinationURL.path) {
return destinationURL
}

try FileManager.default.copyItem(at: sourceURL, to: destinationURL)
return destinationURL
} catch {
print("Error copying directory: \(error)")
return nil
}
}

13 changes: 11 additions & 2 deletions ios/NimbleEdgeAI/NimbleEdgeAIApp.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ struct NimbleEdgeAIApp: App {


init() {
FirebaseApp.configure()
//FirebaseApp.configure()
initializeNimbeNet()
}

var body: some Scene {
Expand Down Expand Up @@ -98,6 +99,7 @@ struct NimbleEdgeAIApp: App {
}

func initialise() {
setupEspeakCallbacks()
if DeviceIdentification.getDeviceTier() == .three {
showAppNotSupportedAlert = true
} else {
Expand All @@ -110,6 +112,7 @@ struct NimbleEdgeAIApp: App {

@discardableResult
func initializeNimbeNet() -> Bool {
setupEspeakCallbacks()

let compatibilityTag = DeviceIdentification.getDeviceTier() == .two ? NimbleNetSettings.lowerTierCompatibilityTag : NimbleNetSettings.compatibilityTag

Expand All @@ -125,10 +128,16 @@ func initializeNimbeNet() -> Bool {

func waitForIsReady() {
while !NimbleNetApi.isReady().status {
RunLoop.main.run(until: Date().addingTimeInterval(0.1))
RunLoop.main.run(until: Date().addingTimeInterval(1))
}
}

func setupEspeakCallbacks() {
let espeakNGContext = EspeakNGService.shared
EspeakNGCallbacks.initializeEspeakCallback = espeakNGContext.set_espeak_initialize_callback
EspeakNGCallbacks.espeakTextToPhonemesCallback = espeakNGContext.set_espeak_text_to_phonemes_callback
}

class GlobalState {
static var fillerAudios: [[Int32]] = []
}
Expand Down
1 change: 1 addition & 0 deletions ios/NimbleEdgeAI/models/DownloadItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ struct DownloadItem {
}

static func getDefaultDownloadItem() -> [DownloadItem] {
return []
return [
DownloadItem(
tempFileURL: baseDownloadFolder.appendingPathComponent("\(kokoroFileName).part"),
Expand Down
2 changes: 1 addition & 1 deletion ios/NimbleEdgeAI/views/VoiceOverlay.swift
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ struct AnimatedSpeechText: View {
private var textToShow: String {
switch true {
case isUserSpeaking:
return "Listening..."
return "Listening...\nTap to send"
case !currentText.isEmpty:
return currentText
case !persistedText.isEmpty:
Expand Down
7 changes: 5 additions & 2 deletions ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
source 'https://github.com/NimbleEdge/deliteAI-iOS-Podspecs'
source 'git@github.com:NimbleEdge/NimbleSDK-Podspecs.git'
target 'NimbleEdgeAI Assistant' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!

pod 'NimbleNetiOS', '0.1.0-dev-bb924a1-20250709-executorch'
pod 'NimbleNetiOS', '0.0.5-ios-espeak-rc1'
pod 'lottie-ios'
pod "MarkdownKit"
pod 'Firebase/Core'
pod 'FirebaseAnalytics'
pod 'FirebaseCrashlytics'




end
Binary file added ios/espeak-ng-data/af_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/am_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/an_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/ar_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/as_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/az_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/ba_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/be_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/bg_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/bn_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/bpy_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/bs_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/ca_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/chr_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/cmn_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/cs_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/cv_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/cy_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/da_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/de_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/el_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/en_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/eo_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/es_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/et_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/eu_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/fa_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/fi_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/fr_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/ga_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/gd_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/gn_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/grc_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/gu_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/hak_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/haw_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/he_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/hi_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/hr_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/ht_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/hu_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/hy_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/ia_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/id_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/intonations
Binary file not shown.
Binary file added ios/espeak-ng-data/io_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/is_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/it_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/ja_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/jbo_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/ka_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/kk_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/kl_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/kn_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/ko_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/kok_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/ku_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/ky_dict
Binary file not shown.
Binary file added ios/espeak-ng-data/la_dict
Binary file not shown.
8 changes: 8 additions & 0 deletions ios/espeak-ng-data/lang/aav/vi
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name Vietnamese (Northern)
language vi

words 1 2
pitch 95 175


tone 100 225 800 100 2000 50 5400 75 8000 200
9 changes: 9 additions & 0 deletions ios/espeak-ng-data/lang/aav/vi-VN-x-central
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name Vietnamese (Central)
language vi-vn-x-central
phonemes vi-hue
dictrules 1

words 1
pitch 82 118 //80 118
voicing 90 //18
flutter 20
9 changes: 9 additions & 0 deletions ios/espeak-ng-data/lang/aav/vi-VN-x-south
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name Vietnamese (Southern)
language vi-vn-x-south
phonemes vi-sgn
dictrules 2

words 1
pitch 82 118 //80 118
voicing 90 //18
flutter 20
4 changes: 4 additions & 0 deletions ios/espeak-ng-data/lang/art/eo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name Esperanto
language eo

apostrophe 2
2 changes: 2 additions & 0 deletions ios/espeak-ng-data/lang/art/ia
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name Interlingua
language ia
5 changes: 5 additions & 0 deletions ios/espeak-ng-data/lang/art/io
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name Ido
language io
phonemes eo
status testing

4 changes: 4 additions & 0 deletions ios/espeak-ng-data/lang/art/jbo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name Lojban
language jbo

speed 80 // speed adjustment, percentage
8 changes: 8 additions & 0 deletions ios/espeak-ng-data/lang/art/lfn
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name Lingua Franca Nova
language lfn

phonemes base2
l_unpronouncable 0
numbers 2 3

stressLength 150 140 180 180 0 0 200 200
5 changes: 5 additions & 0 deletions ios/espeak-ng-data/lang/art/piqd
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name Klingon
language piqd
status testing
stressRule 3

7 changes: 7 additions & 0 deletions ios/espeak-ng-data/lang/art/py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
name Pyash
language py
maintainer Logan Streondj <logan@liberit.ca>
status testing

speed 80 // speed adjustment, percentage
stressRule 0
6 changes: 6 additions & 0 deletions ios/espeak-ng-data/lang/art/qdb
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name Lang Belta
language qdb

numbers 4 3

replace 1 t ?
4 changes: 4 additions & 0 deletions ios/espeak-ng-data/lang/art/qya
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name Quenya
language qya
stressRule 2
// rule=penultimate, with qya_rules for light penultimate syllables to move primary stress to the preceding (antepenultimate) syllable
4 changes: 4 additions & 0 deletions ios/espeak-ng-data/lang/art/sjn
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name Sindarin
language sjn
stressRule 2
// rule=penultimate, with sjn_rules for light penultimate syllables to move primary stress to the preceding (antepenultimate) syllable
10 changes: 10 additions & 0 deletions ios/espeak-ng-data/lang/art/xex
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name xextan-test
language xex

phonemes pt-br
phonemes pt

pitch 80 130

dictrules 1
tunes s7 c7 q7 e7
6 changes: 6 additions & 0 deletions ios/espeak-ng-data/lang/azc/nci
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
name Nahuatl (Classical)
language nci

intonation 3
stressRule 2
stressLength 190 190 200 200 0 0 220 240
2 changes: 2 additions & 0 deletions ios/espeak-ng-data/lang/bat/lt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
name Lithuanian
language lt
12 changes: 12 additions & 0 deletions ios/espeak-ng-data/lang/bat/ltg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name Latgalian
language ltg
maintainer Valdis Vitolins <valdis.vitolins@odo.lv>
status testing
phonemes lv
dictionary lv
dictrules 2 // Setting for Latgalian pronunciation
words 0 2
pitch 64 118
tone 60 150 204 100 400 255 700 10 3000 255
stressAmp 12 10 8 8 0 0 15 16
stressLength 160 140 200 140 0 0 240 160
9 changes: 9 additions & 0 deletions ios/espeak-ng-data/lang/bat/lv
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name Latvian
language lv
maintainer Valdis Vitolins <valdis.vitolins@odo.lv>
status mature
words 0 2
pitch 67 123
tone 60 150 204 100 400 255 700 10 3000 255
stressAmp 11 8 11 9 0 0 14 12
stressLength 160 120 200 130 0 0 230 180
4 changes: 4 additions & 0 deletions ios/espeak-ng-data/lang/bnt/sw
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name Swahili
language sw

status testing
4 changes: 4 additions & 0 deletions ios/espeak-ng-data/lang/bnt/tn
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name Setswana
language tn

status testing
3 changes: 3 additions & 0 deletions ios/espeak-ng-data/lang/ccs/ka
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
name Georgian
language ka
lowercaseSentence // A period followed by a lowercase letter is considered a sentence (mkhedruli)
Loading