Skip to main content
Version: 3.5.0

Denoiser

Phonexia denoiser is a tool for removing noises and other disturbing elements from audio recordings.

Installation

Getting denoiser docker image

You can easily obtain the denoiser docker image from docker hub. Just run:

docker pull phonexia/denoiser:latest

Running the image

Docker

You can start the microservice and list all the supported options by running:

docker run --rm -it phonexia/denoiser:latest --help

The output should look like this:

Usage: denoiser [OPTIONS]

Options:
-h,--help Print this help message and exit
-m,--model file REQUIRED (Env:PHX_MODEL_PATH)
Path to a model file.
-k,--license_key string REQUIRED (Env:PHX_LICENSE_KEY)
License key.
-a,--listening_address address [[::]] (Env:PHX_LISTENING_ADDRESS)
Address on which the server will be listening. Address '[::]' also accepts IPv4 connections.
-p,--port number [8080] (Env:PHX_PORT)
Port on which the server will be listening.
-l,--log_level level:{error,warning,info,debug,trace} [info] (Env:PHX_LOG_LEVEL)
Logging level. Possible values: error, warning, info, debug, trace.
--keepalive_time_s number:[0, max_int] [60] (Env:PHX_KEEPALIVE_TIME_S)
Time between 2 consecutive keep-alive messages, that are sent if there is no activity from the client. If set to 0, the default gRPC configuration (2hr) will be set (note, that this may get the microservice into unresponsive state).
--keepalive_timeout_s number:[1, max int] [20] (Env:PHX_KEEPALIVE_TIMEOUT_S)
Time to wait for keep alive acknowledgement until the connection is dropped by the server.
--num_instances_per_device NUM:UINT > 0 (Env:PHX_NUM_INSTANCES_PER_DEVICE)
Number of instances per device. Microservice can process requests concurrently if value is >1.
note

The model and license_key options are required. To obtain the model and license, contact Phonexia.

You can specify the options either via command line arguments or via environmental variables.

Run the container with the mandatory parameters:

docker run --rm -it -v /opt/phx/models:/models -p 8080:8080 /phonexia/denoiser:latest --model /models/denoiser-generic-1.0.0.model --license_key ${license-key}

Replace the /opt/phx/models, denoiser-generic-1.0.0.model and license-key with the corresponding values.

With this command, the container will start, and the microservice will be listening on port 8080 on localhost.

Microservice communication

gRPC API

For communication, our microservices use gRPC, which is a high-performance, open-source Remote Procedure Call (RPC) framework that enables efficient communication between distributed systems using a variety of programming languages. We use an interface definition language to specify a common interface and contracts between components. This is primarily achieved by specifying methods with parameters and return types.

Take a look at our gRPC API documentation. The denoiser microservice defines a Denoiser service with remote procedure called Denoise. This procedure accepts an argument (also referred to as "message") called DenoiseRequest, which contains the audio as an array of byte.

This DenoiseRequest argument is streamed, meaning that it may be received in multiple requests, each containing a part of the audio. The Denoise procedure returns a message called DenoiseResponse which consists of the denoised audio. As well as DenoiseRequest, DenoiseResponse is also streamed.

Connecting to microservice

There are multiple ways how you can communicate with our microservices.

Using generated library

The most common way how to communicate with the microservices is via a programming language using a generated library.

Python library

If you use Python as your programming language, you can use our official gRPC Python library.

To install the package using pip, run:

pip install phonexia-grpc

You can then import:

  • Specific libraries for each microservice that provide the message wrappers.
  • stubs for the gRPC clients.
from phonexia.grpc.common.core_pb2 import Audio, RawAudioConfig, TimeRange
from phonexia.grpc.technologies.denoiser.v1.denoiser_pb2 import DenoiseRequest, DenoiseResponse
from phonexia.grpc.technologies.denoiser.v1.denoiser_pb2_grpc import DenoiserStub
Generate library for programming language of your choice

For the definition of microservice interfaces, we use the standard way of protocol buffers. The services, together with the procedures and messages that they expose, are defined in the so-called proto files.

The proto files can be used to generate client libraries in many programming languages. Take a look at protobuf tutorials for how to get started with generating the library in the languages of your choice using the protoc tool.

You can find the proto files developed by Phonexia in this repository.

Versioning

We use Semantic Versioning.