Saturday, December 11, 2010

Wait, WHAT??? Wow!!!

This was all I could muster when one of my sisters (R from the previous post) recently said that Sudoku Solver 6.6 runs on her laptop but AcBook 3.9 does not!

So this post is going to be about MATLAB and Miscellany. Recently, I saw this guest post on Loren Shure’s blog at “The MathWorks”. That post talks about using Speech Synthesis (among other things) functions from .NET library. (You probably know where I’m heading!) So, I commented on the post regarding my own encounter with .NET and its Speech Recognition functions.

My .m files are useless to others as I don’t include comments in them and often I myself (after a respectable span of time) don’t remember how they do whatever they do (one of the many reasons why SS 6.x has not yet become at least SS 7.0!). For example, I don’t understand anymore how the brute force algorithm for solving a Sudoku is implemented in the corresponding .m file. (The full arsenal of SS 6.6 consists of 11 .m files totaling ~2000 lines and yes, ‘end’ takes one line and there are almost no blank lines!)

Anyway, enough boasting! So, I’ll present here (with comments) the code snippet I use in my ‘full-fledged’ SS 6.6 for recognizing the spoken numbers:

%% Import Speech Classes
NET.addAssembly('System.Speech');
import System.Speech.Recognition.*;
%% Initialize SRE
SpRec=SpeechRecognitionEngine;
SetInputToDefaultAudioDevice(SpRec);
ts=System.TimeSpan(0,0,3); %Don’t ask what this does!
SpRec.InitialSilenceTimeout=ts;
%% Create Grammar
words={'one','two','three','four','five','six','seven','eight','nine'};
str=NET.createArray('System.String',9);
for n=1:9
    str.SetValue(words{n},n-1);
end
choices=Choices(str);
GB=GrammarBuilder(choices);
grammar=Grammar(GB);
LoadGrammar(SpRec,grammar);
%% Test the Words
%rec=EmulateRecognize(SpRec,'ONE');
%% Real Speech Recognition
disp('Speak Now...');
rec=Recognize(SpRec);
%% Result
Speaker=System.Speech.Synthesis.SpeechSynthesizer;
Speak(Speaker,rec.Text);

The success of the above code depends mainly on your PC and you’ll find that out pretty soon (or maybe not)!

Now, let’s talk about miscellany. Recently, (note to self: used this word too many times, increase vocab) I realized that I’ve nudged many people (over the past few years) to do certain things and statistically speaking, none have done so! Let me give you some details:

I’ve asked a lot of people (friends & family) to use SS 6.x and AcBook 3.x (new releases of both will be made public by the start of new year) over a span of more than 5 years. Here are some disheartening (for a programmer) and funny (for a Sketchbook reader) ‘results’: Shantanu switched from Windows to Linux after I ‘presented’ AcBook to him on his Birthday! R wanted to use it till she developed her own program using .NET, VisualBasic, etc. but her PC won’t run it as mentioned above! S (my brother from last post) will not install Java on his PC! (ohh! Spoiler Alert!) DQ quite reluctantly agrees to beta-test every new version but then forgets they are even installed on his PC! and the list continues…

I’ve asked a lot of people to watch / read Sketchbook but all of them say (in one way or other): “What the hell is this?

I’ve asked a lot of people to watch / read Rurouni Kenshin following ‘my sequence’ and none of them have ever successfully done it! Shantanu did come close to doing that but then he ‘lost interest’ around VizBig Vol. 2! Sad smile

I’ve asked a lot of people to read Hindi poems, whose links I post on Google Buzz and most of them do read them. I feel really glad about that especially when Shantanu ‘thanked’ me for sharing those links! Open-mouthed smile

अनुभूति

No comments:

Post a Comment