# DTMF Tone Generator Example

Dual Tone Multi Frequency signals are common way how to transfer simple data over analogue voice line. The detailed description can be found in the Wikipedia article here.

## Contents

The example consists of one web resource:

`org.glassfish.jersey.examples.tonegen.WavResource`
  This Java class returns the wave audio containing the sequence of DTMF tones generated based on a given set of query parameters.

The example parses query parameters, generates sinus waves and composes them to create a valid DTMF tone sequence.

The mapping of the URI path space is presented in the following table:

URI path | Resource class | HTTP methods | Description
--- | --- | --- | ---
wav | WavResource | GET | Create a wav audio containing the DTMF tones.

The following query parameters can be declared:

Query parameter | Default Value | Description
--- | --- | ---
toneSequence | 1234567890#* | A String containing valid DTMF characters (0-9, # and *).
toneDuration | 300 | Duration of one generated tone in milliseconds.
silenceDuration | 100 | Duration of the silence between two generated tones.

## Running the Example

Run the example as follows:

run

> `mvn compile exec:java`

From a web browser, visit:

> `http://localhost:9998/tonegen`

Tweak the parameters and click Play to hear the result or compose your own URI based on the description above and have the wav audio returned from the resource.