-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,44 @@ | ||
# alsa | ||
|
||
Erlang alsa (libasound2) bindings | ||
Erlang Alsa (libasound2) bindings. | ||
|
||
## Build | ||
The Alsa application allows for capture and playing audio through the Linux Alsa | ||
interface. | ||
|
||
$ rebar3 compile | ||
# Setup | ||
|
||
## Example | ||
You need to add `alsa` as a dependency to your project. If you are using `rebar3`, | ||
you can add the following to your `rebar.config`: | ||
|
||
$ rebar3 shell | ||
```erlang | ||
{deps, [ | ||
{alsa, "0.1.0"} | ||
]}. | ||
``` | ||
|
||
Then type the following into the shell: | ||
Also ensure that `alsa` is added as a dependency to your application, by updating | ||
your `.app.src` file: | ||
|
||
```erlang | ||
alsa_test:play("default", alsa_test:generate_noise(5000)). | ||
``` | ||
```erlang | ||
{application, my_app, [ | ||
|
||
You should hear random audio coming from the default soundcard. | ||
{applications, [ | ||
kernel, | ||
stdlib, | ||
|
||
alsa % <- You need this in your applications list | ||
]} | ||
]}. | ||
``` | ||
|
||
# Usage | ||
|
||
For usage please refer to the examples in the examples directory. You can also | ||
test the examples directly from the shell: | ||
|
||
```erlang | ||
1> c("examples/alsa_example_pcm.erl"). | ||
{ok,alsa_example_pcm} | ||
2> alsa_example_pcm:play("default", alsa_example_pcm:generate_noise(5000)). | ||
ok | ||
``` |