yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
Jetson AGX Orin📖
01.Get started
  • 01.Learning Route
  • 02.Getting Started Quickly
02.Jetson basic course
  • 01.Jetson board introduction
  • 02.Flash new system to the onboard eMMC
  • 03.Flash new system to an NVMe SSD
  • 04.Install Jetpack environment
  • 05.Backup SSD system
  • 06.Restore factory image system
  • 07.SSD expansion
  • 08.Solid State Drive Speed Test
03.Basic setting course
  • 01.Basic knowledge
  • 02.Network configuration
  • 03.SSH remote login
  • 04.VNC remote control
  • 05.Remote file transfer
  • 06.Jtop tool
  • 07.Exchange space expansion
  • 08.Use VSCode
  • 09.Use VMware
  • 10. Change screen resolution
  • 11. Virtual Desktop
  • 12. Set root user password
  • 13. Configure sudo passwordless operation
  • 14. Managing custom services
  • 15. View system version information
04.GPIO control course
  • 01.GPIO description
  • 02.GPIO library installation
  • 03.GPIO reading
  • 04.GPIO output
  • 05.Serial communication
  • 06.I2C communication
05.OpenCV basic course
  • 01.Image reading
  • 02.Image saving
  • 03.Image modification
  • 04.Image scaling
  • 05.Image cropping
  • 06.Image translation
  • 07.Image mirroring
  • 08.Image grayscale conversion
  • 09.Image binarization
  • 10.Image edge detection
  • 11.Add line segments
  • 12.Add rectangles
  • 13.Add circular shape
  • 14.Add ellipses
  • 15.Add polygons
  • 16.Add Text
06.Vision basic course
  • 01.USB camera preview
  • 02.Use Jupyter Lab
  • 03.Use JetCam
07.Vision advanced course
01.Environment construction
  • 01.TensorFlow
  • 02.PyTorch
  • 03.Torchvision
02.DeepStream development
  • 01.DeepStream environment
  • 02.Four types of detection(traffic)
03.YOLO11 development
  • 01.YOLO environment construction
  • 02.CLI use
  • 03.Object detection
  • 04.Instance segmentation
  • 05.Pose estimation
  • 06.Image classification
  • 07.Oriented object detection
  • 08.Model conversion
  • 09.Dataset annotation
  • 10.Model training conversion
  • 11.Model prediction
04.Mediapipe development
  • 01.Mediapipe environment
  • 02.Hand detection
  • 03.Face detection
  • 04.Face effects
  • 05.3D object recognition
  • 06.Virtual brush
  • 07.Gesture recognition
  • 08.Finger control
  • 09.Posture estimation
  • 10.Face mask
  • 11.Overall detection
  • 12.Green scene removal(Human)
05.QR code recognition
  • 01.Barcode Recognition
  • 02.QR Code Recognition
  • 03.Machine Code Recognition
  • 04.Handwritten Digit Recognition
06.YOLO26 development
  • 01.YOLO Environment Setupnew
  • 02.CLI Usagenew
  • 03.Object Detectionnew
  • 04.Instance Segmentationnew
  • 05.Pose Estimationnew
  • 06.Image Classificationnew
  • 07.Oriented Bounding Boxes Object Detectionnew
  • 08.Model Conversionnew
  • 09.Dataset Annotationnew
  • 10.Model Training_Conversionnew
  • 11.Model Predictionnew
08.Docker basic course
  • 01.Docker introduction
  • 02.Docker installation
  • 03.Docker command
  • 04.Docker usage
  • 05.Docker interaction
