how to map a kannada unicode value to a particular audio file from a speech database

Actually i am working on a project which converts kannada text to speech.As of now i am able to read the text document and able to generate unicode out of text document.now i have to map each obtained unicode to the speech database containing sounds of each kannada alphabet saved each audio file with the hex value of each unicode. can anyone suggest any solution to this problem.

 Accepted Answer

If U holds the Unicode code point number, then
filename = sprintf('pronounce_%04X.wav', U)
this would produce, for example, 'pronounce_30DB.wav' for codepoint U+30DB (decimal 12507), ホ

6 Comments

Thanks for the quick response.can u please elaborate it?i am unable to understand.what does 'pronounce_%04X.wav' mean audio file name?and how 'U' should be initialized?
U = 12507;
or
U = hex2dec('30DB');
or
U = 'ホ'; %semicolon required for this to work!
would all have the same effect.
Your file names are named according to the hex representation of the code point, right? But what is the pattern? Are the file names just 4 hex digits for the file name and '.wav' for the file extension, such as 30DB.wav ? Or is there some text before the hex? Is the hex in lower case, like 30db or is it in upper case, like 30DB ?
filename = sprintf('pronounce_%04X.wav', U)
is an example of creating file names which have a fixed text prefix, then 4 upper-case hex digits, then end in .wav . If you do not have a prefix such as the example 'pronounce_', then do not write it in; for example
filename = sprintf('%04X.wav', U);
If you want lower-case hex like 30db instead of upper-case then use %04x instead of %04X
filename = sprintf('%04x.wav', U);
Yeah..i did it in the same way but i didn't get any output..what do we get it from this?
Actually from the unicode which i obtain after reading text document with that unicode value i need to fetch speech file from the database.help me out please.
projectdir = '/folder/where/files/are';
[data, fs] = wavread( fullfile(projectdir, filename) );
Or when you say "database" do you mean something like an SQL database? If so then you need to say more about what kind of database it is and what fieldname is going to be used and what the format of the key will be.
no database means just a folder containing speech files.Thank you so much walter my bit of code is working out.I am able to fetch one speech file from the folder but still two more steps to solve one is now can i fetch multiple files from the same folder?and another important step is to map the unicode value generated from the below code with the speech file contained in the folder.can u suggest anything for these?
fid = fopen('\path\of\text_document containing kannada unicode\message.txt', 'rb');
b = fread(fid, '*uint8')'; %'# read bytes
disp(b);
c=dec2hex(b);
disp(c);
fclose(fid);

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!