commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
sox (SOund eXchange) can capture the system audio be it a browser playing youtube or from hardware mic and can pipe it to ffmpeg which encodes it into flv and send it over rtmp.
Tested using Red5 rtmp server.
I wasted two hours reading the sox documentation and searching on the web for the format of some obscure fscking sound sample, and then finally came up with this. This plays only the first three seconds of your unknown formatted sound file using every one of sox's built-in filetypes. If you don't get an exact match, you may get close.
I could not fit every single type in and keep it under 127 characters, so you will have to replace "..." with the full list obtainable by `$ sox --help` (or try `Show sample output`)
note: /usr/bin/play should be linked to sox on most systems.
This generates some powerful but relatively unobtrusive waterfall-like noise. Good if you need to get serious stuff done while your next-door neighbor is throwing a very loud party.
You need the sox package installed.
fade [type] fade-in-length [stop-time [fade-out-length]]
Apply a fade effect to the beginning, end, or both of the audio.
An optional type can be specified to select the shape of the fade curve: q for quarter of a sine wave, h for
half a sine wave, t for linear (`triangular') slope, l for logarithmic, and p for inverted parabola. The
default is logarithmic.
A fade-in starts from the first sample and ramps the signal level from 0 to full volume over fade-in-length sec?
onds. Specify 0 seconds if no fade-in is wanted.
For fade-outs, the audio will be truncated at stop-time and the signal level will be ramped from full volume
down to 0 starting at fade-out-length seconds before the stop-time. If fade-out-length is not specified, it
defaults to the same value as fade-in-length. No fade-out is performed if stop-time is not specified. If the
file length can be determined from the input file header and length-changing effects are not in effect, then 0
may be specified for stop-time to indicate the usual case of a fade-out that ends at the end of the input audio
All times can be specified in either periods of time or sample counts. To specify time periods use the format
hh:mm:ss.frac format. To specify using sample counts, specify the number of samples and append the letter `s'
to the sample count (for example `8000s').
You'll need to install sox and flac packages in Debian/Ubuntu.
Substitute 'brown' with 'pink' or 'white' according to your taste.
I put this on my headphones when I'm working in an "open concept" office, where there are always three to five conversations going in earshot, or if I'm working somewhere it is "rude" of me to tell a person to turn off their cubicle radio.
This heavy one liner gets all the files in the "/music/dir/" directory and filters for non 44.1 mp3 files. After doing this it passes the names to sox in-order to re-sample those files. The original files are left just in case.
This will allow you to convert an audio file to wav format, and send it via ssh to a player on the other computer, which will open and play it there. Of course, substitute your information for the sound file and remote address
You do not have to use paplay on the remote end, as it is a PulseAudio thing. If the remote end uses ALSA, you should use aplay instead. If it uses OSS, you should berate them about having a lousy sound system. Also, you're not limited to transmitting encoded as wav either, it's just that AFAIK, most systems don't come with mp3 codecs, but will play wav files fine.
If you know SoX is installed on the remote end and has mp3 codecs, you can use the following instead:
cat Klaxon.mp3 |ssh firstname.lastname@example.org play -t mp3 -
this will transmit as mp3. Again, use your specific information. if you're not playing mp3s, use another type with the -t option
That way, you can make a mix on the fly with the mp3 files in the current directory to make a bunch mp3 file.
This command, taken from play's manual page, plays a synthesized guitar tone for each of the strings on a standard tuned guitar.
The command "play" is a part of the package "sox".
This command creates and burns a gapless audio CD with 99 tracks. Each track is a 30 second sine wave, the first is 1 Hz, the second 2 Hz, and so on, up to 99 Hz. This is useful for testing audio systems (how low can your bass go?) and for creating the constant vibrations needed to make non-Newtonian fluids (like cornstarch and water) crawl around.
Note, this temporarily creates 500MB of .cdda files in the current directory. If you don't use the "rm" at the end of the command, you can burn more disks using
cdrdao write cdrdao.toc
Prerequisites: a blank CD-R in /dev/cdrw, sox (http://sox.sourceforge.net/), and cdrdao (http://cdrdao.sourceforge.net/). I'm also assuming a recent version of bash for the brace expansion (which just looks nicer than using seq(1), but isn't necessary).