Add 2013/endoh3/try.sh

The script checks for SoX, padsp and otherwise ruby. It allows one to
pass in args: each one is first checked to be a readable file and if
it is it'll be processed as a file; otherwise it'll be processed as a
string. If no arg is specified it runs the program on twinkle.abc and
the strings ABC and CDEFGABc (the latter suggested by the author).

If none of the three tools noted above are installed it tells the user
to install one of them first. I was not able to test the padsp(1) one
but the invocation matches the author's remarks. /dev/dsp seems to not
be installed in modern linux systems so it would be useful to have
padsp(1) if not SoX (which is preferable in general for entries that
play sound). The ruby script wavify.rb provided by the author is the
last resort which turns the output to a WAV file.
This commit is contained in:
Cody Boone Ferguson committed 2024-01-27 10:29:47 -08:00
1 parent e60815bdb3
commit 6f20a57493
6 files changed
+146 -10

No files matched your search

+19 -8
View File
@@ -22,21 +22,32 @@ For more detailed information see [2013 endoh3 in bugs.md](/bugs.md#2013-endoh3)
./endoh3
```
This program plays sound. See [FAQ 3.10 - How do I compile and use an IOCCC
winner that requires sound?](/faq.md#faq3_10) if you do not know how to set your
system up for this or if you want to verify that everything is oky.
## Try:
Trying this out will depend on how your system can play sounds. The author's
remarks include some options for different operating systems.
The simplest way is to create a .wav file and have your system play that.
```sh
echo 'CDEFGABc' | ./endoh3 | ruby wavify.rb > cde.wav
./try.sh
./try.sh ABC
./try.sh test.abc yankee.abc
./try.sh *.abc
```
Observe how you will need ruby installed.
The script will check for SoX first and next `padsp` from `PulseAudio` and
finally if neither are found if you have `ruby(1)` installed it'll use the
included ruby script to convert it to a WAV file for you to play.
There are also some other musical samples, twinkle.abc and menuet.abc.
If no args are passed to the script it will play [twinkle.abc](twinkle.abc) and
the string `ABC`. Otherwise while there's a remaining arg if it's a file it will
run the program on the file. If it's not a file it'll run it as a string.
The `*.abc` files are provided as music samples.
## Judges' remarks: