All Projects → lionsoul2014 → freeswitch-asr

lionsoul2014 / freeswitch-asr

Licence: Apache-2.0 license
TTS and ASR module with auto Voice Active Detecting supported for Freeswitch. I build it for Nature sound interactive, With the embedded LUA engine we could easly build a Freeswtich application like this.

Programming Languages

c
50402 projects - #5 most used programming language
lua
6591 projects
Makefile
30231 projects

Projects that are alternatives of or similar to freeswitch-asr

pyfreebilling
Routing and rating VoIP application for service providers - API based - AGPL v3 - Based on kamailio
Stars: ✭ 75 (+108.33%)
Mutual labels:  freeswitch
switchy
async FreeSWITCH cluster control
Stars: ✭ 67 (+86.11%)
Mutual labels:  freeswitch
xui
XUI is a micro UI framework and implementation for FreeSWITCH
Stars: ✭ 86 (+138.89%)
Mutual labels:  freeswitch
Redis-Monitoring
Solar power data ingestion and a monitoring dashboard using Redis as a primary database.
Stars: ✭ 16 (-55.56%)
Mutual labels:  lua-script
freeswitch-esl-all
freeswitch event socket base on netty 4 and has some new features.
Stars: ✭ 110 (+205.56%)
Mutual labels:  freeswitch
FSlmx
FreeSWITCH GUI 简体中文GUI for PHP (UTF8)
Stars: ✭ 43 (+19.44%)
Mutual labels:  freeswitch
siphub
sip capture server by hep。work with OpenSIPS, Kamailo, and FreeSWITCH。
Stars: ✭ 23 (-36.11%)
Mutual labels:  freeswitch
TTS-Codenames
A LUA script for Codenames on Tabletop Simulator for Steam.
Stars: ✭ 25 (-30.56%)
Mutual labels:  lua-script
underscript
A Lua extension library that allows to run various scripting languages from within Lua scripts, cross-language require scripts and load 32-bit Lua on Lua 64-bit
Stars: ✭ 19 (-47.22%)
Mutual labels:  lua-script
NEventSocket
A reactive FreeSwitch eventsocket library for Modern .Net
Stars: ✭ 68 (+88.89%)
Mutual labels:  freeswitch
RageSU
Anti-Aim lua for Aimware - CS:GO
Stars: ✭ 17 (-52.78%)
Mutual labels:  lua-script
botman
A Lua server manager for 7 Days to Die powered by Mudlet
Stars: ✭ 29 (-19.44%)
Mutual labels:  lua-script
code runner.nvim
Neovim plugin.The best code runner you could have, it is like the one in vscode but with super powers, it manages projects like in intellij but without being slow
Stars: ✭ 234 (+550%)
Mutual labels:  lua-script
openredir
redirect file open operations via LD_PRELOAD
Stars: ✭ 23 (-36.11%)
Mutual labels:  lua-script
mpv-gif-generator
Creates animated gifs using mpv hotkeys
Stars: ✭ 32 (-11.11%)
Mutual labels:  lua-script
freeswitch-docker
Dockerfile for freeswitch
Stars: ✭ 40 (+11.11%)
Mutual labels:  freeswitch
ScriptHawk
A collection of Lua scripts and RAM watches for BizHawk.
Stars: ✭ 69 (+91.67%)
Mutual labels:  lua-script
esl
Node.js client and server for FreeSwitch Event Socket
Stars: ✭ 106 (+194.44%)
Mutual labels:  freeswitch
sipp2freeswitch
sample sipp scenarios for testing freeswitch
Stars: ✭ 18 (-50%)
Mutual labels:  freeswitch
smw-tas
Utility scripts and TAS tools for Super Mario World to be run on lsnes or Snes9x-rr.
Stars: ✭ 41 (+13.89%)
Mutual labels:  lua-script

Description

TTS and ASR module with auto Voice Active Detecting supported for Freeswitch. I build it for Nature sound interactive, With the embedded LUA engine we could easly build a Freeswtich application like this.

How to use it ?

  1. Copy and merge the ${PROJECT_ROOT}/src and the ${PROJECT_ROOT}/conf with the Freeswitch source tree.
  2. Add the following two module in the ${FREESWITCH_SOURCE_ROOT}/modules.conf
asr_tts/mod_yytts
asr_tts/mod_yyasr
  1. Re-compile and install the freeswitch to install mod_yytts and mod_yyasr modules.
  2. Active the mod_yytts and the mod_yyasr by add the following to lines into the ${FREESWITCH_INSTALLATION_ROOT}/conf/autoload_configs/modules.conf.xml
<load module="mod_yytts"/>
<load module="mod_yyasr"/>
  1. Copy the lua scripts under ${PROJECT_ROOT}/scripts to ${FREESWITCH_INSTALLATION_ROOT}/scripts/
  2. Bind a number to build application by adding the following xml settings to the ${FREESWITCH_INSTALLATION_ROOT}/conf/dialplan/default.xml
