Function Repository Resource:

# Ding

Generate the ding sound of a tiny bell

Contributed by: Jules Manson
 ResourceFunction["Ding"][] generates an audible ding at maximum volume 1. ResourceFunction["Ding"][vol] generates an audible ding at a set volume vol.

## Details

ResourceFunction["Ding"] is meant to be an alternative to Beep for producing ResourceFunction["Ding"]/Beep pass/fail audible alerts after completion of time intensive calculations, on evaluation of critical events whose results are not immediately viewable, or upon execution of background tasks.
Plays a sound note of pitch G6 for a duration of 0.333 seconds.
All mentions of volume are relative to the current volume level on computer or device.
Only integer, rational, or real values in the range 0 to 1 are valid. Mathematical functions that reduce to a positive number within range may work but this is not recommended.
The output of ResourceFunction["Ding"] is Null.

## Examples

### Basic Examples (4)

Generate a ding at the default volume of 1:

 In[1]:=

Generate a ding at moderate volume with a rational number 3/4:

 In[2]:=

Generate a ding at half volume:

 In[3]:=

Values greater than 1 are clipped to 1 but a warning message is issued:

 In[4]:=

### Scope (2)

Contrast Ding with Beep using a Do loop to repeat sounds:

 In[5]:=

Generate a ding to alert on True condition:

 In[6]:=
 Out[6]=

Generate a Beep to alert on False condition:

 In[7]:=
 Out[7]=

Generate a quick triple ding to alert on Indeterminate condition:

 In[8]:=
 Out[8]=

### Applications (2)

Create an audible alert with Ding after a long calculation completes:

 In[9]:=
 Out[9]=

Define a function for a TimeConstrained expression alerting Ding with returned results or Beep on \$Aborted:

 In[10]:=

To ensure we see the two cases we need to evaluate with excessive constraints. First we do excessively short:

 In[11]:=
 Out[11]=

Now we try an excessively long constraint:

 In[12]:=
 Out[12]=

### Possible Issues (2)

Only one ding can be heard because all notes will be produced on top of one another:

 In[13]:=

Add a short Pause after every ding:

 In[14]:=

### Neat Examples (1)

Emulate the classic ringing of a rotary phone:

 In[15]:=

Jules Manson

## Version History

• 1.0.0 – 14 June 2022

## Author Notes

Jules Manson took time off from from his engineering duties to return to CSULB as a Physics student. While there he was introduced to Mathematica as a required course and instantly fell in love with it. He is active at Mathematica Stack Exchange (and other communities on SE) and Quora. If you like his work you can find more of his content (Wolfram packages) over at GitHub.