Difference between revisions of "Sound"
From Noah.org
Jump to navigationJump to searchm |
|||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[Category:Engineering]] | [[Category:Engineering]] | ||
+ | [[Category:Audio]] | ||
= Notes on Sound and Audio = | = Notes on Sound and Audio = | ||
Line 12: | Line 13: | ||
</pre> | </pre> | ||
− | == Play raw audio == | + | == Play raw audio -- make noise == |
This shows how to play a raw audio byte stream of 44.1 kHz, 16-bit, single channel, unsigned integer. In this example the file, entropy-source.bin, is a binary file of random bytes. Since this is noise it hardly matters how fast the data is played back. | This shows how to play a raw audio byte stream of 44.1 kHz, 16-bit, single channel, unsigned integer. In this example the file, entropy-source.bin, is a binary file of random bytes. Since this is noise it hardly matters how fast the data is played back. | ||
<pre> | <pre> | ||
play -t raw -r 44100 -b 16 -c 1 -e unsigned-integer entropy-source.bin | play -t raw -r 44100 -b 16 -c 1 -e unsigned-integer entropy-source.bin | ||
+ | play -t raw -r 44100 -b 16 -c 1 -e unsigned-integer /dev/urandom | ||
+ | </pre> | ||
+ | |||
+ | This gives playback at a lower sample bitrate and sample bit size, 8 kHz, 8-bit, single channel, unsigned integer. This plays the binary from the '''play''' binary itself. | ||
+ | <pre> | ||
+ | play -t raw -r 8000 -b 8 -c 1 -e unsigned-integer $(type -p play) | ||
</pre> | </pre> |
Latest revision as of 06:21, 20 June 2016
Notes on Sound and Audio
Master volume
This turns off and on the master volume switch in Linux from the command-line. This is useful for scripting.
amixer sset Master off amixer sset Master on
Play raw audio -- make noise
This shows how to play a raw audio byte stream of 44.1 kHz, 16-bit, single channel, unsigned integer. In this example the file, entropy-source.bin, is a binary file of random bytes. Since this is noise it hardly matters how fast the data is played back.
play -t raw -r 44100 -b 16 -c 1 -e unsigned-integer entropy-source.bin play -t raw -r 44100 -b 16 -c 1 -e unsigned-integer /dev/urandom
This gives playback at a lower sample bitrate and sample bit size, 8 kHz, 8-bit, single channel, unsigned integer. This plays the binary from the play binary itself.
play -t raw -r 8000 -b 8 -c 1 -e unsigned-integer $(type -p play)