ghnotgood opened a new pull request, #3477:
URL: https://github.com/apache/nuttx-apps/pull/3477
## Summary
Add `rtttl-c`, a simple parsing library, to the `audioutils` directory.
## Impact
Developers may implement a procedure that makes sound
```
void
play_tone(struct rtttl_tone tone)
{
/* TODO */
}
```
and then play a sound encoded in the RTTTL string (`"..."` in the following)
```
rtttl_play("...", play_tone);
```
## Testing
The testing code is
```
void
print_tone(struct rtttl_tone tone)
{
_info("playing %d /100 Hz for %d us",
tone.frequency_100hz, tone.duration_us);
}
int
main(int argc, char **argv)
{
rtttl_play("Jingle
Bells:o=5,d=4,b=170,b=170:b,b,b,p,b,b,b,p,b,d6,g.,8a,2b.,8p,c6,c6,c6.,8c6,c6,b,b,8b,8b,b,a,a,b,2a,2d6",
print_tone);
return 0;
}
```
with the output of
```
print_tone: playing 98776 /100 Hz for 352941 us
print_tone: playing 98776 /100 Hz for 352941 us
print_tone: playing 98776 /100 Hz for 352941 us
print_tone: playing 0 /100 Hz for 352941 us
print_tone: playing 98776 /100 Hz for 352941 us
print_tone: playing 98776 /100 Hz for 352941 us
print_tone: playing 98776 /100 Hz for 352941 us
print_tone: playing 0 /100 Hz for 352941 us
print_tone: playing 98776 /100 Hz for 352941 us
print_tone: playing 117464 /100 Hz for 352941 us
print_tone: playing 78400 /100 Hz for 529410 us
print_tone: playing 88000 /100 Hz for 176470 us
print_tone: playing 98776 /100 Hz for 1058823 us
print_tone: playing 0 /100 Hz for 176470 us
print_tone: playing 104652 /100 Hz for 352941 us
print_tone: playing 104652 /100 Hz for 352941 us
print_tone: playing 104652 /100 Hz for 529410 us
print_tone: playing 104652 /100 Hz for 176470 us
print_tone: playing 104652 /100 Hz for 352941 us
print_tone: playing 98776 /100 Hz for 352941 us
print_tone: playing 98776 /100 Hz for 352941 us
print_tone: playing 98776 /100 Hz for 176470 us
print_tone: playing 98776 /100 Hz for 176470 us
print_tone: playing 98776 /100 Hz for 352941 us
print_tone: playing 88000 /100 Hz for 352941 us
print_tone: playing 88000 /100 Hz for 352941 us
print_tone: playing 98776 /100 Hz for 352941 us
print_tone: playing 88000 /100 Hz for 705882 us
print_tone: playing 117464 /100 Hz for 705882 us
```
When instead of `print_tone`, there is a `play_tone` procedure with the
board-specific code to make the sound, the Jingle Bells song is played.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]