09.ROS2-Humble
01.ROS2 basic course
  • 3.ROS2 development environment
  • 1.Introduction to ROS2
  • 2.ROS2 install Humble
  • 4.ROS2 workspace
  • 5.ROS2 function package
  • 6.ROS2 node
  • 7.ROS2 topic communication
  • 8.ROS2 service communication
  • 9.ROS2 action communication
  • 10.ROS2 custom interface message
  • 11.ROS2 parameter service case
  • 12.ROS2 meta-function package
  • 13.ROS2 distributed communication
  • 14.ROS2 DDS
  • 15.ROS2 time related API
  • 16.ROS2 common command tools
  • 17.ROS2 rviz2 use
  • 18.ROS2 rqt toolbox
  • 19.ROS2 Launch startup file configuration
  • 20.ROS2 recording and playback tool
  • 21.ROS2 URDF model
  • 22.ROS2 Gazebo simulation platform
  • 23.ROS2 TF2 coordinate transformation
02.ROS2 vision course
  • 01.Camera preview (USB)
  • 02.Camera calibration (USB)
  • 03.AR vision (USB)
10.Offline AI model course
Offline large model (Text Interaction)
  • 10.AI large model offline voice assistant
  • 1.Al large model environment deployment
  • 2.Install large model dialogue platform
  • 3.Meta Al Llama3.2 model
  • 4.Alibaba Cloud Qwen3 model
  • 5.Microsoft Phi-4-mini model
  • 6.DeepSeek DeepSeek-R1 model
  • 7.Alibaba Cloud Qwen2.5v visual multimodal large model
  • 8.Google Gemma3 visual multimodal large model
  • 9.Lava visual multimodal large model
  • 10.MiniCPM-V visual multimodal large model
  • 11.Multimodal visual understand application
  • 12.Multimodal text image application
  • 13.Multimodal video analysis application
  • 14.Multi module visual position application
  • 15.Multimodal table scanning application
  • 16.Multimodal autonomous agent application
Offline large model (Voice Interaction)
  • 0.Voice interaction hardware connection (ReadMe)
  • 1.Offline speech to text (ASR)
  • 2.Offline text to speech (TTS)
  • 3.AI large model voice interaction
  • 4.Multimodal visual understand speech interaction
  • 5.Multimodal text and graphics application
  • 6.Multimodal video analysis application
  • 7.Multi module visual position application
  • 8.Multimodal table scanning application
  • 9.Multimodal autonomous proxy application
11.Online AI model course
Online large model (Text Interaction)
  • 8.AI large model offline voice assistant
  • 1.OpenRouter large model API aggregation platform
  • 2.Multimodal visual understand application
  • 3.Multimodal visual localization application
  • 4.Multimodal table scanning application
  • 5.Multimodal autonomous proxy application
Online large model (Voice Interaction)
  • 0.Voice interaction hardware connection (ReadMe)
  • 1.Online speech to text (ASR)
  • 2.Online text to speech (TTS)
  • 3.AI large model voice interaction
  • 4.Multimodal visual understand speech interaction
  • 5.Multi module visual position application
  • 6.Multimodal table scanning application
  • 7.Multimodal autonomous proxy application
12.Offline Generative AI Applications
  • 01.Children's Storytelling Session
  • 02.Cooking Assistant
  • 03.Homework tutor
  • 04.Image to animation
13.OpenClaw Advanced Development
  • 00.OpenClaw Quick Start on Jetson Platform
  • 01.OpenClaw Installation
  • 02.OpenClaw Online Platform Deployment
  • 03.OpenClaw Local Model Deployment
  • 04.OpenClaw TUI Interaction
  • 05.OpenClaw WebChat Interaction
  • 06.OpenClaw Tools Introduction
  • 07.OpenClawGate Gateway User Manual
  • 08.OpenClaw Features Overview
  • 09.OpenClawClawHub Introduction (Skill Installation)
  • 10. OpenClaw Switching Models
  • 11.OpenClaw Application - File Management
  • 12.OpenClaw Application - Camera
  • 13.OpenClaw Application - Browser Control
  • 14.OpenClaw Application - Script Execution
  • 15.OpenClaw Application - AI Programming
  • 16.OpenClaw Application - Dedicated AI Assistant
  • 17.OpenClaw WhatsApp Plugin Application
Download
  • System_File
  • VM_File
  • Code
  • Tools
Download ZIP

Welcome to Jetson AGX Orin repository

