Konuyu Oyla:
  • Derecelendirme: 5/5 - 1 oy
  • 1
  • 2
  • 3
  • 4
  • 5
Sesli yazma
#1
Selamlar,
Android uygulamamda Edit 'in yanına bir mikrofon işareti koyup yazmak istediğimi sesli olarak söyleyip otomatik yazdırabilir miyim acaba?
Whatsappdaki gibi.
Cevapla
#2
@gonulali Merhaba zamanında bende uğraşmıştım. Sana örnek proje gönderiyorum. Kendine göre ayarlarsın.

Proje İndir
Cevapla
#3
(18-05-2018, Saat: 10:35)elixir84 Adlı Kullanıcıdan Alıntı: @gonulali Merhaba zamanında bende uğraşmıştım. Sana örnek proje gönderiyorum. Kendine göre ayarlarsın.

Proje İndir

Paylaşım için teşekkürler. 
Her üyemizin kodu indirip inceleme şansı veya zamanı olmuyor maalesef. 
Doğrudan proje paylaşımı ile beraber; projenin mümkünse ekran görüntüsü, içerdiği koda ilişkin birkaç ipucu veya kullanmış olduğunuz kod ve kısa bir bilgi paylaşabilirseniz, konuyu okuyan üyelerimiz projeniz konusunda bilgilenecektir.
Delphi Can'dır!
WWW
Cevapla
#4
@DelphiCan

A1oWlQ.jpg


unit Unit1;

interface

uses
 System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
 FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.Effects,
 FMX.Ani, FMX.StdCtrls, FMX.Layouts, FMX.ListBox, FMX.Objects,
 FMX.Controls.Presentation,android.speech
 {$IFDEF ANDROID}
 ,Androidapi.JNI.Net
 ,Androidapi.JNI.GraphicsContentViewText
 ,Androidapi.JNI.JavaTypes
 ,Androidapi.JNI.App
 ,FMX.Platform.Android
 ,FMX.Helpers.Android
 ,Androidapi.Helpers
 ,Androidapi.JNIBridge
 ,Androidapi.JNI.Os, FMX.Edit
 {$ENDIF};

type
 TForm1 = class(TForm)
   voicepanel: TRectangle;
   Label1: TLabel;
   Layout1: TLayout;
   Label2: TLabel;
   ListBox1: TListBox;
   Layout2: TLayout;
   SpeedButton1: TSpeedButton;
   SpeedButton2: TSpeedButton;
   FloatAnimation1: TFloatAnimation;
   ShadowEffect1: TShadowEffect;
   Image2: TImage;
   karanlik: TRectangle;
   Edit1: TEdit;
   Button1: TButton;
   Image7: TImage;
   procedure Button1Click(Sender: TObject);
   procedure SpeedButton2Click(Sender: TObject);
   procedure FormShow(Sender: TObject);
   procedure SpeedButton1Click(Sender: TObject);
   procedure FloatAnimation1Finish(Sender: TObject);
 private
 procedure ShowPopup;
 procedure HidePopup;
 procedure sesliarama;
   { Private declarations }
 public
   { Public declarations }
 end;

var
 Form1: TForm1;

implementation

{$R *.fmx}

function ErrorMessage(Error: Integer): string;
begin
 case Error of
   TJSpeechRecognizer_ERROR_AUDIO: Result := 'Ses kayıt hatası';
   TJSpeechRecognizer_ERROR_CLIENT: Result := 'Diğer istemci tarafı hatalar';
   TJSpeechRecognizer_ERROR_INSUFFICIENT_PERMISSIONS: Result := 'Yetersiz izinler';
   TJSpeechRecognizer_ERROR_NETWORK: Result := 'Diğer Ağ ile ilgili hatalar';
   TJSpeechRecognizer_ERROR_NETWORK_TIMEOUT: Result := 'Ağ işlemi zaman aşımına uğradı';
   TJSpeechRecognizer_ERROR_NO_MATCH: Result := 'Hiçbir tanıma sonucu eşleşti';
   TJSpeechRecognizer_ERROR_RECOGNIZER_BUSY: Result := 'Tanıma Hizmet meşgul';
   TJSpeechRecognizer_ERROR_SERVER: Result := 'Sunucu hatası durumu';
   TJSpeechRecognizer_ERROR_SPEECH_TIMEOUT: Result := 'Herhangi bir konuşma girişi Bulunamadı';
   else Result := 'Tanımlanamaya Hata ' + IntToStr(Error);
 end;
end;

type
 TRecognitionListener = class(TJavaLocal, JRecognitionListener)
   procedure onBeginningOfSpeech; cdecl;
   procedure onBufferReceived(Buffer: TJavaArray<Byte>); cdecl;
   procedure onEndOfSpeech; cdecl;
   procedure onError(Error: Integer); cdecl;
   procedure onEvent(EventType: Integer; Params: JBundle); cdecl;
   procedure onPartialResults(PartialResults: JBundle); cdecl;
   procedure onReadyForSpeech(Params: JBundle); cdecl;
   procedure onResults(Results: JBundle); cdecl;
   procedure onRmsChanged(RmsdB: Single); cdecl;
 end;

procedure TRecognitionListener.onBeginningOfSpeech;
begin
 Form1.label2.text := 'Konuşma Başladı';
end;

procedure TRecognitionListener.onBufferReceived(Buffer: TJavaArray<Byte>);
begin
end;

procedure TRecognitionListener.onEndOfSpeech;
begin
 Form1.label2.text := 'Konuşma Bitti';
end;

