Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Make a beep sound - ROS C++ Ubuntu

I would like to make a beeping sound when my timer reaches a certain value. I tried the simple '/a' but this does not work. Can anyone suggest how to make this work or perhaps some other way of making a beep sound? The lines I tried are :

std::cout << '\a' << std::endl;
std::cout << "Beeping \a" << std::endl;

I do see the "Beeping" output on console, just no sound. And yes, sounds in general do work well on my computer, I tried ;)

BTW, I have tried sound_play package to play a .wav file and found it to be somewhat unreliable, therefore I settled to get just a simple beep for now.

I launch this node from a launch file like so :

<launch>

  <group ns="sensors_recorder_gui">
    <node name="sensors_recorder_gui" output="screen" pkg="rqt_gui" type="rqt_gui" args="-s sensors_recorder_gui" />
  </group>

</launch>

It is to be noted that this is an RQT widget application (I have come across QSound library but could not get the include to work, but perhaps that should be a different question.)

Many thanks for any great suggestions!

Make a beep sound - ROS C++ Ubuntu

I would like to make a beeping sound when my timer reaches a certain value. I tried the simple '/a' but this does not work. Can anyone suggest how to make this work or perhaps some other way of making a beep sound? The lines I tried are :

std::cout << '\a' << std::endl;
std::cout << "Beeping \a" << std::endl;

I do see the "Beeping" output on console, just no sound. And yes, sounds in general do work well on my computer, I tried ;)

BTW, I have tried sound_play package to play a .wav file and found it to be somewhat unreliable, therefore I settled to get just a simple beep for now.now.

EDIT: I also tried ncurses, but it is apparently incompatible with qt environemnt and I got errors with qtextformat.h (which wasn't even realted!) so I had to get rid of it.

I launch this node from a launch file like so :

<launch>

  <group ns="sensors_recorder_gui">
    <node name="sensors_recorder_gui" output="screen" pkg="rqt_gui" type="rqt_gui" args="-s sensors_recorder_gui" />
  </group>

</launch>

It is to be noted that this is an RQT widget application (I have come across QSound library but could not get the include to work, but perhaps that should be a different question.)

Many thanks for any great suggestions!