当製品の日本語版マニュアル資料は、こちらからご取得ください。

3.AI large model voice interaction

3.AI large model voice interaction

3.AI large model voice interaction1. Concept Introduction1.1 What is "AI Large Model Voice Interaction"?1.2 Implementation Principle2. Code AnalysisKey Code1. Voice Input Node (largemodel/largemodel/asr.py)2. AI service and voice output node (largemodel/largemodel/model_service.py)Code Analysis3. Practical Operations3.1 Configuring Offline Voice Interaction3.2 Starting and Testing the Function

1. Concept Introduction

1.1 What is "AI Large Model Voice Interaction"?

In the largemodel project, AI Large Model Voice Interaction combines the offline ASR and offline TTS described above with the large language model (LLM) core to form a complete conversational system that listens, speaks, and thinks.

This is no longer an isolated function, but rather the prototype of a true voice assistant. Users can engage in natural language conversations with the robot through voice, and the robot can understand questions, think about answers, and respond with voice. This entire process is completed locally, without the need for a network.

The core of this function is the model_service` ROS2 node. It acts as the brain and neural center, subscribing to ASR recognition results, invoking the LLM for thinking, and then publishing the LLM's text responses to the TTS node for speech synthesis.

1.2 Implementation Principle

This feature is implemented using a classic data flow pipeline:

  1. Audio -> Text (ASR): The asr node continuously listens to ambient sound. Once it detects a user speaking a sentence, it converts it into text and publishes it to the /asr_text topic.
  2. Text -> Thought -> Text (LLM): The model_service node subscribes to the /asr_text topic. Upon receiving the text from the ASR, it passes it as a prompt to a locally deployed large language model (such as Qwen running through Ollama). The LLM generates a text response based on the context.
  3. Text -> Audio (TTS): After receiving the LLM's response, the model_service node publishes it to the /tts_text topic.
  4. Audio Playback: The tts_only node subscribes to the /tts_text topic. Upon receiving text, it immediately invokes the offline TTS model to synthesize it into audio and plays it through the speaker.

This process forms a complete closed loop: speech input -> text processing -> text output -> speech output.


2. Code Analysis

Key Code

1. Voice Input Node (largemodel/largemodel/asr.py)

​x
# From largemodel/largemodel/asr.py
class ASRNode(Node):
    def __init__(self):
        # ...
        self.asr_pub = self.create_publisher(String, "asr", 5)
        # ...
​
    def kws_handler(self)->None:
        if self.listen_for_speech(self.mic_index):
            asr_text = self.ASR_conversion(self.user_speechdir)
            if asr_text != 'error':
                self.asr_pub_result(asr_text)
​
    def asr_pub_result(self,asr_result:str)->None:
        msg=String(data=asr_result)
        self.asr_pub.publish(msg)

2. AI service and voice output node (largemodel/largemodel/model_service.py)

xxxxxxxxxx
# From largemodel/largemodel/model_service.py
class LargeModelService(Node):
    def __init__(self):
        # ...
        self.asrsub = self.create_subscription(String,'asr', self.asr_callback,1)
        # ...
​
    def asr_callback(self,msg):
        """Callback function for handling ASR messages. / 处理ASR消息的回调函数。"""
        # ...
        result = self.model_client.infer_with_text(msg.data, message=messages_to_use)
        self.process_model_result(result)
​
    def process_model_result(self, result, from_seewhat=False):
        """Process the result returned by the model. / 处理模型返回的结果。"""
        # ...
        user_friendly_response = response_json.get("response", "我正在处理...")
        # ...
        self._safe_play_audio(user_friendly_response)
        # ...
        self.execute_tools(tools_list)
​
    def _safe_play_audio(self, text_to_speak: str):
        """
        Synthesizes and plays all non-empty messages only in non-text chat mode.
        """
        if not self.text_chat_mode and text_to_speak:
            try:
                self.model_client.voice_synthesis(text_to_speak, self.tts_out_path)
                self.play_audio_async(self.tts_out_path)
            except Exception as e:
                self.get_logger().error(f"Safe audio playback failed: {e}")

Code Analysis

The voice interaction functionality of the large AI model is implemented by two independent ROS nodes, asr.py and model_service.py, which communicate via the ROS topic /asr, forming a complete processing loop.

  1. Voice Input and Publishing (asr.py):
  • The ASRNode node processes voice input. In the kws_handler function, it performs audio recording and text conversion.
  • After successful conversion, the asr_pub_result function is called. This function places the resulting text string into a std_msgs.msg.String message and then publishes it to the /asr topic via the self.asr_pub publisher.
  1. Subscription and Response (model_service.py):
  • During initialization, the LargeModelService node subscribes to the /asr topic using the create_subscription method and specifies asr_callback as its callback function.
  • When ASRNode publishes a message on the /asr topic, the ROS system automatically calls the asr_callback function of LargeModelService, passing the message as the msg parameter.
  1. Interaction Loop:
  • After receiving the message, the asr_callback function extracts the text data (msg.data) and passes it to the large model for inference (self.model_client.infer_with_text).
  • After inference is complete, the process_model_result function is called. This function extracts the reply text from the model result.
  • Next, the _safe_play_audio function is called, which uses the TTS function (self.model_client.voice_synthesis) to synthesize the reply text into audio and play it back.
  • At this point, a complete interaction loop from "receiving user voice" to "responding to the user with voice" is completed. The two nodes are decoupled using the ROS publish-subscribe model. asr.py handles input, while model_service.py handles processing and output.

3. Practical Operations

3.1 Configuring Offline Voice Interaction

To implement a fully offline voice interaction system, you need to ensure that all three components, ASR, TTS, and LLM, are configured for offline mode.

  1. Open the main configuration file yahboom.yaml:

    xxxxxxxxxx
    gedit ~/yahboom_ws/src/largemodel/config/yahboom.yaml
  2. Modify/confirm the following key configurations:

    xxxxxxxxxx
    asr:
      ros__parameters:
        use_oline_asr: False                # Key: Set to False to enable offline ASR
        regional_setting : "international" 
    ​
    model_service:
      ros__parameters:
        useolinetts: False                   # Key: Set to False to enable offline TTS
        llm_platform: 'ollama'              # Key: Set to 'ollama' to enable offline LLM
    regional_setting : "international" 
  3. Open the model interface configuration file large_model_interface.yaml:

    xxxxxxxxxx
    gedit ~/yahboom_ws/src/largemodel/config/large_model_interface.yaml
  4. Confirm that all offline model paths are correct:

    xxxxxxxxxx
    # large_model_interface.yaml
    ​
    ## Offline large model
    ollama_model: "qwen2.5:7b"  # Make sure the model has been downloaded via ollama pull
    ​
    ## Offline speech recognition
    local_asr_model: "/path/to/your/SenseVoiceSmall" # Make sure the ASR model path is correct
    ​
    ## Offline speech synthesis
    zh_tts_model: "/path/to/your/zh_CN-huayan-medium.onnx" # Make sure the TTS model path is correct
    # ...

If you have modified any configuration files, please run the following command to compile the ROS workspace for the configuration to take effect.

xxxxxxxxxx
cd ~/yahboom_ws
colcon build

 

3.2 Starting and Testing the Function

  1. Start largemodel main program: Run the following command to enable voice interaction:

    xxxxxxxxxx
    ros2 launch largemodel largemodel_control.launch.py
  2. Test:

    • Wake up: Say "Hi, yahboom" into the microphone.
    • Dialogue: After the speaker responds, you can speak your questions.
    • Observe the log: In the terminal running the launch file, you should see the following:
    1. The ASR node recognizes your question and prints it.
    2. The model_service node receives the text, calls the LLM, and prints the LLM's response.
    • Listen to the answer: After a while, you should hear the robot's synthesized voice answer your question through the speaker.
Offline text to speech (TTS)
Multimodal visual understand speech interaction

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文