5
$\begingroup$

Beep is a terrible sound for alerting when a background task has successfully completed. It was primarily designed for errors or when a task fails. That's why it's rude, a little too loud, and a little obnoxious -- to get your attention.

I am not actually complaining about Beep. It's just that I see too many coders, and I do mean good coders, use it to alert success. I think I know why. Sound is a highly specialized and complex field so they don't bother trying to compose a more appropriate sound. I don't blame them one bit.

A sound that alerts success should be friendlier, less intrusive (half as loud), and last about .50 seconds. The sound I am thinkin of is ding. It's a single sound note that appears to have come from a tiny bell that you can hold with just two fingers.

I did read through some of the documentation and tutorials on sound and found that although Mathematica uses very powerful easy to use functions you still need to know the technical details of the sound youre attempting to reproduce. I don't even know what a flocking C-minor is.

If sound is your field please help me build a tiny bell Ding[]:=EmitSound[Sound[SingleNote[ding args, ops],ops],ops] (it might be constructed similarly, im not certain) as an alternative to Beep that is half as loud and lasts about .5 second or whatever time duration you feel is best.

$\endgroup$
8
$\begingroup$

It's not too hard to make your own Beep[] and change the definition. You may have to let Mathematica download the Marimba sound the first time you use it, or whatever sound you'd like to use instead, unless it's already present on your system.

mybeep[] := 
 EmitSound[
  Sound[{SoundNote["G", .3, "Marimba"], 
    SoundNote["C", .3, "Marimba"]}, .2]]

Unprotect[Beep];
Beep = mybeep;

Beep[]
$\endgroup$
5
  • 1
    $\begingroup$ If you want a 'ding' sound, then maybe mybeep[] := EmitSound[Sound[{SoundNote["F#5", .3, "Marimba"]}]] would work for you. $\endgroup$
    – flinty
    Aug 29 at 12:25
  • $\begingroup$ as i wrote in the body of my question there is nothing wrong with Beep when used correctly so i dont want to redine it. on your mybeep not bad at all. we'er almost there. the timing is perfect however the pitch or note is still a bit too low. think of the smallest bell that can be made that is still audible. the volume is even louder than Beep when i compared them. it should be half as loud as Beep. $\endgroup$ Aug 29 at 13:27
  • $\begingroup$ i almost forgot. it produces the sound but it generates the following error on my system: Sound*ToSampledSound::noidx: The SoundFont paclet cannot be installed. (replace * with backtick because i dont know how to escape backtick) can you fix that error and make suggested edits from prior comment? I only ask because i appreciate your good work and i intend to use it, but im a perfectionist. i hope you dont mind but i renamed it Ding lol $\endgroup$ Aug 29 at 14:21
  • 1
    $\begingroup$ @JulesManson (1) Explore the options Options@Sound. (2) Site tip: You can get a back by surrounding the code with two back ticks (no spaces): (``Sound`ToSampledSound``) $\endgroup$
    – Michael E2
    Aug 29 at 16:21
  • $\begingroup$ @MichaelE2 thank you for the tip. i think i detect a pattern. add additional outer ticks for every internal tick? .this is me just trying out correct form: Sound`ToSampledSound.and this is what i almost tried by prepending internal tick with a backslash "\": Sound`ToSampledSound. oh shit my hunch was correct. im starting to believe backslash works for everything everything lol $\endgroup$ Aug 29 at 20:17
-1
$\begingroup$

Thank you to user flinty for providing the template in previous answer (I upvoted his answer) which helped me find that elusive perfect ding sound for my Ding I had wanted as an alternative to Beep (designed to alert errors) for emitting a friendlier less intrusive sound on success or task completion.

After some tweaking here is my "final" version of Ding at various volumes which you can compare with Beep. However there is still a small problem with it. It produces an error (shown inside comment in code block) I do not understand or how to fix it (which is why I did not approve his answer).

I have two questions...

  1. your thoughts on Ding for alerting success?
  2. how do I fix that annoying error?

PLEASE NOTE THAT CODEBLOCK MAY NOT RENDER CORRECTLY HOWEVER ALL CONTENT BELOW IS INPUTFORM SO PLEASE JUST GRAB ALL AND PASTE TO NOTEBOOK

Ding[v_ : 3/5] := 
  EmitSound[
   Sound[{SoundNote["G#6", .3, "Marimba", SoundVolume -> v]}]];

Beep[] (* start with a little reminder of Beep *)
Pause[1]
Quiet@Ding[1/4] (* barely audible *)
Pause[1]
Quiet@Ding[1/2] (* Still too low *)
Pause[1]
Quiet@Ding[1] (* definitely intrusive, even louder than Beep *)
Pause[1]
Quiet@Ding[3/4] (* slightly loud *)
Pause[1]
Quiet@Ding[3/5] (* perfect volume, final version *)
Pause[1]
Beep[] (* the Beep again *)
Pause[1]
Ding[] (* final version produces error when Quiet not prepended *)
 
(* Ding still emits sound but produces the following error message *)
(*
Sound`ToSampledSound::noidx: The SoundFont paclet cannot be installed.
*)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.