procedure TRecognitionListener.onError(Error: Integer);
begin
 Form1.label2.text:='Hata: ' + ErrorMessage(Error);
end;

procedure TRecognitionListener.onEvent(EventType: Integer; Params: JBundle);
begin
end;

procedure TRecognitionListener.onPartialResults(PartialResults: JBundle);
begin
end;

procedure TRecognitionListener.onReadyForSpeech(Params: JBundle);
begin
 Form1.label2.text:='Konuçma İçin Hazır';
end;

procedure TRecognitionListener.onResults(Results: JBundle);
var
 ArrayList: JArrayList;
 I: Integer;
 Text: string;
begin
 Text := '';
 ArrayList := Results.getStringArrayList(StringToJString(TJSpeechRecognizer_RESULTS_RECOGNITION));
 Form1.Listbox1.Clear;
 for I := 0 to ArrayList.size - 1 do
 Form1.Listbox1.Items.Add(JStringToString(ArrayList.get(I).toString));
 Form1.label2.text:='Sonuçlar';
 Form1.Edit1.SetFocus;
end;

procedure TRecognitionListener.onRmsChanged(RmsdB: Single);
begin
end;

var
 SpeechRecognizer: JSpeechRecognizer;
 RecognitionListener: JRecognitionListener;


 procedure Tform1.sesliarama;
 begin
 Edit1.Text:='';
 label2.text:='';
 Listbox1.Clear;

 if not TJSpeechRecognizer.JavaClass.isRecognitionAvailable(SharedActivityContext) then
 begin
   ShowMessage('Konuşma tanıma mevcut değil');
   Exit;
 end;

 CallInUiThread(
   procedure
   begin
     if SpeechRecognizer = nil then
     begin
       SpeechRecognizer := TJSpeechRecognizer.JavaClass.createSpeechRecognizer(SharedActivityContext);
       RecognitionListener := TRecognitionListener.Create;
       SpeechRecognizer.setRecognitionListener(RecognitionListener);
     end;
     SpeechRecognizer.startListening(TJRecognizerIntent.JavaClass.getVoiceDetailsIntent(SharedActivityContext));
   end);
ShowPopup;
 end;


procedure TForm1.ShowPopup;
begin
   FloatAnimation1.StartValue:= -voicepanel.Height;
   FloatAnimation1.StopValue:= (self.Height / 1.5)-(voicepanel.Height-2);
   voicepanel.Visible:=true;
   karanlik.Visible:=true;
   FloatAnimation1.Start;
end;

procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
Edit1.Text:=Listbox1.Selected.Text;
//if Edit1.text<>'' then cariarama;  //arama yaptırılabilir
Edit1.SetFocus;
hidePopup;
end;

procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
HidePopup;
end;

procedure TForm1.FloatAnimation1Finish(Sender: TObject);
begin
if FloatAnimation1.StartValue <> 0-voicepanel.Height then
begin
   voicepanel.Visible:=false;
   karanlik.Visible:=false;
end;
end;

procedure TForm1.FormShow(Sender: TObject);
begin
HidePopup;
end;

procedure TForm1.HidePopup;
begin
   FloatAnimation1.StartValue:= (self.Height / 2)-(voicepanel.Height-2);
   FloatAnimation1.StopValue:=  0-voicepanel.Height;
   FloatAnimation1.Start;


end;
procedure TForm1.Button1Click(Sender: TObject);
begin
sesliarama;
end;

end.
Cevapla
#5
Bu gerçekten banada lazımdı eline sağlık
Cevapla
#6
@elixir84 Çok teşekkürler. Telefonumda çalıştırdığımda sesli aramaya bastığımda kendini kapatıyor program. Bazende konuşmaya başladığımda kapatıyor. neden olabilir? Eksik birşey olabilir mi acaba?
Cevapla
#7
(18-05-2018, Saat: 19:10)gonulali Adlı Kullanıcıdan Alıntı: @elixir84  Çok teşekkürler. Telefonumda çalıştırdığımda sesli aramaya bastığımda kendini kapatıyor program. Bazende konuşmaya başladığımda kapatıyor. neden olabilir? Eksik birşey olabilir mi acaba?

@gonulali Delphi 10.2.3 de derlendi onunla alakası olabilir mi?
Cevapla
#8
Bende firemonkey 10.1 kurulu.onda derliyorum konuşma hazır diyor konuşuyorum, konuşma bitti yazıp programı kapatıyor telefonda. 
Dediğiniz versiyondamı yapmam gerek acaba?
Cevapla
#9
@gonulali Burdaki projeyi indirip denermisin.

https://github.com/FMXExpress/Firemonkey...ForAndroid
Cevapla
#10
Evet buradaki sorunsuz çalıştı. Çok teşekkürler @elixir84
Cevapla


Konu ile Alakalı Benzer Konular
Konular Yazar Yorumlar Okunma Son Yorum
  Kordinata göre yazı yazma Husv 0 188 19-09-2023, Saat: 23:07
Son Yorum: Husv
  Resime iki satır yazı yazma Nese 3 2.314 11-06-2020, Saat: 06:38
Son Yorum: mrmarman
  Ios Uygulama Yazma hk. seydigozegir@gmail.com 18 12.467 09-03-2020, Saat: 16:44
Son Yorum: TescilsizUzman
  Görüntülü ve sesli görüşme SercanTEK 6 4.068 08-02-2019, Saat: 20:45
Son Yorum: mcuyan
  edit-numara formatında yazma ? Mr.Developer 8 6.171 28-05-2018, Saat: 16:36
Son Yorum: Mr.Developer



Konuyu Okuyanlar: 1 Ziyaretçi