Accueil > FAQ > WinDev API | FAQ |
Demandé et répondu par Drcharly93 le 13-Jul-2007 11:27 (7103 Lectures)
Comment Convertir un fichier texte en fichier audio txt to avi
// création de fichier WAV à partir d'un texte
********** FORMATS SAPI *****************************************
SAFTDefault = -1
SAFTNoAssignedFormat = 0
SAFTText = 1
SAFTNonStandardFormat = 2
SAFTExtendedAudioFormat = 3
// Standard PCM wave formats
SAFT8kHz8BitMono = 4
SAFT8kHz8BitStereo = 5
SAFT8kHz16BitMono = 6
SAFT8kHz16BitStereo = 7
SAFT11kHz8BitMono = 8
SAFT11kHz8BitStereo = 9
SAFT11kHz16BitMono = 10
SAFT11kHz16BitStereo = 11
SAFT12kHz8BitMono = 12
SAFT12kHz8BitStereo = 13
SAFT12kHz16BitMono = 14
SAFT12kHz16BitStereo = 15
SAFT16kHz8BitMono = 16
SAFT16kHz8BitStereo = 17
SAFT16kHz16BitMono = 18
SAFT16kHz16BitStereo = 19
SAFT22kHz8BitMono = 20
SAFT22kHz8BitStereo = 21
SAFT22kHz16BitMono = 22
SAFT22kHz16BitStereo = 23
SAFT24kHz8BitMono = 24
SAFT24kHz8BitStereo = 25
SAFT24kHz16BitMono = 26
SAFT24kHz16BitStereo = 27
SAFT32kHz8BitMono = 28
SAFT32kHz8BitStereo = 29
SAFT32kHz16BitMono = 30
SAFT32kHz16BitStereo = 31
SAFT44kHz8BitMono = 32
SAFT44kHz8BitStereo = 33
SAFT44kHz16BitMono = 34
SAFT44kHz16BitStereo = 35
SAFT48kHz8BitMono = 36
SAFT48kHz8BitStereo = 37
SAFT48kHz16BitMono = 38
SAFT48kHz16BitStereo = 39
// TrueSpeech format
SAFTTrueSpeech_8kHz1BitMono = 40
// A-Law formats
SAFTCCITT_ALaw_8kHzMono = 41
SAFTCCITT_ALaw_8kHzStereo = 42
SAFTCCITT_ALaw_11kHzMono = 43
SAFTCCITT_ALaw_11kHzStereo = 4
SAFTCCITT_ALaw_22kHzMono = 44
SAFTCCITT_ALaw_22kHzStereo = 45
SAFTCCITT_ALaw_44kHzMono = 46
SAFTCCITT_ALaw_44kHzStereo = 47
// u-Law formats
SAFTCCITT_uLaw_8kHzMono = 48
SAFTCCITT_uLaw_8kHzStereo = 49
SAFTCCITT_uLaw_11kHzMono = 50
SAFTCCITT_uLaw_11kHzStereo = 51
SAFTCCITT_uLaw_22kHzMono = 52
SAFTCCITT_uLaw_22kHzStereo = 53
SAFTCCITT_uLaw_44kHzMono = 54
SAFTCCITT_uLaw_44kHzStereo = 55
SAFTADPCM_8kHzMono = 56
SAFTADPCM_8kHzStereo = 57
SAFTADPCM_11kHzMono = 58
SAFTADPCM_11kHzStereo = 59
SAFTADPCM_22kHzMono = 60
SAFTADPCM_22kHzStereo = 61
SAFTADPCM_44kHzMono = 62
SAFTADPCM_44kHzStereo = 63
// GSM 6.10 formats
SAFTGSM610_8kHzMono = 64
SAFTGSM610_11kHzMono = 65
SAFTGSM610_22kHzMono = 66
SAFTGSM610_44kHzMono = 67
// Other formats
SAFTNUM_FORMATS = 68
---------------------------------------------------------------------
// lecture d'un fichier WAV ou MP3
Origine de cette source : News Group de PCSOFT
Merci à puccettijc@free.fr
PROCEDURE TexteVersWav(sTexteAEnregistrer, nFormat=18, sFichierWav)
objFileStream est un objet Automation dynamique
objVoice est un objet Automation dynamique
objFileStream = allouer un objet OLE("SAPI.SpFileStream")
objVoice = allouer un objet OLE("SAPI.SPVOICE")
objFileStream>>Format>>Type = nFormat
objFileStream>>Open(sFichierWav, 3, OLEFaux)
objVoice>>AudioOutputStream = objFileStream
objVoice>>Speak(sTexteAEnregistrer)
objFileStream>>Close()
libérer objFileStream
libérer objVoice
RENVOYER sFichierWav
********** FORMATS SAPI *****************************************
SAFTDefault = -1
SAFTNoAssignedFormat = 0
SAFTText = 1
SAFTNonStandardFormat = 2
SAFTExtendedAudioFormat = 3
// Standard PCM wave formats
SAFT8kHz8BitMono = 4
SAFT8kHz8BitStereo = 5
SAFT8kHz16BitMono = 6
SAFT8kHz16BitStereo = 7
SAFT11kHz8BitMono = 8
SAFT11kHz8BitStereo = 9
SAFT11kHz16BitMono = 10
SAFT11kHz16BitStereo = 11
SAFT12kHz8BitMono = 12
SAFT12kHz8BitStereo = 13
SAFT12kHz16BitMono = 14
SAFT12kHz16BitStereo = 15
SAFT16kHz8BitMono = 16
SAFT16kHz8BitStereo = 17
SAFT16kHz16BitMono = 18
SAFT16kHz16BitStereo = 19
SAFT22kHz8BitMono = 20
SAFT22kHz8BitStereo = 21
SAFT22kHz16BitMono = 22
SAFT22kHz16BitStereo = 23
SAFT24kHz8BitMono = 24
SAFT24kHz8BitStereo = 25
SAFT24kHz16BitMono = 26
SAFT24kHz16BitStereo = 27
SAFT32kHz8BitMono = 28
SAFT32kHz8BitStereo = 29
SAFT32kHz16BitMono = 30
SAFT32kHz16BitStereo = 31
SAFT44kHz8BitMono = 32
SAFT44kHz8BitStereo = 33
SAFT44kHz16BitMono = 34
SAFT44kHz16BitStereo = 35
SAFT48kHz8BitMono = 36
SAFT48kHz8BitStereo = 37
SAFT48kHz16BitMono = 38
SAFT48kHz16BitStereo = 39
// TrueSpeech format
SAFTTrueSpeech_8kHz1BitMono = 40
// A-Law formats
SAFTCCITT_ALaw_8kHzMono = 41
SAFTCCITT_ALaw_8kHzStereo = 42
SAFTCCITT_ALaw_11kHzMono = 43
SAFTCCITT_ALaw_11kHzStereo = 4
SAFTCCITT_ALaw_22kHzMono = 44
SAFTCCITT_ALaw_22kHzStereo = 45
SAFTCCITT_ALaw_44kHzMono = 46
SAFTCCITT_ALaw_44kHzStereo = 47
// u-Law formats
SAFTCCITT_uLaw_8kHzMono = 48
SAFTCCITT_uLaw_8kHzStereo = 49
SAFTCCITT_uLaw_11kHzMono = 50
SAFTCCITT_uLaw_11kHzStereo = 51
SAFTCCITT_uLaw_22kHzMono = 52
SAFTCCITT_uLaw_22kHzStereo = 53
SAFTCCITT_uLaw_44kHzMono = 54
SAFTCCITT_uLaw_44kHzStereo = 55
SAFTADPCM_8kHzMono = 56
SAFTADPCM_8kHzStereo = 57
SAFTADPCM_11kHzMono = 58
SAFTADPCM_11kHzStereo = 59
SAFTADPCM_22kHzMono = 60
SAFTADPCM_22kHzStereo = 61
SAFTADPCM_44kHzMono = 62
SAFTADPCM_44kHzStereo = 63
// GSM 6.10 formats
SAFTGSM610_8kHzMono = 64
SAFTGSM610_11kHzMono = 65
SAFTGSM610_22kHzMono = 66
SAFTGSM610_44kHzMono = 67
// Other formats
SAFTNUM_FORMATS = 68
---------------------------------------------------------------------
// lecture d'un fichier WAV ou MP3
PROCEDURE LectureWAVouMP3(sFichierWav)
MCIArrêt("MonSon")
MCIFerme("MonSon")
Multitâche(-5)
SI MCIOuvre(sFichierWav, "MonSon") ALORS
SI MCIJoue("MonSon") ALORS
TANTQUE MCIEtat("MonSon") = MciEtatJoue
Multitâche(-5)
FIN
MCIFerme("MonSon")
FIN
SINON
Info("Erreur sur l'ouverture du fichier son.")
FIN
Origine de cette source : News Group de PCSOFT
Merci à puccettijc@free.fr
|