# Hear your application with Quarkus Sonify

In dev mode, you learn what your application does by looking: at the terminal, at the browser, at the Dev UI. [Quarkus Sonify](https://github.com/quarkiverse/quarkus-sonify) lets you listen instead.

It is a small extension, and it is mostly for fun.

## What you hear

Sonify plays a short sound on the machine that runs the application:

- one when an HTTP request arrives, different for each HTTP method
- one when its response is sent, different for each status code
- a chime when the application starts, and after every live reload

A `GET` is one tap, a `POST` is two rising taps, and a `DELETE` is two falling taps. For a response, the class of the status code picks the kind of sound, and the code picks its pitch: a `200` is a clear note, a `404` is a hollow one, and a `500` is a thud.

The sounds are synthesized in the JVM, so there is no browser tab to keep open and no native dependency.

## Try it

Add the extension to your application:

```xml
<dependency>
    <groupId>io.quarkiverse.sonify</groupId>
    <artifactId>quarkus-sonify</artifactId>
    <version>0.1.0</version>
</dependency>
```

Start dev mode, and send a request:

```shell
curl -X DELETE http://localhost:8080/no-such-thing
```

## Your own sounds

A method of a CDI bean can have a sound of its own:

```java
@PlaySound("order-placed")
public Order place(Cart cart) {
    // ...
}
```

You can also inject a `SoundPlayer` and call `play("order-placed")` from anywhere.

Every sound can be replaced with a WAV file or turned off in `application.properties`:

```properties
quarkus.sonify.sound."order-placed"=sounds/coin.wav
quarkus.sonify.status."418"=sounds/whistle.wav
quarkus.sonify.method.options=off
```

## Only in dev mode

Everything that makes a sound lives in an artifact that Quarkus only adds in dev mode. In production and in tests, the annotation and the `SoundPlayer` do nothing, and the audio code is not part of the application. There is nothing to remove before you ship.

## Listen for yourself

The [repository](https://github.com/quarkiverse/quarkus-sonify) has a demo with a page of links, one for every HTTP method and status code. Ideas for sounds are welcome in the [issue tracker](https://github.com/quarkiverse/quarkus-sonify/issues).
