Przeglądaj źródła

当检测到唤醒词后播放提示音,播放resoures目录下的提示音

corvin 5 lat temu
rodzic
commit
f584688942

+ 2 - 1
catkin_ws/src/snowboy_wakeup/launch/snowboy_wakeup.launch

@@ -13,7 +13,8 @@
 
     <node pkg="snowboy_wakeup" type="hotword_detector_node" name="snowboy_wakeup" respawn="true">
         <param name="resource_filename" value="$(find snowboy_wakeup)/resources/common.res" />
-        <param name="model_filename" value="$(find snowboy_wakeup)/resources/snowboy.umdl $(find snowboy_wakeup)/resources/corvin.pmdl" />
+        <param name="model_filename" value="$(find snowboy_wakeup)/resources/snowboy.umdl" />
+        <param name="beep_filename" value="$(find snowboy_wakeup)/resources/ding.wav" />
 
         <param name="sensitivity_str" value="0.7" type="str" />
         <param name="audio_gain" value="1.0" />

+ 8 - 2
catkin_ws/src/snowboy_wakeup/src/hotword_detector_node.cpp

@@ -32,6 +32,12 @@ namespace snowboy_wakeup
                     ROS_ERROR("Mandatory parameter 'model_filename' not present on the parameter server");
                     return false;
                 }
+                
+                std::string beep_filename;
+                if (!nh_p_.getParam("beep_filename", beep_filename))
+                {
+                    ROS_WARN("Mandatory parameter 'beep_filename' not present on the parameter server");
+                }
 
                 std::string asr_topic;
                 if (!nh_p_.getParam("asr_topic", asr_topic))
@@ -110,10 +116,10 @@ namespace snowboy_wakeup
                     int result = detector_.runDetection( &sample_array[0], msg->data.size()/2);                    
                     if (result == 1)
                     {
-                        ROS_INFO("Hotword 1 detected!");
+                        ROS_DEBUG("wakeUp detected!");
                         hotword_msg.data = result;
                         hotword_pub_.publish(hotword_msg);
-                        system("play -q --multi-threaded ~/Music/ding.wav");
+                        system("play -q --multi-threaded " + beep_filename);
                     }
                     else if (result == -3)
                     {