YARP
Yet Another Robot Platform
 
Loading...
Searching...
No Matches
whisperSpeechTranscription.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2023-2023 Istituto Italiano di Tecnologia (IIT)
3 * SPDX-License-Identifier: BSD-3-Clause
4 */
5
6#ifndef WHISPERSPEECHTRANSCRIPTION_H
7#define WHISPERSPEECHTRANSCRIPTION_H
8
11#include <yarp/os/Bottle.h>
13#include <stdio.h>
14
15#include "whisper.h"
17
18using namespace yarp::os;
19
32{
33private:
34 bool m_verbose = true;
35 bool m_no_symbols = true;
36 std::string m_language="auto";
37 std::string m_model;
38 std::vector<float> m_pcmf32; // mono-channel F32 PCM
39 std::vector<std::vector<float>> m_pcmf32s; // stereo-channel F32 PCM
40 struct whisper_context* m_ctx= nullptr;
41 whisper_full_params m_wparams;
42
43 int32_t n_processors = 1;
44
45public:
52
53 //DeviceDriver interface
54 bool open(yarp::os::Searchable& config) override;
55 bool close() override;
56
57 //ISpeechTranscription interface
58 virtual yarp::dev::ReturnValue setLanguage(const std::string& language) override;
59 virtual yarp::dev::ReturnValue getLanguage(std::string& language) override;
60 virtual yarp::dev::ReturnValue transcribe(const yarp::sig::Sound& sound, std::string& transcription, double& score) override;
61};
62
63#endif
This class is the parameters parser for class WhisperSpeechTranscription.
WhisperSpeechTranscription: A yarp device which performs audio-to-text transcription using OpenAI Whi...
WhisperSpeechTranscription(const WhisperSpeechTranscription &)=delete
WhisperSpeechTranscription & operator=(const WhisperSpeechTranscription &)=delete
virtual yarp::dev::ReturnValue setLanguage(const std::string &language) override
Sets the language for speech transcription.
bool open(yarp::os::Searchable &config) override
Open the DeviceDriver.
bool close() override
Close the DeviceDriver.
WhisperSpeechTranscription & operator=(WhisperSpeechTranscription &&)=delete
virtual yarp::dev::ReturnValue getLanguage(std::string &language) override
Gets the current language set for speech transcription.
virtual yarp::dev::ReturnValue transcribe(const yarp::sig::Sound &sound, std::string &transcription, double &score) override
Performs the speech transcription.
WhisperSpeechTranscription(WhisperSpeechTranscription &&)=delete
Interface implemented by all device drivers.
A generic interface for speech transcription.
A mini-server for performing network communication in the background.
A base class for nested structures that can be searched.
Definition Searchable.h:31
Class for storing sounds See Audio in YARP for additional documentation on YARP audio.
Definition Sound.h:42
An interface to the operating system, including Port based communication.
Definition OSTestMsg.cpp:13