Answer the question
In order to leave comments, you need to log in
How to play sound depending on selected field in db?
I have a project in Delphi, a table with the output of Russian and English words (dictionary). However, I was required to voice these same English words.
There was an idea to create a "play" button, through it already to compare, say if the word hello - play the hello.mp3 file.
However, I do not understand how this can be done (I can not write the code).
How to bind the selected value in the database (DBgrid) and the condition?
And how else can you play sounds in deplhi?
Answer the question
In order to leave comments, you need to log in
1)
PLaySound
https://msdn.microsoft.com/en-us/library/windows/d...
(it's already written in Delphi in uses MMSystem \ PlaySound)
2) and either punch the corresponding Mp3 names for the words into the main database. files that are located in the subdirectories of the database/program/data folder
or create an additional correspondence between words and file names in a separate database/table.
3) by the "play" button, get the file name by the corresponding word for playback,
and play this file through PlaySound ();
The task has nothing to do with SQL or the database.
The database simply gives you some information.
Based on which you make a sound.
In exactly the same way, anything can give information - a button, a variable, etc.
How to voice?
There are 2 options, what to choose - depends on the task:
1. Indeed, if the number of sounds is very limited - you can prepare files and play them. Then from the database you need the file name (if the file with the sound is separate) or the contents of the file (if you store the sound file in the database)
2. If the phrases are arbitrary, then you need a speech engine / text-to-speech, then from the database you only need the text. The mentioned engine will voice this text itself.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question