1

I'm making a program in c++ that reads Morse Code and prints it to the terminal, and gives the user the option to hear it. I know that, in order to make a "beep," you can use:

cout<<'\a';

However, since Morse Code contains with longer and shorter beeps, I would like to know how to make longer beeps than what would be produced by this command.

I'm using a Mac.

Potatoswatter
  • 134,909
  • 25
  • 265
  • 421
user3556908
  • 47
  • 2
  • 4

1 Answers1

1

If you write multiple bells. i.e. cout << "\a\a\a\a" it will come out as a longer beep.

However you also need a way to write the "silence" between the beeps, and the bell sound may be different from one environment to another, so this is not really a good approach.

There is no standard library support for controlling sound on the computer, but if you look for platform-specific functionality, you are likely to find it, and ultimately this will give much better results.

herohuyongtao
  • 49,413
  • 29
  • 133
  • 174
Dale Wilson
  • 9,166
  • 3
  • 34
  • 52