#include <include/tone.h>
Generates one full pulse-code modulation (PCM) period of a tone with the given parameters.
- Note
- The returned frequency of the tone is the quotient of the sample_freq_hz divided by the tone_freq_hz.
- Parameters
-
| tone | User provided buffer. Must be large enough to hold the generated PCM tone, depending on settings. |
| tone_size | Resulting tone size in bytes. |
| tone_freq_hz | The desired tone frequency in the range [100..10000] Hz. |
| smpl_freq_hz | Sampling frequency. |
| amplitude | Amplitude in the range [0..1]. |
- Return values
-
| 0 | Tone generated. |
| -ENXIO | If tone or tone_size is NULL. |
| -EINVAL | If smpl_freq_hz == 0 or tone_freq_hz is out of range. |
| -EPERM | If amplitude is out of range. |