Giter VIP home page Giter VIP logo

speechrec's Introduction

Speech Recognition and Speech Synthesis C++ with UWP for plain Win32

An easy way to implement Windows SpeechRecognizer and SpeechSynthesizer UWP in your Win32 Apps. Available as DLL and as Static library, in both x64 and x86.

Your library functions are:

HRESULT __stdcall  SpeechX1(void* ptr, SpeechX2 x2, const wchar_t* langx = L"en-us", int Mode = 0);
HRESULT __stdcall  SpeechX3(const wchar_t* t, void* ptr, bool XML,size_t iVoice);

Text to Speech

Call SpeechX3, passing the text and a vector to return the wave data. As the ptr paramter, pass a pointer to a std::vector<uint8_t>. Use MS Speech Synthesis Markup Language for XML https://docs.microsoft.com/en-us/azure/cognitive-services/speech-service/speech-synthesis-markup?tabs=csharp

The iVoice is the index-0 voice to use. To get all the voices, pass t = 0, then ptr as a pointer std::vector<std::tuplestd::wstring,std::wstring>>.

Speech to Text

Mode = 2, pass a std::vector<std::tuplestd::wstring,std::wstring>> as a ptr to get all languages supported

std::vector<std::tuple<std::wstring, std::wstring>> sx;
SpeechX1((void*)&sx, 0, 0, 2);
for (auto& e : sx)
{
 std::wcout << std::get<0>(e) << L" - " << std::get<1>(e) << std::endl;
}

Continuous dictaction, Mode = 0 and the language specifier with a callback of this type:

HRESULT __stdcall  MyCallback(void* ptr, const wchar_t* reco, int conf);
SpeechX1(some_ptr, MyCallback, L"en-US", 0);

Where

  • ptr is the value passed to SpeechX1 as some_ptr
  • If reco is nullptr, then the recognizer is in idle state. Return S_OK to continue. If you return E_FAIL, session ends.
  • If reco is text, then conf is the confidence mode:
  • If -1, it's still in recognition mode
  • If 0,1,2,3 high/medium/low/bad confidence

return S_OK to continue, E_FAIL to stop.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.