changed default sample rate to 48kHz, updated README for new usage information

This commit is contained in:
Ellie D 2019-05-17 21:07:21 -05:00
parent d165cbc177
commit 97f995fc8a
3 changed files with 7 additions and 12 deletions

View File

@ -18,20 +18,15 @@ With the Rust compiler installed under a Unix-like OS, you can compile this sour
###How to Use ###How to Use
Interval can be run at the command line with the following syntax: Interval can be run at the command line with the following syntax:
`./interval [input file]` `./interval [input file] [output file]`
This will produce a WAV RIFF header followed by a PCM audio stream to stdout, which can then be piped into a file, audio This will attempt to read Interval code from the input file, generate audio based on it, and emit the resulting data,
device, or other audio stream acceptor. If you don't pipe it into anything and it dumps the stream out onto the console, prefixed with a suitable RIFF header, into the output file (which will be in `.wav` format). The audio stream is signed
then it will probably flood your screen with garbage text, so be warned. 16-bit little endian samples, at a sample rate defined by a static variable in the source code (48 kHz by default).
###Example Usage ###Example Usage
Under Linux with ALSA, you can compile and play a .ITV source file with a command like this: Under Linux with ALSA, you can compile and play a .ITV source file with a command like this:
`./interval test.itv | aplay` `./interval test.itv`
This will write WAV data into `test.wav`, creating it if it does not exist and overwriting it if it does.
###Writing to Files
You can pipe the output of the program into a file:
`./interval test.itv > test.wav`
This file will be in standard WAV format, and can be converted to other formats with a conversion tool such as
avconv or ffmpeg.

Binary file not shown.

View File

@ -159,7 +159,7 @@ Tricks:
*/ */
static RATE:f64 = 44100.0; // audio sample rate in samples/sec static RATE:f64 = 48000.0; // audio sample rate in samples/sec
static TAUS:f64 = 5.0; // number of time contants to allow for notes to finish ringing before ending the output stream static TAUS:f64 = 5.0; // number of time contants to allow for notes to finish ringing before ending the output stream
use std::io::prelude::*; use std::io::prelude::*;