LAMPIRAN A : LISTING PROGRAM

  

LAMPIRAN A : LISTING PROGRAM

1. frmMenu.frm

  Dim CN As Connection Dim rsHapus As Recordset Private Sub DfaHasil_Click() Call frmLap.Cetak End Sub Private Sub Form_Load() Set CN = New ADODB.Connection

  CN.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\dbLLSB.mdb;Persist Security Info=False"

  CN.Open End Sub Private Sub HapUji_Click() On Error Resume Next

  XX = MsgBox("Semua data hasil pengujian mau dihapus ?", vbYesNo) If XX = vbYes Then Set rsHapus = New ADODB.Recordset rsHapus.Open "Delete from Hasil1", CN, 1, 2 Set rsHapus = Nothing Kill App.Path & "\BackUpMP3\*.*" MsgBox "Proses selesai" Exit Sub Else MsgBox "Batal ..." End If End Sub Private Sub qt_Click() End End Sub Private Sub Steg_Click() Main.Show End Sub

  Option Explicit Dim FSO As New FileSystemObject, fileInfo As File Private WithEvents AAC As clsAAC Sub CariID() Set rsCari = New ADODB.Recordset rsCari.Open "Select * from Hasil1 order by ID desc", CN, 1, 2 If Not rsCari.EOF Then

  ID = rsCari!ID + 1 Else

  ID = 1 End If Set rsCari = Nothing End Sub Sub Bersih() List1.Visible = True List2.Visible = True List3.Visible = True List1.Clear List2.Clear List3.Clear Label8.Visible = True Label15.Visible = True Label18.Visible = True Text1.Text = "" Text2.Text = "" Text4.Text = "" lblUkuran1 = "" lblUkuran2 = "" Ukuran1 = 0 Ukuran2 = 0 lblKelang = "" Kelang = 0 Text3(0).Text = "" Text3(1).Text = "" List1.Clear List2.Clear pesan = "" bolSisip = False bolEkstrak = False NmFile1 = "" Title1 = "" Pesan1 = "" Lama1 = 0 Lama2 = 0 Kode = "" lblLama = "" bolSisip = False cmdSisip.Enabled = False cmdEkstrak.Enabled = False cmdLoad.Enabled = True cmdLoad.SetFocus End Sub Private Sub cmdEkstrak_Click() List1.Visible = False

  List2.Visible = False Label8.Visible = False Label15.Visible = False Label18.Visible = False List3.Visible = False Label13.Visible = False Label17.Visible = False lblUkuran2.Visible = False Kode = "E" bolEkstrak = True Call AAC.ExtractPesan(Text1.Text, Text4.Text) End Sub Private Sub cmdLoad_Click() Call Bersih cmd.Filter = "All Files (*.MP3)|*.MP3" cmd.DialogTitle = "Open File" cmd.ShowOpen If (cmd.Filename <> "") Then Set fileInfo = FSO.GetFile(cmd.Filename) Ukuran1 = fileInfo.Size lblUkuran1.Caption = Ukuran1 / 1024 NmFile1 = "" NmFile1 = cmd.Filename Title1 = cmd.FileTitle Text1 = cmd.Filename End If End Sub Sub Simpan() Call CariID Set rsNo = New ADODB.Recordset rsNo.Open "Hasil1", CN, adOpenDynamic, adLockOptimistic rsNo.AddNew rsNo!ID = ID rsNo!NmFile = NmFile1 rsNo!Title = Title1 rsNo!Ukuran = Ukuran1 rsNo!pesan = Pesan1 If Kode = "S" Then rsNo!Lama = Lama1 Else rsNo!Lama = Lama2 End If rsNo!Kelang = Val(Text4.Text) rsNo!status = "1" rsNo!Kode = Kode rsNo.Update Set rsNo = Nothing

  MsgBox "Data sudah disimpan" End Sub 'Private Sub cmdSimpan_Click() Call Simpan cmdSimpan.Enabled = False Call Bersih End Sub Private Sub cmdSisip_Click() List1.Visible = True List2.Visible = True Label8.Visible = True Label15.Visible = True List3.Visible = True Label18.Visible = True Label13.Visible = True Label17.Visible = True lblUkuran2.Visible = True Pesan1 = RTrim(Text2) Kode = "S" bolSisip = True Call AAC.GetAudioData(Text1.Text, fileInfo.Name, Text2.Text, Text4.Text) End Sub Private Sub cmdTutup_Click() Set Main = Nothing Unload Me End Sub Private Sub Form_Activate() If Kode = "S" Then List1.Visible = True List2.Visible = True Label8.Visible = True Label15.Visible = True List3.Visible = True Label18.Visible = True ElseIf Kode = "E" Then List1.Visible = False List2.Visible = False Label8.Visible = False Label15.Visible = False List3.Visible = False Label18.Visible = False Else List1.Visible = True List2.Visible = True Label8.Visible = True

  Label15.Visible = True List3.Visible = True Label18.Visible = True End If cmdLoad.Enabled = True cmdSisip.Enabled = False cmdEkstrak.Enabled = False If bolSisip = True Then lblKelang.Caption = Kelang ElseIf bolEkstrak = True Then lblKelang.Caption = Kelang End If cmdLoad.SetFocus End Sub Private Sub Form_Load() Set AAC = New clsAAC Set CN = New ADODB.Connection CN.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\dbLLSB.mdb;Persist Security Info=False" CN.Open End Sub Private Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single) OnForm End Sub Private Sub Form_Unload(Cancel As Integer) Set Main = Nothing Unload Me End Sub Private Sub Text2_Change() If Text2.Text = "" Then cmdSisip.Enabled = False Else cmdSisip.Enabled = True End If End Sub Private Sub Text4_Change() If (Text4.Text = "") Then cmdEkstrak.Enabled = False Else cmdEkstrak.Enabled = True End If End Sub

  3. frmLap.frm

  Option Explicit Dim rsCari As Recordset Private Sub cmdCetak_Click() Call Cetak End Sub Private Sub Command1_Click() Unload Me End Sub Sub Cetak() Me.WindowState = 2 cr.ReportFileName = App.Path & "\Report 3.rpt" cr.RetrieveDataFiles cr.Connect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\dbLLSB.mdb;Persist Security Info=False" cr.WindowShowRefreshBtn = True cr.PrintReport cr.WindowState = crptMaximized cr.Action = 1 End Sub Private Sub Form_Load() Set CN = New ADODB.Connection CN.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\dbLLSB.mdb;Persist Security Info=False" CN.Open End Sub Private Sub Form_Unload(Cancel As Integer) Unload Me frmMenu.Show End Sub

  4. frmTmplProses.frm

  Dim tmpJarak As Integer Private WithEvents AAC As clsAAC Public Sub BinerAudio2(Teks As String) rtbSisip.SelBold = False rtbSisip.SelStart = rtbSisip.SelStart rtbSisip.SelText = Teks If tmpJarak = jarak + 1 Then rtbSisip.SelStart = rtbSisip.SelStart - 1 rtbSisip.SelLength = 1 rtbSisip.SelBold = True rtbSisip.SelLength = 0 rtbSisip.SelBold = False rtbSisip.SelStart = rtbSisip.SelStart + 1 tmpJarak = 0 End If End Sub Public Sub IsiRTBSisip() Dim noBaris As Integer Dim noCount As Integer Dim i& tmpJarak = jarak + 1 noCount = 0 noBaris = 0 For i = 0 To UBound(sample_audio_sisip) If noCount <> 0 And noCount <> 4 Then Call BinerAudio2(sample_audio_sisip(i)) rtbSisip.SelText = " " End If If noCount = 0 Then rtbSisip.SelText = "1) " Call BinerAudio2(sample_audio_sisip(i)) rtbSisip.SelText = " " noBaris = 1 End If rtbSisip.SelBold = False If noCount = 4 Then noBaris = noBaris + 1 rtbSisip.SelText = vbCrLf rtbSisip.SelText = noBaris & ") " Call BinerAudio2(sample_audio_sisip(i)) rtbSisip.SelText = " " noCount = 0 End If noCount = noCount + 1 tmpJarak = tmpJarak + 1 Next End Sub Public Sub BinerAudio1(Teks As String) rtbBiner.SelBold = False rtbBiner.SelText = Teks End Sub Public Sub IsiRTBBiner() Dim noBaris As Integer Dim noCount As Integer

  Dim i& noCount = 0 noBaris = 0 For i = 0 To UBound(sample_audio) If noCount <> 0 And noCount <> 4 Then Call BinerAudio1(sample_audio(i)) rtbBiner.SelText = " " End If If noCount = 0 Then rtbBiner.SelText = "1) " Call BinerAudio1(sample_audio(i)) rtbBiner.SelText = " " noBaris = 1 End If If noCount = 4 Then noBaris = noBaris + 1 rtbBiner.SelText = vbCrLf rtbBiner.SelText = noBaris & ") " Call BinerAudio1(sample_audio(i)) rtbBiner.SelText = " " noCount = 0 End If noCount = noCount + 1 Next End Sub Private Sub Form_Load() If Kode = "S" Then IsiRTBPesan (pesanTeks) IsiRTBBiner IsiRTBSisip IsiFileAudio IsiFileSisip Else IsiRTBPesan (pesanTeks) IsiRTBSisip IsiFileSisip lblTeks.Visible = False lblBiner.Visible = False rtbTeks.Visible = False rtbBiner.Visible = False End If End Sub Private Sub Form_Unload(Cancel As Integer) Set frmLap = Nothing Unload Me

  End Sub Public Sub IsiFileAudio() Dim noBaris As Integer Dim noCount As Integer Dim i& noCount = 0 noBaris = 0 For i = 0 To UBound(FileAudio) If noCount <> 0 And noCount <> 4 Then Call TeksAudio1(FileAudio(i)) rtbTeks.SelText = " " End If If noCount = 0 Then rtbTeks.SelText = "1) " Call TeksAudio1(FileAudio(i)) rtbTeks.SelText = " " noBaris = 1 End If If noCount = 4 Then noBaris = noBaris + 1 rtbTeks.SelText = vbCrLf rtbTeks.SelText = noBaris & ") " Call TeksAudio1(FileAudio(i)) rtbTeks.SelText = " " noCount = 0 End If noCount = noCount + 1 Next End Sub Public Sub TeksAudio1(Teks As Byte) rtbTeks.SelBold = False rtbTeks.SelText = DecToChar(Teks) End Sub Public Sub IsiFileSisip() Dim noBaris As Integer Dim noCount As Integer Dim i& tmpJarak = jarak + 1 noCount = 0 noBaris = 0 For i = 0 To UBound(FileAudioSisip) If noCount <> 0 And noCount <> 4 Then Call TeksAudio2(FileAudioSisip(i)) rtbTeksSisip.SelText = " "

  End If If noCount = 0 Then rtbTeksSisip.SelText = "1) " Call TeksAudio2(FileAudioSisip(i)) rtbTeksSisip.SelText = " " noBaris = 1 End If If noCount = 4 Then noBaris = noBaris + 1 rtbTeksSisip.SelText = vbCrLf rtbTeksSisip.SelText = noBaris & ") " Call TeksAudio2(FileAudioSisip(i)) rtbTeksSisip.SelText = " " noCount = 0 End If noCount = noCount + 1 Next End Sub Public Sub TeksAudio2(Teks As Byte) rtbTeksSisip.SelBold = False rtbTeksSisip.SelText = DecToChar(Teks) If tmpJarak = jarak + 1 Then rtbTeksSisip.SelStart = rtbSisip.SelStart - 1 rtbTeksSisip.SelLength = 1 rtbTeksSisip.SelBold = True rtbTeksSisip.SelLength = 0 rtbTeksSisip.SelBold = False rtbTeksSisip.SelStart = rtbSisip.SelStart + 1 tmpJarak = 0 End If End Sub Public Function DecToChar(Dec As Byte) As String Dim a As String a = Chr(Dec) DecToChar = a End Function Public Sub IsiRTBPesan(HiddenTeks As String) Dim x As Long Dim a As Long Dim b As String Dim noBrs As Integer Dim stringTeks1 As String Dim stringTeks2 As String

  If Kode = "S" Then Else End If noBrs = 1 For x = 1 To Len(HiddenTeks) a = Asc(Mid(HiddenTeks, x, 1)) b = DecimalToBinary(a) If Kode = "S" Then If noBrs = 1 Then rtbPesan.SelText = "1) " & Mid(HiddenTeks, x, 1) & " = " & b Else rtbPesan.SelText = vbCrLf rtbPesan.SelText = noBrs & ") " & Mid(HiddenTeks, x, 1) & " = " & b End If Else If noBrs = 1 Then rtbPesan.SelText = "1) " & b & " = " & Mid(HiddenTeks, x, 1) Else rtbPesan.SelText = vbCrLf rtbPesan.SelText = noBrs & ") " & b & " = " & Mid(HiddenTeks, x, 1) End If End If noBrs = noBrs + 1 Next End Sub Public Function DecimalToBinary(DecimalNum As Long) As String Dim tmp As String Dim n As Long n = DecimalNum tmp = Trim(Str(n Mod 2)) n = n \ 2 Do While n <> 0 tmp = Trim(Str(n Mod 2)) & tmp n = n \ 2 Loop DecimalToBinary = Right("00000000" & tmp, 8) End Function

  5. clsAAC.cls

  Option Explicit Dim SampleAudio() As String Event Progress(Procent As Integer) Private Function FileExist(Filename As String) As Boolean On Error GoTo FileDoesNotExist Call FileLen(Filename) FileExist = True Exit Function FileDoesNotExist: FileExist = False End Function Public Sub GetAudioData(SrcFile As String, NamaFile As String, pesan As String, numKelang As String) Dim FileNum As Integer Dim FileNew As Integer Dim FileBinary() As Byte Dim FileSize As Long Dim i&, a&, x&, j&, k&, syncSmple& Dim status As Boolean Dim n&, n_bit& Dim BinerPesan As String 'Pengecekan file tersebut ada atau tidak ada If (Not FileExist(SrcFile)) Then Err.Raise vbObjectError, "clsAAC.GetAudioData", "File tidak ada ...." End If time.StartTimer 'Ambil semua data yang ada pada file FileNum = FreeFile Open SrcFile For Binary As #FileNum ReDim FileBinary(0 To LOF(FileNum) - 1) ReDim SampleAudio(0 To LOF(FileNum) - 1) Get #FileNum, , FileBinary() FileSize = LOF(FileNum) Close #FileNum k = 0 For j = 0 To FileSize - 2 If (FileBinary(j) = &HFF) And (FileBinary(j + 1) = &HFB) Then j = j + 36 k = k + 36 End If

  Next syncSmple = k Main.List1.Clear Main.List2.Clear Main.List3.Clear If (numKelang = "") Then MsgBox "Jumlah Lompatan sebagai kata kunci belum Anda isi", vbInformation, "Info" Else BinerPesan = HiddenTextToBinary(pesan) n_bit = Len(BinerPesan) If ((FileSize - syncSmple) < Len(Pesan)) Then MsgBox "Pesan Teks lebih besar daripada ukuran file audio yang bisa dimasukkan", vbInformation, "Info" Else status = False n = numKelang a = 0 x = 1 For i = 0 To FileSize - 1 ReCheck: If (FileBinary(i) = &HFF) And (FileBinary(i + 1) = &HFB) Then status = True i = i + 36 GoTo GetSmplAud End If GetSmplAud: If status = True Then Do While i <> FileSize - 1 If Not ((FileBinary(i) = &HFF) And (FileBinary(i + 1) = &HFB)) Then SampleAudio(a) = DecimalToBinary(Val(FileBinary(i))) Main.List2.AddItem (SampleAudio(a)) n = n + 1 'proses LLSB If (n = numKelang + 1) And (x <= Len(BinerPesan)) Then SampleAudio(a) = Left(SampleAudio(a), 7) & Mid(BinerPesan, x, 1) x = x + 1 n = 0 FileBinary(i) = BinaryToDecimal(SampleAudio(a)) Main.List3.AddItem (SampleAudio(a)) If (x > Len(BinerPesan)) Then ' dibuat supaya program tidak terlalu lama Exit For End If End If a = a + 1 i = i + 1 Else status = False n = numKelang GoTo ReCheck End If Loop End If Next ‘save new one FileNew = FreeFile Open App.Path & "\BackUpMP3\" & NamaFile For Binary As #FileNew Put #FileNew, , FileBinary() Seek #FileNew, LOF(FileNew) + 1 'Put #FileNew, , Right(" " & numKelang, 2) & Right(" " & n_bit, 3) Main.lblUkuran2.Caption = LOF(FileNew) / 1024 Close #FileNew time.StopTimer Main.lblLama.Caption = Format(time.Elasped, "0.000000") Lama1 = Format(time.Elasped, "0.000000") Call Main.Simpan 'End If End If End Sub Public Function BinaryToDecimal(Binary As String) As Long Dim n As Long Dim s As Integer For s = 1 To Len(Binary) n = n + (Mid(Binary, Len(Binary) - s + 1, 1) * (2 ^ (s - 1))) Next s BinaryToDecimal = n End Function Public Function DecimalToBinary(DecimalNum As Long) As String Dim tmp As String Dim n As Long n = DecimalNum tmp = Trim(Str(n Mod 2)) n = n \ 2 Do While n <> 0 tmp = Trim(Str(n Mod 2)) & tmp n = n \ 2 Loop DecimalToBinary = Right("00000000" & tmp, 8) End Function

  Public Function HiddenTextToBinary(HiddenTeks As String) As String Dim x, a As Long Dim b As String For x = 1 To Len(HiddenTeks) a = Asc(Mid(HiddenTeks, x, 1)) b = b & DecimalToBinary(a) Main.List1.AddItem (Right("00000000" & DecimalToBinary(a), 8)) Next HiddenTextToBinary = b End Function Public Function HiddenTextToChar(HiddenBinary As String) As String Dim x, a, b, c As Long Dim HideArr() As String Dim Teks As String ReDim HideArr(0 To Len(HiddenBinary) / 8) a = 0 x = 1 Do While x <= Len(HiddenBinary) HideArr(a) = Mid(HiddenBinary, x, 8) a = a + 1 x = x + 8 Loop For b = 1 To a c = BinaryToDecimal(HideArr(b - 1)) Teks = Teks & Chr(c) Next HiddenTextToChar = Teks End Function Public Sub ExtractPesan(SrcFile As String, num_Kelang As String) Dim FileNum As Integer Dim FileNew As Integer Dim FileBinary() As Byte Dim FileSize As Long Dim i&, a& Dim status As Boolean Dim n&, x& Dim BinerPesan As String Dim PesanChar As String Dim BitPesan As String Dim GetKelang As String Dim GetNBiner As String Dim numKelang As Integer 'Pastikan file tersebut ada

  If (Not FileExist(SrcFile)) Then Err.Raise vbObjectError, "clsAAC.ExtractPesan", "File tidak ada ...." End If 'Ambil semua data yang ada pada file FileNum = FreeFile Open SrcFile For Binary As #FileNum ReDim FileBinary(0 To LOF(FileNum) - 1) ReDim SampleAudio(0 To LOF(FileNum) - 1) Get #FileNum, , FileBinary() FileSize = LOF(FileNum) Close #FileNum 'GetKelang = Chr(FileBinary(FileSize - 2)) & Chr(FileBinary(FileSize - 1)) 'GetKelang = Chr(FileBinary(FileSize - 5)) & Chr(FileBinary(FileSize - 4)) 'GetNBiner = Chr(FileBinary(FileSize - 3)) & Chr(FileBinary(FileSize - 2)) & Chr(FileBinary(FileSize - 1)) If (num_Kelang = "") Then MsgBox "Jumlah Lompatan sebagai kata kunci belum Anda isi", vbInformation, "Info" ElseIf Not (Trim(GetKelang) = num_Kelang) Then MsgBox "Kata kunci Anda salah!", vbInformation, "Info" Else time.StartTimer numKelang = num_Kelang 'jarak = numKelang ' PesanChar = "" BinerPesan = "" status = False n = numKelang a = 0 x = 1 For i = 0 To FileSize - 1 ReCheck: If (FileBinary(i) = &HFF) And (FileBinary(i + 1) = &HFB) Then status = True i = i + 36 GoTo GetSmplAud End If GetSmplAud: If status = True Then Do While i <> FileSize - 1 If Not ((FileBinary(i) = &HFF) And (FileBinary(i + 1) = &HFB)) Then SampleAudio(a) = DecimalToBinary(Val(FileBinary(i))) n = n + 1 'proses extract LLSB If (n = numKelang + 1) Then BitPesan = Right(SampleAudio(a), 1) BinerPesan = BinerPesan & BitPesan x = x + 1 n = 0 If (Len(BinerPesan) = 8) Then

  If Not (GetNBiner + 1 < x) Then PesanChar = PesanChar & BinerPesan BinerPesan = "" Else PesanChar = HiddenTextToChar(PesanChar) Main.Text2.Text = PesanChar Exit For End If End If End If a = a + 1 i = i + 1 Else status = False n = numKelang GoTo ReCheck End If Loop End If Next time.StopTimer Main.lblLama.Caption = Format(time.Elasped, "0.000000") Lama2 = Format(time.Elasped, "0.000000") Pesan1 = Trim(Main.Text2.Text) Call Main.Simpan End If End Sub