oui mais ça veut dire quoi ?
pour shematiser :
ben que lorsqu'on tape nos numeros sur le clavier , ça fait de la musique , chaque touche ayant sa propre frequence !
en fait il s'agit de 2 fréquences croisées (diffusé en parallèle )
bon d'accords , mais ce que vous ne savez peut etre pas,
c'est que si vous faites entendre a votre téléphone les fréquences des touches
ben il va composer le numéro ( alors que vous ne touchez pas votre clavier !! )
je vous ais fait un petit programme qui contient les Wav de chaque touches au format DTMF
pour l'exemple j'utilise le numero "3131" qui permet de savoir qui a cherché a nous appeler ! (numero gratuit)
bien sur si vous avez un portable essayer d'utiliser un de vos numeros
utilisation : une fois votre numero parametré
vous mettez votre telephone en ligne ( pour entendre le Biiip d'attente )
approchez le des hauts parleur de votre ordinateur (montez le son )
vous lancez mon prg , qui va faire sa petite musique , et hop votre correspondant ne tardera pas a répondre
c'est magique
pratique si vous vous programmez un carnet d'adresse avec vos numeros de telephone
vous pourrez demander a votre ordinateur de composer le numero a votre place
ou alors utiliser les fichiers de son, pour permettre a une page Html de vous permettre d'appeler vos correspondant
a partir de n'importe quel telephone , si votre telephone est en panne ,
celui d'un client peut faire l'affaire, si vous etes chez lui pour appeler votre boite
l'archive ici :
http://michel.dobro.free.fr/Forum_pb/DTMF/DTMF.zip
(Archive refaite avec des sons en 44100 16 bits pour etre compatible avec Linux/OSX )
amusez vous bien
voici juste le code (qui est deja dans l'archive avec les sons )
Code : Tout sélectionner
;Codé par Dobro
; pour le # le numero c'est 14
; pour * le numero c'est 15
Declare play_DTMF(numero_a_composer$)
Declare DTMF(num.s)
InitSound()
CatchSound(15, ?etoile)
CatchSound(14, ?diese)
CatchSound(13, ?D)
CatchSound(12, ?C)
CatchSound(11, ?B)
CatchSound(10, ?A)
CatchSound(9, ?_9)
CatchSound(8, ?_8)
CatchSound(7, ?_7)
CatchSound(6, ?_6)
CatchSound(5, ?_5)
CatchSound(4, ?_4)
CatchSound(3, ?_3)
CatchSound(2, ?_2)
CatchSound(1, ?_1)
CatchSound(0, ?_0)
; *****************************************************
numero_a_composer$="3131"
play_DTMF(numero_a_composer$)
; *************** Zone Procedure *************************
procedure play_DTMF(numero_a_composer$)
; By Dobro
calldebugger
for i=1 to len(numero_a_composer$)
num.s=mid(numero_a_composer$,i,1)
DTMF(num.s)
next i
Endprocedure
;
procedure DTMF(num.s)
; By Dobro
select num
Case "0"
PlaySound(0,#PB_Sound_Loop):delay(200):StopSound(0)
Case "1"
PlaySound(1,#PB_Sound_Loop):delay(200):StopSound(1)
Case "2"
PlaySound(2,#PB_Sound_Loop):delay(200):StopSound(2)
Case "3"
PlaySound(3,#PB_Sound_Loop):delay(200):StopSound(3)
Case "4"
PlaySound(4,#PB_Sound_Loop):delay(200):StopSound(4)
Case "5"
PlaySound(5,#PB_Sound_Loop):delay(200):StopSound(5)
Case "6"
PlaySound(6,#PB_Sound_Loop):delay(200):StopSound(6)
Case "7"
PlaySound(7,#PB_Sound_Loop):delay(200):StopSound(7)
Case "8"
PlaySound(8,#PB_Sound_Loop):delay(200):StopSound(8)
Case "9"
PlaySound(9,#PB_Sound_Loop):delay(200):StopSound(9)
Case "A"
PlaySound(10,#PB_Sound_Loop):delay(200):StopSound(10) ;A
Case "B"
PlaySound(11,#PB_Sound_Loop):delay(200):StopSound(11) ;B
Case "C"
PlaySound(12,#PB_Sound_Loop):delay(200):StopSound(12) ;C
Case "D"
PlaySound(13,#PB_Sound_Loop):delay(200):StopSound(13) ;D
Case "#"
PlaySound(14,#PB_Sound_Loop):delay(200):StopSound(14) ;#
Case "*"
PlaySound(15,#PB_Sound_Loop):delay(200):StopSound(15) ;*
Endselect
Endprocedure
DataSection
; By Dobro
etoile: IncludeBinary "etoile.wav"
diese: IncludeBinary "diese.wav"
D: IncludeBinary "D.wav"
C: IncludeBinary "C.wav"
B: IncludeBinary "B.wav"
A: IncludeBinary "A.wav"
_9: IncludeBinary "9.wav"
_8: IncludeBinary "8.wav"
_7: IncludeBinary "7.wav"
_6: IncludeBinary "6.wav"
_5: IncludeBinary "5.wav"
_4: IncludeBinary "4.wav"
_3: IncludeBinary "3.wav"
_2: IncludeBinary "2.wav"
_1: IncludeBinary "1.wav"
_0: IncludeBinary "0.wav"
EndDataSection
; EPB
autre Code adapté du miens (enfin, il a repris l'idée de base mais le code n'as plus rien a voir )par Wilbert du Forum anglais
sa version n'utilise pas de fichiers son Externe , mais genere les frequences directement dans le code
du coup marche pour OSX,et Linux
Code : Tout sélectionner
InitSound()
Procedure GenerateDTMF(Number.s)
Static Freq1.q = $066105C5053804B9, Freq2.q = $03AD0354030202B9
Protected *SampleData.Ascii, Samples, *WavData, c1.d, c2.d, i, s, l = Len(Number)
If l
Samples = l * 8820
*WavData = AllocateMemory(Samples + 44)
If *WavData
PokeL(*WavData, $46464952)
PokeL(*WavData + 4, Samples + 36)
PokeQ(*WavData + 8, $20746D6645564157)
PokeQ(*WavData + 16, $0001000100000010)
PokeQ(*WavData + 24, $0000AC440000AC44)
PokeQ(*WavData + 32, $6174616400080001)
PokeL(*WavData + 40, Samples)
FillMemory(*WavData + 44, Samples, 128)
While i < l
s = FindString("123A456B789C*0#D", Mid(Number, i + 1, 1)) - 1
If s >= 0
*SampleData = *WavData + i * 8820 + 44
c1 = PeekU(@Freq1 + (s & $3) << 1) * 2 * #PI / 44100
c2 = PeekU(@Freq2 + (s & $C) >> 1) * 2 * #PI / 44100
For s = 0 To 4409
*SampleData\a = 128 + 63 * Sin(s * c1) + 63 * Sin(s * c2)
*SampleData + 1
Next
EndIf
i + 1
Wend
EndIf
EndIf
ProcedureReturn *WavData
EndProcedure
Procedure PlayDTMF(Number.s, WaitUntilFinished = #False)
Static Sound
Protected *WavData = GenerateDTMF(Number)
If *WavData
If Sound : FreeSound(Sound) : EndIf
Sound = CatchSound(#PB_Any, *WavData)
FreeMemory(*WavData)
If Sound
PlaySound(Sound)
If WaitUntilFinished
While SoundStatus(Sound) = #PB_Sound_Playing : Delay(1) : Wend
EndIf
EndIf
EndIf
EndProcedure
PlayDTMF("3131", #True) ; EPB