FFtrim gRPC Service
This assignment is to build an gRPC service named fftrim-grpc-service
which
will be an extension to the fftrim
assignment. You'll
need to interface your fftrim
tool via gRPC endpoints so one can request
these endpoints and perform the same operations as the fftrim
CLI tool.
Here's the protobuf definition which should be the reference for the service you create:
syntax = "proto3";
package fftrim_grpc_service;
service FFTrimService {
rpc Trim(TrimRequest) returns (TrimResponse) {}
}
message TrimRequest {
TrimConfig config = 1;
bytes audio = 2;
}
message TrimConfig {
int16 start_time = 1;
int16 end_time = 2;
int16 duration = 3;
}
message TrimResponse {
bytes audio = 1;
}
Use this proto to compile and generate code and stubs for Python/Golang.
Python
For Python you can do something like below to generate Python code from the proto definitions:
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. fftrim.proto
Go
protoc -I. -I /usr/local/include/ --go_out=plugins=grpc:. --proto_path=. labels.proto
Feel free to add/remove items in the proto definition you feel is relevant and wish to send in the request/response.
Note
Audio in request/response to/from this API need to be the raw audio data and not an external reference to the audio file.
Resources
Few resources that you might want to follow for working on this: