![]() |
| Bacaan Huruf Shafir |
Suara adalah fenomena fisik yang dihasilkan oleh getaran suatu benda yang berupa sinyal analog dengan amplitudo yang berubah secara kontinu terhadap waktu. Suara merupakan gelombang yang mengandung sejumlah parameter (amplitudo, simpangan, frekuensi, spektrum) yang dapat menyebabkan suara yang satu berbeda dengan suara lain (Fadlisyah, Bustami dan M.ikhwanus, 2013).
Suara dengan amplitudo tinggi akan terdengar lebih keras. Suara dengan frekuensi lebih besar akan terdengar lebih tinggi. Sementara itu ditemukan dua suara yang beramplitudo dan frekuensi sama misalnya biola dan piano dibunyikan bersama dengan tingkat kekerasan dan nada yang sama namun telinga masih dapat membedakan mana suara dari piano dan mana suara dari biola. Ini terjadi karena suara juga memiliki warna suara. Suatu warna suara ditentukan oleh pola dasar dari suatu gelombang suara
TForm1 = class(TForm)
ALGenericFilter1: TALGenericFilter;
ALAudioOut1: TALAudioOut;
Memo1: TMemo;
MainMenu1: TMainMenu;
File1: TMenuItem;
OpenDialog1: TOpenDialog;
SLScope1: TSLScope;
GroupBox2: TGroupBox;
ransformasi1: TMenuItem;
Hankel_Bessel: TMenuItem;
Button1: TButton;
Label1: TLabel;
Edit3: TEdit;
Edit4: TEdit;
Matriks1: TMenuItem;
Edit5: TEdit;
GroupBox1: TGroupBox;
GroupBox3: TGroupBox;
Memo2: TMemo;
Button2: TButton;
Button3: TButton;
ALAudioIn1: TALAudioIn;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
RadioButton3: TRadioButton;
RadioButton4: TRadioButton;
Edit6: TEdit;
Edit1: TEdit;
Edit2: TEdit;
Edit7: TEdit;
GroupBox4: TGroupBox;
Memo3: TMemo;
Label2: TLabel;
Button4: TButton;
Image1: TImage;
procedure ALGenericFilter1ProcessData(Sender: TObject;
InBuffer: IALAudioBuffer; var OutBuffer: IALAudioBuffer;
var SendOutputData: Boolean);
procedure Hankel_BesselClick(Sender: TObject);
procedure RadioButton1Click(Sender: TObject);
procedure RadioButton2Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Matriks1Click(Sender: TObject);
procedure RadioButton3Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure RadioButton4Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure GroupBox4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
namafile : string;
fsinyal : textfile;
cacah : integer;
arrayfx : array[0..100000] of integer;
buffo : integer;
N_spektrum : integer;
T_spektrum : real;
ciri_1, ciri_2, ciri_3, uji_spektrum : real;
ciri_4 : real;
implementation
uses Unit2;
{$R *.dfm}
procedure TForm1.ALGenericFilter1ProcessData(Sender: TObject;
InBuffer: IALAudioBuffer; var OutBuffer: IALAudioBuffer;
var SendOutputData: Boolean);
var
I:integer;
buffer_fx:integer;
begin
buffer_fx:=0;
namafile := 'sinyalasli.txt';
assignfile(fsinyal,namafile);
rewrite(fsinyal);
for I:=0 to InBuffer.getsize()-1 do
begin
write(fsinyal, InttoStr(InBuffer[ I,0])+' ');
buffer_fx:=buffer_fx+inbuffer[I,0];
end;
closefile(fsinyal);
Matriks1.Click;
buffo:= InBuffer.getsize();
arrayfx[cacah]:= round(buffer_fx/buffo);
cacah:=cacah+1;
end;
procedure TForm1.Hankel_BesselClick(Sender: TObject);
Var N,u,x : integer;
Hankel_Bessel, spektrum : real;
tau, fungsi_bessel : real;
begin
N:=cacah+1;
edit1.Text:=inttostr(N);
edit2.Text:=inttostr(buffo);
edit7.Text:=floattostr(pi);
N_spektrum:=0;
T_spektrum:=0;
for u:=1 to N-1 do
for x:=1 to N-1 do
begin
//FUNGSI BESSEL
tau:=0.0;
fungsi_bessel:=0.0;
repeat
fungsi_bessel:=fungsi_bessel+((1/pi)*cos((N*tau)- (u*x*sin(tau))));
tau:=tau+0.01
until tau>=pi;
Memo2.Lines.Add(floattoStr(fungsi_bessel));
// TRANSFORMASI HANKEL
Hankel_Bessel:=arrayfx[x]*fungsi_bessel*x ;
//spektrum
spektrum:=abs(Hankel_Bessel);
N_spektrum:=N_spektrum+1;
T_spektrum:=T_spektrum+spektrum ;
Memo3.Lines.Add(floattoStr(spektrum));
end;
end;
procedure TForm1.RadioButton1Click(Sender: TObject);
begin
ciri_1:=T_spektrum/N_spektrum;
namafile := 'ciri_1.txt';
assignfile(fsinyal,namafile);
rewrite(fsinyal);
write(fsinyal, floattoStr(Ciri_1)+' ');
closefile(fsinyal);
end;
procedure TForm1.RadioButton2Click(Sender: TObject);
begin
ciri_2:=T_spektrum/N_spektrum;
namafile := 'ciri_2.txt';
assignfile(fsinyal,namafile);
rewrite(fsinyal);
write(fsinyal, floattoStr(Ciri_2)+' ');
closefile(fsinyal);
end;
procedure TForm1.Button1Click(Sender: TObject);
var hasil_uji_1, hasil_uji_2 : real;
hasil_uji_3, hasil_uji_4 : real;
temp_sinyal : string;
begin
Hankel_Bessel.click;
//loading ciri
namafile := 'ciri_1.txt';
assignfile(fsinyal,namafile);
reset(fsinyal);
readln(fsinyal, temp_sinyal);
closefile(fsinyal);
ciri_1:=strtofloat(temp_sinyal);
namafile := 'ciri_2.txt';
assignfile(fsinyal,namafile);
reset(fsinyal);
readln(fsinyal, temp_sinyal);
closefile(fsinyal);
ciri_2:=strtofloat(temp_sinyal);
namafile := 'ciri_3.txt';
assignfile(fsinyal,namafile);
reset(fsinyal);
readln(fsinyal, temp_sinyal);
closefile(fsinyal);
ciri_3:=strtofloat(temp_sinyal);
namafile := 'ciri_4.txt';
assignfile(fsinyal,namafile);
reset(fsinyal);
readln(fsinyal, temp_sinyal);
closefile(fsinyal);
ciri_4:=strtofloat(temp_sinyal);
//akhir loading
uji_spektrum:=T_spektrum/N_spektrum;
if uji_spektrum>ciri_1 then hasil_uji_1:=ciri_1/uji_spektrum
else hasil_uji_1:=uji_spektrum/ciri_1;
if uji_spektrum>ciri_2 then hasil_uji_2:=ciri_2/uji_spektrum
else hasil_uji_2:=uji_spektrum/ciri_2;
if uji_spektrum>ciri_3 then hasil_uji_3:=ciri_3/uji_spektrum
else hasil_uji_3:=uji_spektrum/ciri_3;
if uji_spektrum>ciri_4 then hasil_uji_4:=ciri_4/uji_spektrum
else hasil_uji_4:=uji_spektrum/ciri_4;
if hasil_uji_1>hasil_uji_2 then
if hasil_uji_1>hasil_uji_3 then
if hasil_uji_1>hasil_uji_4 then begin
label1.Caption:=radiobutton1.caption;
if hasil_uji_1>0.7 then label2.Caption:='Benar' else
label2.Caption:='Kurang Benar'
end;
if hasil_uji_2>hasil_uji_1 then
if hasil_uji_2>hasil_uji_3 then
if hasil_uji_2>hasil_uji_4 then begin
label1.Caption:=radiobutton2.caption;
if hasil_uji_2>0.7 then label2.Caption:='Benar' else
label2.Caption:='Kurang Benar'
end;
if hasil_uji_3>hasil_uji_2 then
if hasil_uji_3>hasil_uji_1 then
if hasil_uji_3>hasil_uji_4 then begin
label1.Caption:=radiobutton3.caption;
if hasil_uji_3>0.7 then label2.Caption:='Benar' else
label2.Caption:='Kurang Benar'
end;
if hasil_uji_4>hasil_uji_1 then
if hasil_uji_4>hasil_uji_2 then
if hasil_uji_4>hasil_uji_3 then label1.Caption:=radiobutton4.caption;
edit3.Text:=floattostr(hasil_uji_1);
edit4.Text:=floattostr(hasil_uji_2);
edit5.Text:=floattostr(hasil_uji_3);
edit6.Text:=floattostr(hasil_uji_4);
end;
procedure TForm1.Matriks1Click(Sender: TObject);
begin
Memo1.Lines.LoadFromFile(namafile);
end;
procedure TForm1.RadioButton3Click(Sender: TObject);
begin
ciri_3:=T_spektrum/N_spektrum;
namafile := 'ciri_3.txt';
assignfile(fsinyal,namafile);
rewrite(fsinyal);
write(fsinyal, floattoStr(Ciri_3)+' ');
closefile(fsinyal);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
cacah:=0;
label1.Caption:='....';
AlAudioIn1.Start;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
AlAudioIn1.Stop;
Hankel_Bessel.click;
end;
procedure TForm1.RadioButton4Click(Sender: TObject);
begin
ciri_4:=T_spektrum/N_spektrum;
namafile := 'ciri_4.txt';
assignfile(fsinyal,namafile);
rewrite(fsinyal);
write(fsinyal, floattoStr(Ciri_4)+' ');
closefile(fsinyal);
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
form2.show;
form1.Hide;
end;
procedure TForm1.GroupBox4Click(Sender: TObject);
begin
end;
end.


