Chapter 2. Installation

Table of Contents

Install from binary package
Compile from source
Configuration options
libsent options
libjulius options
julius options
Building Julius on various platform
Linux
Windows - cygwin
Windows - mingw
Windows - Microsoft Visual C++

This chapter describes how to compile and install Julius. Julius can be run without system installation, but system installation is recommended when you are using Julius library for a software development.

The compilation procedure from source archive is fully described in this chapter. All the compilation-time options and OS-specific matters are also explained here.

Install from binary package

All the executables are located at the bin directory under the package root directory. Since Julius itself is a stand-alone application, they can be run directly without installation. However, you can install it to your system by manually copying bin, include, lib and manuals to the corresponding system directory. For example, if you want to install Julius files under /usr/local, the copy source and destination will be:


bin/* -> /usr/local/bin
include/* -> /usr/local/include
lib/* -> /usr/local/lib
doc/man/man1/* -> /usr/local/man/man1
doc/man/man5/* -> /usr/local/man/man5

Compile from source

When you want to change some sompile-time settings of Julius (ex. vocabulary size limit or input length limit, search algorithm variants. ...). you should compile Julius from the source codes. Windows (MinGW and Cygwin), Linux, Solaris and other unixen are supported to use the automatic configuration. The latest Julius also has support for Microsoft Visual C++.

Julius adopts autoconf scheme to be easily compiled on various Unix-like environments. Just go to the directory where you unpacked the source archive, and do the following commands,

% ./configure
% make

and install the generated binary files by

% make install

which also installes headers and libraries as well as the binaries.

You can tell the configure script to use another compiler by setting environment variable CC. The compliation flags can be also specified by CFLAGS. Here is an example to specify which compiler and flags to be used on bash-based shell.

% export CC=cc
% export CFLAGS=-O3
% ./configure

At the last step, the "make install" commadn will copy executables, libraries, headers and manuals to the specified location of the system. The target installation directory is listed below, in which ${prefix} is a prefix of system directory, which typically will be set to /usr/local by default but can be altered by configure option --prefix=....


bin -> ${prefix}/bin
include -> ${prefix}/include
lib -> ${prefix}/lib
doc/man/man1 -> ${prefix}/man/man1
doc/man/man5 -> ${prefix}man/man5

For example, if you want to install Julius at the "$HOME/julius", the options should be like this:

% ./configure --prefix=$HOME/julius

Julius has many configure options other than standard ones to set application-specific parameters. See the next section for details.

Configuration options

This section describes configure options that can be given to the configure script at the first step of compilation. Here options are grouped into three groups corresponding to the subdirectories of the source archive: libsent options, libjulius options and julius options. You can give all the options together at one time to the configure script of the top directory (in that case all the options are passed to the configure script of the subdirectories and irrelevant ones are omitted), or give them separately to the corresponding configure script.

libsent options

The "libsent" library, located on the libsent directory, contains a collection of general functions that are required for a speech recognition system: audio I/O, network I/O, preprocessing, speech feature extraction, language model, acoustic model, output probability computations, transition handling, indexing and so on.

--enable-words-int

By default the maximum vocabulary size is 65,535. This limit comes from the fact that the internal word ID type is defined as unsigned short. This option will tell Julius to assign the word ID as int, wihch will extend the size limit at a cost of increasing memory usage.

--enable-msd

Enable MSD-HMM support on acoustic modeling.

--disable-class-ngram

Disable class N-gram support. This will save memory for less than 100 kBytes if you don't use class N-gram.

--enable-fork

With this option, Julius will fork at each audio client connection (-input adinnet).

--with-mictype={auto|oss|alsa|esd|portaudio|sp|freebsd|sol2|sun4|irix}

Specify A/D-in device for microphone input. When auto is specified (this is default), it tries to find an available one automatically. On Linux system, alsa, oss, esd will be examined by this order and first one will be chosen as default. On Windows, portaudio will be chosen when the required DirectSound headers are available, otherwise WMM driver will be used.

--with-netaudio-dir=dir

For DatLink users, specify this option to enable direct input from NetAudio server on DatLink. The dir should be the directory where the NetAudio SDK (include and lib) is located.

--disable-zlib

Disable linking to zlib library. A compressed file may not be read if you use this option.

--without-sndfile

Disable using libsndfile for audio file reading.

libjulius options

The libjulius is the core recognition engine library performing actual recognition.

--enable-gmm-vad

This option enables GMM-based front-end VAD on Julius. See the "voice activity detection" section of this document for more details.

--enable-decoder-vad

This option enables decoder-based VAD on Julius. The enabled feature will be activated with -spsegment option at run time. See the sections of "voice activity detection" and "search algorithm" for more details.

--enable-power-reject

Enables input energy based input rejection. See sections of "voice activity detection" and "input rejection" in this document.

--enable-setup={standard|fast|v2.1}

Configure the detailed search algorithms by specifying one of the preset values:

  • fast: speed-tuned preset (default)

  • standard: accuracy-tuned preset

  • v2.1: old preset, compatible with ver.2.1.

fast tells Julius to use faster algorithm using several approximations on score compuration and aggressive pruning on search. It runs faster than "standard", but these approximations and prunings may result in a slight degradation of recognition accuracy of several percent. So, it may be better to use another option if you are going to evaluate an acoustic model or a language model through recognition result.

standard make Julius to do accurate recognition with minimum (ideally no) loss of accuracy by engine. It has less accuracy loss as compared with fast setting, but it will take longer decoding time.

v2.1 is an old option that reverts all the algorithm equivalent to the ancient version 2.1.

The detailed set of algorithms that will be enabled or disabled by this option is summarized at the table below. The "argument" row corresponds to each option described in the following.

           |1-gram     1st pass 2nd pass    tree       Gauss. pruning
           |factoring  IWCD     strict IWCD separation default method
===========+===========================================================
argument   | factor1    iwcd1   strict-iwcd2  lowmem2
-----------+-----------------------------------------------------------
 standard  |  o          o         o           x        safe
   fast    |  o          o         x           o        beam
   v2.1    |  x          x         x           x        safe
-----------------------------------------------------------------------

--enable-factor2

Use 2-gram factoring on the 1st pass. By default Julius uses 1-gram factoring. Enabling this option will improve the accuracy of the 1st pass, but perhaps has little effect on the final output. It also costs much time and memory.

--enable-wpair

Use word-pair approximation instead of 1-best approximation on the 1st pass. The word-pair approximation improves the accuracy of the 1st pass by treating independent hypotheses for all predecessor words, but it costs much memory.

--enable-wpair-nlimit

When specified with --enable-wpair, this option will limit the number of independent predecessors per word.

--enable-word-graph

Internally generate word graph instead of word trellis at the end of the 1st pass.

--disable-pthread

Disable creating separate thread for audio capturing. May be required on OS which does not support threading.

--disable-plugin

Disable plugin feature.

julius options

The directory julius contains the main function of the software "julius". It links to the libsent and libjulius libraries to build a stand-alone, server-client speech recognition "julius". The application utilities such as character set conversion are implemented here.

--enable-charconv={auto|iconv|win|libjcode|no}

Specify which scheme to use for charset conversion. Choosing iconv will tell Julius to use the iconv library, and win to use the native API of Windows. no will entirely remove charset conversion feature. Default value is auto, in which iconv will be chosen on Linux and win on Windows.

Building Julius on various platform

This section describes the detailed procedure and requirements to to compile Julius on various platforms.

Linux

These libraries are required to build Julius.

  • zlib

  • flex

These packages are recommended to be installed before compilation of Julius, although Julius can be compiled without these files.

  • ALSA headers and libraries. If not exist, Julius uses OSS interface by default

  • ESounD headers and libraries for live audio input via esd daemon

  • libsndfile libraries for audio file reading. If not, only .wav and .raw files can be read.

Many linux-based system offers package management system to install these packages. For example, on a Debian-based distribution, you can install all the required / recommended packages by executing the following command at root (the package names may vary on each distribution).

# aptitude install build-essential zlib1g-dev flex
# aptitude install libasound2-dev libesd0-dev libsndfile1-dev

Windows - cygwin

The following packages should be installed tbefore compiling Julius:


 Devel
     - binutils
     - flex
     - gcc-core
     - gcc-mingw-core
     - libiconv
     - make
     - zlib-devel
 Utils
     - diffutils
 Perl
     - perl
 MinGW
     - mingw-zlib

Moreover, these DirectSound SDK header files are needed compile Julius with live audio recognition support:


d3dtypes.h
ddraw.h
dinput.h
directx.h
dsound.h

These DirectSound development files can be found in the Microsoft DirectX SDK. If the SDK is installed on your machine, you can find the DirectSound headers somewhere in the SDK. You should find them, and copy them to the directory to /usr/include and /usr/include/mingw in the cygwin environment before executing the configure script.

The actual building procedure is as the same as Linux. If you want to build .exe files that can run outside cygwin, you should give the gcc an option -mno-cygwin. You can tell configure to use the option at any time by:

% CC="gcc -mno-cygwin" configure

When Julius fails to find the DirectSound headers, it will be compiled with old API called "mmlib" You can check julius.exe whether the compiled binary uses DirectSound or not by executing the command below. If it is compiled with DirectSound, the line should contains the "pa-dsound" string like this:

% julius.exe --version
...
primary A/D-in driver: pa-dsound (PortAudio ....)
...

Windows - mingw

Julius can be compiled at MinGW (Minimalist GNU for Windows) environment. MinGW easily allow users to build binaries that can be run without MinGW, so it is suitable to build a dirtibutable binary.

You should install MinGW, MSYS and msys-DTK to compile Julius. Additionally, Win32 library of "zlib" and "flex", and DirectSound headers are required. The zlib, flex libraries and DirectSound headers are not included in the standard mingw distribution, so you have to obtain them by your own and install them to the system directories, ex. /mingw/lib/ and /mingw/include/. Actually, these files below are needed.


/mingw/include/d3dtypes.h
/mingw/include/ddraw.h
/mingw/include/dinput.h
/mingw/include/directx.h
/mingw/include/dsound.h
/mingw/include/zconf.h
/mingw/include/zlib.h
/mingw/lib/libfl.a
/mingw/lib/libz.a

The compilation and installation procedure is just as same as Linux.

% ./configure
% make
% make install

Windows - Microsoft Visual C++

Julius-4.1.3 and later now supports compilation on Microsoft Visual C++ (MSVC). In addition to the command-based executables, an additional sample application named "SampleApp" is included to demonstrate the C++ wrapper implementation of Julius.

The MSVC support has been tested on MS Visual C++ 2008, both Professional and Express Edition.

Requirements

"Microsoft DirectX SDK" is required to compile Julius on MSVC. You can get it from the Microsoft Web site. Install it before compilation.

Also, Julius uses these two open-source libraries:

  • zlib

  • portaudio V19

They are already included in the Julius source archive at "msvc/zlib" and "msvc/portaudio" so you need not prepare by yourself.

Build

Open the solution file "JuliusLib.sln" with MSVC, and build the projects in the following order:

  • libsent

  • libjulius

  • julius

  • SampleApp

After the build process, you will get the Julius libraries and executables "julius.exe" and "SampleApp.exe" under "Debug" or "Release" directory.

If you got an error when linking zlib or portaudio, compile them by yourself and replace the headers and libraries under each directory. When you compiled the portaudio library, you also have to copy the generated DLL ("portaudio_x86.dll") under the "Release" and "Debug" directories.

Testing the sample application

"julius.exe" is a win32 console application, which runs as the same as other Unix versions. You can run it from command prompt with a working jconf file just like Linux versions.

The "SampleApp.exe" is a C++ sample application which defines a simple Julius wrapper class with JuliusLib libraries.

You can test the SampleApp by the following procedure. At the main window, open the jconf file you want to run Julius with from the menu. After loading the jconf file, execute a start command from the menu. Julius engine will start inside the application as a child thread, and will send messages to the main window at each speech event (trigger, recognition result, etc.).

If you have some trouble displaying the results, try modifying the locale setting at line 98 of SampleApp.cpp to match your language model and re-compile.

The log output of Julius enging will be stored to "juliuslog.txt". Please check it if you encounter engine error.

How to configure on MSVC

MSVC-based compilation does not use the "configure" scheme. If you want to change the configuration options, you should set/unset them manually in the header files below, located at msvc/config:

  • config-msvc-julius.h

  • config-msvc-libjulius.h

  • config-msvc-libsent.h

They are copy of "config.h" files which will be generated by the configure scripts:

  • julius/config.h

  • libjulius/config.h

  • libsent/libsent.h

To change the configuration, you can first execute the configure command on other platform like linux or cygwin, and then look at the generated files above to modify the corresponding MSVC header files.