Error - Audio playback with missing files - Forum

Forum Navigation
You need to log in to create posts and topics.

Error - Audio playback with missing files

Good evening,

I am currently working on a code previously proposed by Gaev, thanks again to him.

I enter numbers in a "2020" text field
then the application responds with the audio "two zero two zero"
no problem with this code:

StrLen "[myNumber]" "[myNumberLen]"
If "[myNumberLen]" ">" "0"
Loop "1" "[myNumberLen]" "[thisPosition]"
SubStr "[myNumber]" "[thisPosition]" "1" "[thisNumber]"
PlaySoundFile "!say[thisNumber].wav" "Wait"
Delay "[100]"
EndLoop
EndIf

My problem becomes this when I write "2020 2020" ... 2020, a space and, 2020 ...
the application responds "two zero two zero" but hangs on the space present in the text field
and an error message appears: "Error .wav This file cannot be extracted and therefore cannot be distributed".
This space between 2020 and 2020 gives me this error message, but remains essential for my application and in the text field!

On the other hand, if in Project properties / Various options: / ... I choose: Do not display error messages
the application responds well with the audio "two zero two zero two zero two zero"

How to give my application the possibility of continuing reading without blocking on a space or an absent wav file for my application,
and without asking my application not to display error messages?

Thanks for any guidance and ideas to solve my problem.

Claude GUYOT
"Merci beaucoup d'aimé ce logiciel autant que moi."

.-.

Bonsoir,

Je travaille actuellement sur un code proposé jadis par Gaev, merci encore à lui.

J'entre des nombres dans un champ de texte "2020"
puis l'application répond avec l'audio " deux zéro deux zéro"
acun problème avec ce code :

StrLen "[myNumber]" "[myNumberLen]"
If "[myNumberLen]" ">" "0"
Loop "1" "[myNumberLen]" "[thisPosition]"
SubStr "[myNumber]" "[thisPosition]" "1" "[thisNumber]"
PlaySoundFile "!say[thisNumber].wav" "Wait"
Delay "[100]"
EndLoop
EndIf

Mon problème devient le suivant quand j'écris "2020 2020" ... 2020, un espace et, 2020 ...
l'application répond " deux zéro deux zéro" mais bloque sur l'espace présent dans le champ texte
et un message d'erreur apparait: "Erreur .wav Ce fichier ne peut pat être extrait et donc ne peut pas être diffusé".
Cet espace entre 2020 et 2020 me provoque ce message d'erreur, mais reste indispensable à mon application et dans le champ texte !

Par contre, si dans Propriétés du projet / Options diverses:/ ... Je choisis : Ne pas afficher les messages d'erreur
l'application répond bien avec l'audio " deux zéro deux zéro deux zéro deux zéro"

Comment donner à mon application la possibilité de continuer la lecture sans bloquer sur un espace ou un fichier wav absent pour mon application,
et sans demander à mon application de ne pas afficher les messages d'erreur ?

Merci pour toutes orientations et idées à résoudre mon problème.

Claude GUYOT
"Thank you very much for loving this software as much as I do."

@proforma-guyot

Short answer ...

StrLen "[myNumber]" "[myNumberLen]"
If "[myNumberLen]" ">" "0"
   Loop "1" "[myNumberLen]" "[thisPosition]"
      SubStr "[myNumber]" "[thisPosition]" "1" "[thisNumber]"
      If "[thisNumber]" "<>" " "
         PlaySoundFile "!say[thisNumber].wav" "Wait"
         Delay "[100]"
      EndIf
   EndLoop
EndIf

 

If you want to make sure that other (invalid) characters input by the user also do not cause problems, might be best to "check if the associated file exists (FileExists) .. and only invoke the PlaySoundFile if it does.

Gaev,

Thank you for your intervention and good answer.

My problem of space between sounds is solved, and the reading is fluid with the sounds present and / or available for my advertisement. I will now work for the sounds not present and / not available for my ad.

Claude GUYOT
"Merci beaucoup d'aimé ce logiciel autant que moi."

.-.

Gaev,
Merci pour ton intervention et bonne réponse.

Mon problème d'espace entre sons est résolu, et la lecture est fluide avec les sons présents et/ou disponibles pour ma pub. Je vais maintenant travailler pour les sons non présents et/non disponibles pour ma pub.