<!-- yytts tts module testing -->
<extension name="yytts_demo">
  <condition field="destination_number" expression="^5001$">
    <action application="answer"/>
    <action application="sleep" data="2000"/>
    <action application="lua" data="yytts_demo.lua"/>
  </condition>
</extension>

<!-- yyasr asr module testing -->
<extension name="yyasr_demo">
  <condition field="destination_number" expression="^5002$">
    <action application="answer"/>
    <action application="sleep" data="2000"/>
    <action application="lua" data="yyasr_demo.lua"/>
  </condition>
</extension>

How to test it ?

Start the Freeswitch and install a Linphone client.

  1. Dial 5001 for TTS testing, check ./scripts/yytts_demo.lua for detail usage, module interface overview:
session:answer();   -- answer the call

-- set to use the yytts TTS with zhilingf speaker
session:set_tts_params("yytts", "zhilingf");

-- fire the speak
session:speak("Hello,我是人工智能电话系统, Bye!");

-- hangup the call
session:hangup();
  1. Dial 5002 for ASR testing, check ./scripts/yyasr_demo for detail usage, ASR interface overview:
session:answer();   -- answer the call

-- register the sound input callback
session:setInputCallback(function onInput(s, type, obj) end);

-- start to detect the speech to keep firing the feed interface insite yyasr module
session:execute("detect_speech", "yyasr directory directory");

-- resume the detect_speech
session:execute("detect_speech", "resume");

-- stop the detecting
session:execute("detect_speech", "stop");

-- check ./script/yyasr_demo for details usage.

Secondary development

TTS module

  1. TTS module structure:
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
tts_interface  = switch_loadable_module_create_interface(*module_interface, SWITCH_SPEECH_INTERFACE);
tts_interface->interface_name = "yytts";
tts_interface->speech_open = yytts_speech_open;
tts_interface->speech_close = yytts_speech_close;
tts_interface->speech_feed_tts = yytts_speech_feed_tts;
tts_interface->speech_read_tts = yytts_speech_read_tts;
tts_interface->speech_flush_tts = yytts_speech_flush_tts;
tts_interface->speech_text_param_tts = yytts_text_param_tts;
tts_interface->speech_numeric_param_tts = yytts_numeric_param_tts;
tts_interface->speech_float_param_tts = yytts_float_param_tts;
  1. Invoke process for TTS module in Freeswitch:
open
while ( thread running ) do
  feed
  read
  flush
end
close
  1. Embedded the other TTS engine by override the yytts_speech_feed_tts
static switch_status_t yytts_speech_feed_tts(switch_speech_handle_t *sh, char *text, switch_speech_flag_t *flags)
{
	// feed the wave stream to the yytts->audio_buffer buffer
	return SWITCH_STATUS_SUCCESS;
}

ASR module

  1. ASR module structure:
asr_interface = switch_loadable_module_create_interface(*module_interface, SWITCH_ASR_INTERFACE);
asr_interface->interface_name = "yyasr";
asr_interface->asr_open = yyasr_asr_open;
asr_interface->asr_load_grammar = yyasr_asr_load_grammar;
asr_interface->asr_unload_grammar = yyasr_asr_unload_grammar;
asr_interface->asr_close = yyasr_asr_close;
asr_interface->asr_feed = yyasr_asr_feed;
asr_interface->asr_resume = yyasr_asr_resume;
asr_interface->asr_pause = yyasr_asr_pause;
asr_interface->asr_check_results = yyasr_asr_check_results;
asr_interface->asr_get_results = yyasr_asr_get_results;
asr_interface->asr_start_input_timers = yyasr_asr_start_input_timers;
asr_interface->asr_text_param = yyasr_asr_text_param;
asr_interface->asr_numeric_param = yyasr_asr_numeric_param;
asr_interface->asr_float_param = yyasr_asr_float_param;
  1. Invoke process for ASR module in Freeswitch:
open
while ( thread running ) do
  feed
  check_results
  get_results
end
optional pause|resume
close
  1. Embedded the other ASR engine by override the yyasr_asr_feed
/*! function to feed audio to the ASR */
static switch_status_t yyasr_asr_feed(
    switch_asr_handle_t *ah, void *data, unsigned int len, switch_asr_flag_t *flags)
{
	// feed the text to the yyasr->text_buffer text buffer
	return SWITCH_STATUS_SUCCESS;
}


/*
 * Voice Active detecting implementation.
 * Optimize the VAD by modify stop_audio_detect function.
*/
static switch_bool_t stop_audio_detect(
    switch_asr_handle_t *ah, int16_t *data, unsigned int samples)
{
    return SWITCH_FALSE;
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].