# Introduction

kaldifeat implements speech feature extraction algorithms compatible with Kaldi using PyTorch, supporting CUDA as well as autograd.

kaldifeat has the following features:

> - Fully compatible with Kaldi

>   Note

>   The underlying C++ code is copied & modified from Kaldi directly. It is rewritten with PyTorch C++ APIs.

> - Provide not only `C++ APIs` but also `Python APIs`

>   Note

>   You can access kaldifeat from `Python`.

> - Support autograd

> - Support `CUDA` and `CPU`

>   Note

>   You can use CUDA for feature extraction.

> - Support `online` (i.e., `streaming`) and `offline` (i.e., `non-streaming`) feature extraction

> - Support chunk-based processing

>   Note

>   This is especially usefull if you want to process audios of several hours long, which may cause OOM if you send them for computation at once. With chunk-based processing, you can process audios of arbirtray length.

> - Support batch processing

>   Note

>   With kaldifeat you can extract features for a batch of audios

Currently implemented speech features and their counterparts in Kaldi are listed in the following table.

Table 1 Supported speech features
Supported speech features | Counterpart in Kaldi
--- | ---
kaldifeat.Fbank | compute-fbank-feats
kaldifeat.Mfcc | compute-mfcc-feats
kaldifeat.Plp | compute-plp-feats
kaldifeat.Spectrogram | compute-spectrogram-feats
kaldifeat.OnlineFbank | kaldi::OnlineFbank
kaldifeat.OnlineMfcc | kaldi::OnlineMfcc
kaldifeat.OnlinePlp | kaldi::OnlinePlp

Each feature computer needs an option. The following table lists the options for each computer and the corresponding options in Kaldi.

Hint

Note that we reuse the parameter names from Kaldi.

Also, both online feature computers and offline feature computers share the same option.

Table 2 Feature computer options
Options in kaldifeat | Corresponding options in Kaldi
--- | ---
kaldifeat.FbankOptions | kaldi::FbankOptions
kaldifeat.MfccOptions | kaldi::MfccOptions
kaldifeat.PlpOptions | kaldi::PlpOptions
kaldifeat.SpectrogramOptions | kaldi::SpectrogramOptions
kaldifeat.FrameExtractionOptions | kaldi::FrameExtractionOptions
kaldifeat.MelBanksOptions | kaldi::MelBanksOptions

Read more to learn how to install kaldifeat and how to use each feature computer.