11 hours ago
Easy example. Volume leve is used as byte indicator.
Code: (Select All)
ReDim Shared CodedSound(0) As Single
CodeSnd "Hi this is text example, this time volume level is used as byte - modulation. This maybe can be good between two computers, but not good for radio signal."
For i = 1 To UBound(CodedSound)
_SndRaw CodedSound(i)
Next i
Print EncodeSnd
Sub CodeSnd (Text As String)
ReDim CodedSound(Len(Text) * 100) As Single
Dim As Long I, L, G
SignalDuration = 100 'one signal amplitude lenght is 100 samples
stp = 1 / 256
For L = 1 To Len(Text)
For G = 1 To 100
CodedSound(I) = Asc(Text, L) * stp
I = I + 1
Next G
Next L
End Sub
Function EncodeSnd$
Dim As Long i, g, j
Dim As Single s
stp = 1 / 256
For i = 1 To (UBound(CodedSound) \ 100)
s = 0
For g = i To i + 99
s = s + CodedSound(j)
j = j + 1
Next g
s = (s / 100) * 256
e$ = e$ + Chr$(s)
Next i
EncodeSnd$ = e$
End Function