Hacker News new | past | comments | ask | show | jobs | submit login
Play (1) Linux manual page (die.net)
39 points by brudgers on June 11, 2023 | hide | past | favorite | 29 comments



It isn't the same command, but here's a fun party trick.

echo "main(i){for(i=0;;i++)putchar(((i*i>>8&46&i>>8))^i&i>>13);}" | gcc -x c - && ./a.out | aplay


Haven't heard this one.

Do you have a name or source or something? Can't really google that.


I've seen these floating around on YouTube, so you might have some luck searching there (be aware of your volume settings when playing these!)

- https://youtu.be/L9KLnN0GczI

- https://youtu.be/GtQdIYUtAHg

And a longer write-up on the background from the second video:

- http://countercomplex.blogspot.com/2011/10/some-deep-analysi...

- http://countercomplex.blogspot.com/2011/10/algorithmic-symph...

- https://youtu.be/pFgui9uGmr4



Search for bytebeat.


  10 FOR X = 1 TO 255
  20 SOUND X,1
  30 NEXT X
When I fire up a TRS-80 Color Computer emulator, this is always the first thing I type.


Some background spaceship engine noise with it:

    play -c2 -n synth whitenoise band -n 100 24 band -n 300 100 gain +20


Woah this works in Termux!


here, title readers

> SoX - Sound eXchange, the Swiss Army knife of audio manipulation

> SoX reads and writes audio files in most popular formats and can optionally apply effects to them; it can combine multiple input sources, synthesise audio, and, on many systems, act as a general purpose audio player or a multi-track audio recorder. It also has limited ability to split the input in to multiple output files.

> Almost all SoX functionality is available using just the sox command, however, to simplify playing and recording audio, if SoX is invoked as play the output file is automatically set to be the default sound device and if invoked as rec the default sound device is used as an input source. Additionally, the soxi(1) command provides a convenient way to just query audio file header information.


linux.die.net man pages are horribly outdated.

Official docs: https://sox.sourceforge.net/sox.html


Yes; I always link to <https://manpages.debian.org/> instead.


Really? If so that is shocking.

Many people consider linux.die.net as the single reliable source of online manpages, so you would automatically assume they would keep the manpages updated with the software releases...


Yes, but it's hard to notice because they don't preserve the last line that normally contains version information.

Some evidence:

https://linux.die.net/man/1/rsync says "This man page is current for version 3.0.6 of rsync", released in 2009; rsync 3.0.7 was released later that year.

https://linux.die.net/man/1/perldelta is for Perl v5.10.1, released in 2009; Perl v5.12 was released in 2010.

https://linux.die.net/man/8/badblocks doesn't document the -B option, which was added in E2fsprogs 1.42, released in 2011.

https://linux.die.net/man/1/pv says "Frequent use of this third form is not recommended as it may cause the programmer to overheat". But this joke was removed in pv 1.4.0, released in 2012.

https://linux.die.net/man/1/play says "Copyright 1998-2008 Chris Bagwell and SoX Contributors". The copyright years were updated in sox 14.4.1, released in 2013.


And?


A web application framework for Java/Scala: https://www.playframework.com/


There’s very little reason to call something like this directly nowadays. Usually, applications should use something like xdg-open(1) or see(1) (as an alias to run-mailcap(1)) to open and play arbitrary files. For internal playing of sounds, I would suggest some multimedia framework.


[flagged]


I draw your attention to the fact that the other command I mentioned, see(1), will actually in turn call play(1) (at least on my system). You probably want your programs to call see(1) and not play(1) directly, as this gives the user more control over the commands run. This is why I said that calling play(1) explicitly and directly from a program is probably the wrong thing to do.


you seem to be oblivious to the fact that "play" can do more than play audio.


The sox(1) and rec(1) commands can do a lot more, yes. But we were talking about play(1), which exclusively does playback, with optional added effects. And for straight playback of audio data, your program probably should not call play(1) directly.


> optional added effects

Right. so why are you pretending that this feature doesn't exist, or is not consequential? playback alone is not the same thing as playback with effects.

> for straight playback of audio data

who said that is the use case here? the original link is just to the man page itself. YOU DECIDED, that the only use case is straight playback with nothing else. that might apply TO YOU, but others might be keen on utilizing the other features, hence why they were added in the first place.


Optional added effects are of minor consequence in a command mostly meant for audio playback (as evidenced by its name; “play”). I also did not completely deny the outlier use cases, which is why I wrote “very little reason” instead of “no reason”.

You are being unnecessarily combative.


> Optional added effects are of minor consequence

you seem to have an inability to use the phrase "to me". you dont dictate the patterns or usage of the population, only yourself.


The point he's making is that having something that just dumps an audio file to the sound output isn't usually what you want anymore. Now you expect to have audio controls and a UI, as compared to when I would cat smellsliketeenspirit.au > /dev/audio

> this is a pretty ignorant comment.

You're free to disagree, but don't do it this way.


This is a weird take. The command is obviously useful in the context it's useful in. To point out that it's less useful outside that context is not very meaningful.

It's like saying ls is the wrong command, because "what you want is a full file manager, with thumbnails and drag and drop and whatnot". Well, if that's what you want, you're obviously in a different context than the one you're in when you're reading the man page of ls, no?


Command line is a type of _UI_, sometimes better than other types of UX. And the audio controls are part of the command's arguments.


> just dumps an audio file to the sound output

did you even read the linked page? thats not all this can do by a long shot.


Dude, I'm pretty familiar with sox/play. I first used it 30 years ago.

99% of the time you really did just use it to play a file, but sure, it was nice to trim and equalize and concatenate things occasionally.


I use it to synthesize sounds in shell scripts.


sox has a lot of functionality besides playing an audio file.

Like synthesizers to generate audio, filters and so on.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: