ailia AI Speech Python API
!! CAUTION !! “ailia” IS NOT OPEN SOURCE SOFTWARE (OSS). As long as user complies with the conditions stated in License Document, user may use the Software for free of charge, but the Software is basically paid software.
About ailia AI Speech
ailia AI Speech is a library to perform speech recognition using AI. It provides a C API for native applications, as well as a C# API well suited for Unity applications. Using ailia AI Speech, you can easily integrate AI powered speech recognition into your applications.
Install from pip
You can install the ailia AI Speech free evaluation package with the following command.
pip3 install ailia_speech
Install from package
You can install the ailia AI Speech from Package with the following command.
python3 bootstrap.py
pip3 install .
Usage
Batch mode
In batch mode, the entire audio is transcribed at once.
import ailia_speech
import librosa
import os
import urllib.request
# Load target audio
input_file_path = "demo.wav"
if not os.path.exists(input_file_path):
urllib.request.urlretrieve(
"https://github.com/ailia-ai/ailia-models/raw/refs/heads/master/audio_processing/whisper/demo.wav",
"demo.wav"
)
audio_waveform, sampling_rate = librosa.load(input_file_path, mono = True)
# Model Initialize
speech = ailia_speech.Whisper()
model_type = ailia_speech.AILIA_SPEECH_MODEL_TYPE_WHISPER_MULTILINGUAL_LARGE_V3_TURBO
# When using sensevoice
#speech = ailia_speech.SenseVoice()
#model_type = ailia_speech.AILIA_SPEECH_MODEL_TYPE_SENSEVOICE_SMALL
# Infer
speech.initialize_model(model_path = "./models/", model_type = model_type)
recognized_text = speech.transcribe(audio_waveform, sampling_rate)
for text in recognized_text:
print(text)
Step mode
In step mode, the audio is input in chunks and transcribed sequentially.
import ailia_speech
import librosa
import os
import urllib.request
# Load target audio
input_file_path = "demo.wav"
if not os.path.exists(input_file_path):
urllib.request.urlretrieve(
"https://github.com/ailia-ai/ailia-models/raw/refs/heads/master/audio_processing/whisper/demo.wav",
"demo.wav"
)
audio_waveform, sampling_rate = librosa.load(input_file_path, mono = True)
# Infer
speech = ailia_speech.Whisper()
speech.initialize_model(model_path = "./models/", model_type = ailia_speech.AILIA_SPEECH_MODEL_TYPE_WHISPER_MULTILINGUAL_LARGE_V3_TURBO)
speech.set_silent_threshold(silent_threshold = 0.5, speech_sec = 1.0, no_speech_sec = 0.5)
for i in range(0, audio_waveform.shape[0], sampling_rate):
complete = False
if i + sampling_rate >= audio_waveform.shape[0]:
complete = True
recognized_text = speech.transcribe_step(audio_waveform[i:min(audio_waveform.shape[0], i + sampling_rate)], sampling_rate, complete)
for text in recognized_text:
print(text)
Diarization mode
Both Whisper and SenseVoice support speaker diarization in normal and live modes.
By specifying diarization_type, speaker diarization can be performed. Results include a speaker_id, or None when no speaker is detected.
speech.initialize_model(model_path = "./models/", model_type = ailia_speech.AILIA_SPEECH_MODEL_TYPE_WHISPER_MULTILINGUAL_LARGE_V3_TURBO, diarization_type = ailia_speech.AILIA_SPEECH_DIARIZATION_TYPE_PYANNOTE_AUDIO)
Available model types
It is possible to select multiple models according to accuracy and speed. LARGE_V3_TURBO is the most recommended.
Whisper
ailia_speech.AILIA_SPEECH_MODEL_TYPE_WHISPER_MULTILINGUAL_TINY
ailia_speech.AILIA_SPEECH_MODEL_TYPE_WHISPER_MULTILINGUAL_BASE
ailia_speech.AILIA_SPEECH_MODEL_TYPE_WHISPER_MULTILINGUAL_SMALL
ailia_speech.AILIA_SPEECH_MODEL_TYPE_WHISPER_MULTILINGUAL_MEDIUM
ailia_speech.AILIA_SPEECH_MODEL_TYPE_WHISPER_MULTILINGUAL_LARGE
ailia_speech.AILIA_SPEECH_MODEL_TYPE_WHISPER_MULTILINGUAL_LARGE_V3
ailia_speech.AILIA_SPEECH_MODEL_TYPE_WHISPER_MULTILINGUAL_LARGE_V3_TURBO
SenseVoice
ailia_speech.AILIA_SPEECH_MODEL_TYPE_SENSEVOICE_SMALL
Available vad versions
By default, version "4" of SileroVAD is used. The version can be specified from "4", "5", "6", and "6_2".
speech.initialize_model(model_path = "./models/", vad_type = AILIA_SPEECH_VAD_TYPE_SILERO, vad_version = "6_2")
API specification
https://github.com/ailia-ai/ailia-sdk
Run a local QNN model (Linux ARM64)
Install this package with python3 bootstrap.py followed by pip3 install .,
or install the public package with pip3 install ailia_speech.
Locate the native plug-in and copy the QAIRT libraries / v68 skel beside it:
pip3 show ailia_speech
SITE_PACKAGES=$(pip3 show ailia_speech | sed -n 's/^Location: //p')
SPEECH_NATIVE="$SITE_PACKAGES/ailia_speech/linux/arm64-v8a"
cp /path/to/qnn/libQnnHtp.so /path/to/qnn/libQnnSystem.so \
/path/to/qnn/libQnnHtpV68Stub.so /path/to/qnn/libQnnHtpV68Skel.so "$SPEECH_NATIVE/"
Save the complete recognition example from
QNN / Yocto Linux as transcribe_qnn.py, then run:
python3 transcribe_qnn.py \
--model whisper-large-v3-turbo-qcs6490-int16.qnn --input demo.wav
Use --model-type 3 for Medium and --language ja for Japanese.
The example uses soundfile to read audio; install it with pip3 install soundfile.
Open local model files
open() loads local files without downloading models. Optional VAD and
diarization model paths default to None:
speech = ailia_speech.Whisper()
print(speech.get_qnn_model_name())
speech.set_qnn_graph_switching(True)
speech.open("whisper-large-v3-turbo-qcs6490-int16.qnn",
model_type=ailia_speech.AILIA_SPEECH_MODEL_TYPE_WHISPER_MULTILINGUAL_LARGE_V3_TURBO,
vad_path=None, segmentation_path=None, embedding_path=None)
# ONNX: supply both files instead.
# speech.open("encoder.onnx", "decoder.onnx", model_type=...)
Call speech.transcribe(audio_waveform, sampling_rate) as usual afterward.
To use VAD, pass a local Silero ONNX file such as
vad_path="silero_vad_v6_2.onnx". For diarization, supply both
segmentation_path="segmentation.onnx" and
embedding_path="speaker-embedding.onnx". These ONNX models can be used with
QNN recognition. vad_type defaults to Silero and diarization_type to
Pyannote. Supplying VAD also applies the silent thresholds used by
initialize_model().
Select FP16 / FP32 and VAD version through the files themselves. External ONNX
weights must be placed at the locations referenced by the ONNX file. None
skips loading an optional model; it does not unload a previously loaded model.
Metadata
Release files for ailia-speech 1.6.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ailia_speech-1.6.1.tar.gz | 1.9 MB | Without provenance | Details for ailia_speech-1.6.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ailia_speech-1.6.1-py3-none-any.whl | Python 3 | none | any | Details for ailia_speech-1.6.1-py3-none-any.whl |
Total release size: 3.9 MB
Release files / ailia_speech-1.6.1.tar.gz
| Download URL | ailia_speech-1.6.1.tar.gz |
|---|---|
| Size | 1.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
73a56db2720019e9e6d3af6da809086c4d78476e22d5be2eaebe5ab53e0416da
|
|
BLAKE2b-256 checksum How to use checksums |
da173796ace9350dca84785187bae8dc701a72f8f95f70e83b7f2918e32efbae
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.13
|
Release files / ailia_speech-1.6.1-py3-none-any.whl
| Download URL | ailia_speech-1.6.1-py3-none-any.whl |
|---|---|
| Size | 1.9 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2bfcf9e39318789bca421cca5548f6be355c5237f8442f37ee24b94f7a623c76
|
|
BLAKE2b-256 checksum How to use checksums |
ff9773baa8e9c7f6d03e8fe0003a6a0f4429f39f297b52f5e8a63cce1f2a3cf3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.13
|
Security for ailia-speech 1.6.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.