iOS Question Does this one(new version) fix the sound going quit after the api.ai sound input prog?

John Woodsmall

Active Member
Licensed User
Longtime User
Does this one(new version) fix the sound going quit after the api.ai sound input prog?

I have integrated your api.ai sound input prog into my app.
It works fine as is and I have gotten them(api.ai) to fix their system for date input.

So, everything is ok, but when your program runs and works correctly
(getting the sound and getting their response into text); then:

when it returns to my working system and I ask the system to speak,
the sound is very low, can not really be heard.

I was told that this was the fault of ios9 the apple system.

but is there any way to force the sound to come back up normally?
 

John Woodsmall

Active Member
Licensed User
Longtime User
I removed the rc.dat file and zipped it. It was then small enough.
This is just 2 buttons:
1.) speak the birth date.(and return back)
2.) (results) speak some text.

if you tic, "results" at 1st then it comes out ok

if you tic, speak the birth date...and come back...then tic results...the sound is very low.
 

Attachments

  • Astro_match_test.zip
    227.2 KB · Views: 246
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Change the initialize sub in SpeakButton to:
B4X:
Public Sub Initialize (TargetModule As Object, EventName As String)
   ar.Initialize(File.DirTemp, "1.wav", 16000, True, 16, False)
   sessionId = Rnd(1000000, 9999999)
   mTarget = TargetModule
   mEventName = EventName
   Dim no As NativeObject = Me
   no.RunMethod("setAudioSession", Null)
End Sub

#If OBJC
#import <AVFoundation/AVFoundation.h>
#import <AudioToolbox/AudioToolbox.h>
- (void)setAudioSession {
 [[AVAudioSession sharedInstance]
  setCategory:AVAudioSessionCategoryPlayAndRecord
  withOptions:AVAudioSessionCategoryOptionDefaultToSpeaker error:nil];
}
#end if

Note that there seems to be a bug in v2.30 related to CallSub. I'm currently investigating it.

If you are using v2.30 and the JobDone sub is not called then change HttJob.Complete sub to:
B4X:
Public Sub Complete (res1 As HttpResponse)
   res = res1
   CallSub2(target, "JobDon" & "e", Me)
End Sub
 
Upvote 0

John Woodsmall

Active Member
Licensed User
Longtime User
Ok, works thanks!

when I add a textview to speakbutton and equate to the new date it
fails.
??
 

Attachments

  • test2.zip
    367.6 KB · Views: 228
Upvote 0

John Woodsmall

Active Member
Licensed User
Longtime User
error at line 86:
(object was not initized(UITEXTVIEW).

Private textview2 As TextView
86. textview2.text = "Date Values:" & NewDate
SEE source: test2.zip

THIS IS UNDER DEBUG.

WHEN IT RUNS AS A "RELEASE APP" VERSION IT JUST FAILS AND COMES BACK TO THE
IPHONE SCREEN.
 
Upvote 0

John Woodsmall

Active Member
Licensed User
Longtime User
ok I have added a label:label99 to the layout(speakbutton).
I need to update it as the info comes in.
But
The label does not show on the screen???
Must be something simple.
 

Attachments

  • test3.zip
    367.7 KB · Views: 219
Upvote 0
Top