Claude GUYOT
"Thank you very much for loving this software as much as I do."

Uploaded files:
  • You need to login to have access to uploads.

@proforma-guyot

Another option. In addition.

You can treat a space as a space. Its ASCII code is [#32].
This is a special character that will be interpreted as a space.
For example, if a space is detected you can pause slightly longer to separate one row of digits from another. As we do when we say words.

Vadim,

Thank you for your intervention and a new solution to solve my space problem.
Indeed it also responds very well to the problem.
Gaev previously reminded me: "If you want to make sure that the other (invalid) characters entered by the user do not cause problems either, it may be better to" check if the associated file exists (FileExists). . and call the PlaySoundFile only if it does. "
ASCII codes will allow me, I think, to create more easily a character strings (invalid) that can possibly be entered by a user ...

Claude GUYOT
"Merci beaucoup d'aimé ce logiciel autant que moi."

.-.

Vadim,

Merci pour ton intervention et une nouvelle solution pour résoudre mon problème d'espace.
En effet elle répond également très bien au problème.
Gaev précédemment m’a rappeler justement : "Si vous voulez vous assurer que les autres caractères (invalides) saisis par l'utilisateur ne causent pas non plus de problèmes, il peut être préférable de "vérifier si le fichier associé existe (FileExists) .. et d'appeler le PlaySoundFile uniquement si c'est le cas."
Les codes ASCII vont me permettre, je pense, de créer plus facilement une chaines de caractères (invalides) pouvant être éventuellement saisis par un utilisateur ...

Claude GUYOT
"Thank you very much for loving this software as much as I do."

Uploaded files:
  • You need to login to have access to uploads.

I am still working on a sound accompaniment project in addition to the visual of my Pub.
Gaev and Vadim pleasantly solved my reading problem for a space written in an Entry_de_texte,
which is logical in the writing Claude GUYOT 2020 but not in phonic before the intervention of Gaev and Vadim with the solutions:
by Gaev: If "[thisNumber]" "<>" "" and by Vadim: If "[thisNumber]" "<>" "[# 32]".

My obstacle is, what if two conditions arise?
For example [# 32] and [# 42] In a writing in the object "Entree_de_texte"?
How to cummulate two conditions to avoid in the code ...?

Any directions of your experiments, or results, would be great.

Claude GUYOT
"Merci beaucoup d'aimé ce logiciel autant que moi."
.-.

Je travaille toujours sur un projet d'accompagnement phonique en complément du visuel de ma Pub.
Gaev et Vadim m'ont agréablements résolus mon problème de lecture pour un espace écrit dans une Entree_de_texte,
qui est logique dans l'écriture Claude GUYOT 2020 mais pas en phonique avant l'intervention de Gaev et Vadim avec les solutions :
par Gaev : If "[thisNumber]" "<>" " " et par Vadim : If "[thisNumber]" "<>" "[#32]".

Mon obstacle est, comment faire si deux conditions se présentent ?
Par exemple [#32] et [#42] Dans un écrit dans l'objet "Entree_de_texte" ?
Comment cummuler deux conditions à éviter dans le code ... ?

Toutes orientations de vos expériences, ou résultats, seraient super.

Claude GUYOT
"Thank you very much for loving this software as much as I do."

I think I solved the problem with this line:
IfEx "[thisNumber] <> [#32] AND [thisNumber] <> [#42]"

StrLen "[myNumber]" "[myNumberLen]"
If "[myNumberLen]" ">" "0"
   Loop "1" "[myNumberLen]" "[thisPosition]"
      SubStr "[myNumber]" "[thisPosition]" "1" "[thisNumber]"
IfEx "[thisNumber] <> [#32] AND [thisNumber] <> [#42]"
         PlaySoundFile "![thisNumber].MP3" "Wait"
         Delay "[100]"
      EndIf
   EndLoop
EndIf

 

Claude GUYOT
"Merci beaucoup d'aimé ce logiciel autant que moi."

.-.

Je pense avoir résolu le problème avec cette ligne :
IfEx "[thisNumber] <> [#32] AND [thisNumber] <> [#42]"

Claude GUYOT
"Thank you very much for loving this software as much as I do."

Uploaded files:
  • You need to login to have access to uploads.
Vadim has reacted to this post.
Vadim

@proforma-guyot

As long as you want to exclude just 2 characters ([#32] and [#42]), this is the 'quick and dirty' solution.

If you need a generic solution that will 'catch' all characters that do not have an associated audio file ...

If "[myNumberLen]" ">" "0"
   Loop "1" "[myNumberLen]" "[thisPosition]"
      SubStr "[myNumber]" "[thisPosition]" "1" "[thisNumber]"
      FileExists "![thisNumber].MP3" "MP3Exists"
      If "[MP3Exists]" "=" "true"
         PlaySoundFile "![thisNumber].MP3" "Wait"
      Else
         PlaySoundFile "!ErrorSound.MP3" "Wait"
      EndIf
      Delay "100"
   EndLoop
EndIf

 

... where ErrorSound.MP3 is some kind of 'buzzer sound' to indicate invalid/unmatched character.

I tested your Gaev code, For my needs it is Top and excellent. Thank you !

StrLen "[myNumber]" "[myNumberLen]"
If "[myNumberLen]" ">" "0"
   Loop "1" "[myNumberLen]" "[thisPosition]"
      SubStr "[myNumber]" "[thisPosition]" "1" "[thisNumber]"
      FileExists "![thisNumber].MP3" "MP3Exists"
      If "[MP3Exists]" "=" "true"
         PlaySoundFile "![thisNumber].MP3" "Wait"
      Else
         PlaySoundFile "!ErrorSound.MP3" "Wait"
      EndIf
      Delay "100"
   EndLoop
EndIf

 

Just a quick observation, this generic solution catches almost any character that doesn't have an associated audio file ...
The following characters are not taken into account by the code:
? <> *
An error message arises when processing the signs "problem occurred while initializing MCI."
Is there a possible solution to this problem? Ever experienced this problem?

Claude GUYOT
"Merci beaucoup d'aimé ce logiciel autant que moi."

.-.

J'ai testé ton code Gaev, Pour mon besoin il est Top et excellent. Merci !

Juste une petite observation, cette solution générique attrape presque tous les caractères qui n'ont pas un fichier audio associé ...
Les caractères suivants ne sont pas pris en compte par le code:
?<>*
Un message d'erreur surgit au traitement des signes "problème est survenu en initialisant MCI."
Y-a-t'il une éventuelle solution à ce problème? Un déja vecu à ce problème?

Claude GUYOT
"Thank you very much for loving this software as much as I do."

Uploaded files:
  • You need to login to have access to uploads.

@proforma-guyot

Just a quick observation, this generic solution catches almost any character that doesn't have an associated audio file ...
The following characters are not taken into account by the code:
? <> *
An error message arises when processing the signs "problem occurred while initializing MCI."
Is there a possible solution to this problem? Ever experienced this problem?

I am not familiar with the dos/windows commands used by VisualNEOWin under the covers, but according to this web page ...

https://answers.microsoft.com/en-us/windows/forum/windows_7-files/a-filename-cannot-contain-any-of-the-following/77f8e84c-9632-44d0-a3e6-164887e7a11e

... the following characters ...

\ / : * ? " < > |

... are not valid characters in file names ... e.g. * and ? are wildcard characters and the angled brackets are used to redirect input and output of dos commands

This web page ...

https://www.mtu.edu/umc/services/digital/writing/characters-avoid/

... lists even more illegal characters.

So you need to trap these characters before checking for a matching file .. try this ...

 ... set up list of illegal characters; add more as appropriate
SetVar "[illegalCharacters]" "!? <> *"

If "[myNumberLen]" ">" "0"
   Loop "1" "[myNumberLen]" "[thisPosition]"
      SubStr "[myNumber]" "[thisPosition]" "1" "[thisNumber]"
      ... check if [thisNumber is an illegal character
      SearchStr "[thisNumber]" "[illegalCharacters]" "[illegalPos]"
      If "[illegalPos]" "=" "0"
         ... not illegal; safe to check for matching file
         FileExists "![thisNumber].MP3" "MP3Exists"
         If "[MP3Exists]" "=" "true"
            PlaySoundFile "![thisNumber].MP3" "Wait"
         Else
            PlaySoundFile "!ErrorSound.MP3" "Wait"
         EndIf
      EndIf
      Delay "100"
   EndLoop
EndIf

 

Thank you (s) in the plural, Gaev and Vadim and our software.

In the progress of my project, which I admit is not easy to explain and understand, because one request can become an opposition to a second and vice versa.
However I would like to communicate to you my progress in this current project by small ad shell (s).
Gaev and Vadim jostled the result to be obtained from my first request by other results to be obtained from my first request.
The bright ideas ...
My project is for education and knowledge for the visually impaired, hard of hearing, and people who must imperatively obtain confirmation of their action (s).

My passion for our software is self-taught, and the code that can give the result to my Pub is made on these bases, even functional, a correction when writing this code is possible.
My friends, if changes need to be made, do them ... thank you (s) in advance.

Here is my first shell:

In Example 1: On reading (in the variable [thisNumber]) of the written character and in order to ignore the reading of its MP3 file normally allocated in the source folder of the Pub, the sound of the MP3 “ErrorSound” will be triggered for the character. .MP3 ”and not the MP3 sound corresponding to ASCII, even if this MP3 file is present in the source folder. On the other hand, if on reading there is no MP3 sound available in the source file it will trigger by default that of "ErrorSound.MP3".
In addition, in Properties of the text input zone - Enter_de_texte1 and in Style / Validation, instead of choosing the option: None (all characters are accepted), it is possible to obtain as another option: Do not accept that the characters listed in Enter_de_texte1 ... Etc.

For Example1, in the text entry zone of the Text_Entry1 object, write the following text:
TESTS * 01aaBBbbAA
and play button action1

StrLen "[myNumber]" "[myNumberLen]"
If "[myNumberLen]" ">" "0"
   Loop "1" "[myNumberLen]" "[thisPosition]"
      SubStr "[myNumber]" "[thisPosition]" "1" "[thisNumber]"
      FileExists "![thisNumber].MP3" "MP3Exists"
IfEx "[thisNumber] <> [#32] AND [thisNumber] <> [#42] AND [thisNumber] <> [#48] AND [thisNumber] <> [#49] AND [thisNumber] <> [#65] AND [thisNumber] <> [#66] AND [thisNumber] <> [#97] AND [thisNumber] <> [#98]"
         PlaySoundFile "![thisNumber].MP3" "Wait"
      Else
         PlaySoundFile "!ErrorSound.MP3" "Wait"
      EndIf
      Delay "50"
   EndLoop
EndIf

 

For Example2 (variant): MP3 files of the characters # $% _! ? = and SP (space) do not exist in the source folder it will trigger by default that of "ErrorSound.MP3" instead of an error message and interruption of the processing of other characters.
Write the following text in the text entry zone of the Entree_de_texte1 object:
TESTS 01AAbbaaBB # $% _! ? =
and play button action2

StrLen "[myNumber]" "[myNumberLen]"
If "[myNumberLen]" ">" "0"
   Loop "1" "[myNumberLen]" "[thisPosition]"
      SubStr "[myNumber]" "[thisPosition]" "1" "[thisNumber]"
      FileExists "![thisNumber].MP3" "MP3Exists"
IfEx "[thisNumber] <> [#35] AND [thisNumber] <> [#36] AND [thisNumber] <> [#37] AND [thisNumber] <> [#95] AND [thisNumber] <> [#33] AND [thisNumber] <> [#63] AND [thisNumber] <> [#61] AND [thisNumber] <> [#32]"
         PlaySoundFile "![thisNumber].MP3" "Wait"
      Else
         PlaySoundFile "!ErrorSound.MP3" "Wait"
      EndIf
      Delay "50"
   EndLoop
EndIf

 

Claude GUYOT
"Merci beaucoup d'aimé ce logiciel autant que moi."

.-.

Merci(s) au pluriel, Gaev et Vadim et notre logiciel.

Dans l'avancement de mon projet, qui je l'admet n'est pas facile à expliquer et comprendre , car une demande peut devenir une opposition à une deuxième et vis-versa.
Cepeandant je tiens à vous communiquer mes avancements à ce projet en cours par petite(s) coquille(s) de pub.
Gaev et Vadim ont bousculés le résultat à obtenir de ma première demande par d'autres résultats à obtenirs à ma première demande.
Les idées jailisses ...
Mon projet, est pour l'éducation et la connaissance aux mal-voyants, mal-entendants, et aux personnes qui doivent impérativement obtenir confirmation de leur(s) action(s).

Ma passion à notre logiciel est autodidacte, et le code qui peut donner le résultat à ma Pub est effectué sur ces bases, mème fonctionnel une correction à l'écriture de ce code est possible.
Mes amis, si modifications à faire, faites-les ... merci(s) par avance.

Voici ma première coquille:

En Exemple1 : A la lecture (dans la variable [thisNumber]) du caractère écrit et afin d'ignorer la lecture de son fichier MP3 normalement attribué dans le dossier source de la Pub , il sera déclenché pour le caractère le son du MP3 « ErrorSound.MP3 » et non le son MP3 correspondant à l'ASCII et ce même si ce fichier MP3 est bien présent dans le dossier source. Par contre, si à la lecture il n'y a aucun son MP3 disponible dans le fichier source il déclenchera par défaut celui de "ErrorSound.MP3".
De plus, dans Propriétés de la zone de saisie de texte - Entree_de_texte1 et dans Style / Validation, au lieu de choisir l'option: Aucune (tous les caractères sont acceptés), il est possible d'obtenir comme autre option : N'accepter que les caractères listés dans Entree_de_texte1 ... Etc.

Pour Exemple1, dans la zone de saisie texte de l'objet Entree_de_texte1 écrire le Texte suivant :
ESSAIS *01aaBBbbAA
et jouer le bouton action1

Pour Exemple2 (variante) : Les fichiers MP3 des caractères # $ % _ ! ? = et SP (espace) n'existent pas dans le dossier source il déclenchera par défaut celui de "ErrorSound.MP3" au lieu d'un message d'erreur et interruption du traitement des autres caractères.
Dans la zone de saisie texte de l'objet Entree_de_texte1 écrire le Texte suivant :
ESSAIS 01AAbbaaBB # $ % _ ! ? =
et jouer le bouton action2

Claude GUYOT
"Thank you very much for loving this software as much as I do."

Uploaded files:
  • You need to login to have access to uploads.
Vadim has reacted to this post.
Vadim

Thanks to Gaev, for this second shell,

In Example 3: On reading (in the variable [thisNumber]) of the written character and if the code does not find its MP3 file normally assigned in the source folder of the Pub, the sound of the MP3 “ErrorSound. MP3 ”which is for this example a short and empty sound.

However, the push button code does not apply to the *? <> Characters.
For Windows, a file name cannot contain any of these characters.

In addition, in Properties of the text input zone - Enter_de_texte1 and in Style / Validation, instead of choosing the option: None (all characters are accepted), it is possible to obtain as another option: Do not accept that the characters listed in Enter_de_texte1 ... Etc.

StrLen "[myNumber]" "[myNumberLen]"
If "[myNumberLen]" ">" "0"
Loop "1" "[myNumberLen]" "[thisPosition]"
SubStr "[myNumber]" "[thisPosition]" "1" "[thisNumber]"
FileExists "![thisNumber].MP3" "MP3Exists"
If "[MP3Exists]" "=" "true"
PlaySoundFile "![thisNumber].MP3" "Wait"
Else
PlaySoundFile "!ErrorSound.MP3" "Wait"
EndIf
Delay "100"
EndLoop
EndIf

Claude GUYOT
"Merci beaucoup d'aimé ce logiciel autant que moi."

.-.

Merci à Gaev, pour cette seconde coquille,
En Exemple3 : A la lecture (dans la variable [thisNumber]) du caractère écrit et si le code ne trouve pas son fichier MP3 normalement attribué dans le dossier source de la Pub , il sera déclenché pour le caractère le son du MP3 « ErrorSound.MP3 » qui est pour cet exemple un son court et vide.

Cepeandant le code du bouton poussoir ne concerne pas les caractères *?<>.
Pour Windows, Un nom de fichier ne peut contenir aucun de ces caractères.

De plus, dans Propriétés de la zone de saisie de texte - Entree_de_texte1 et dans Style / Validation, au lieu de choisir l'option: Aucune (tous les caractères sont acceptés), il est possible d'obtenir comme autre option : N'accepter que les caractères listés dans Entree_de_texte1 ... Etc.

Claude GUYOT
"Thank you very much for loving this software as much as I do."

Uploaded files:
  • You need to login to have access to uploads.