Audio and music on Unix - Desktop Customization & Workflow
Users browsing this thread: 7 Guest(s)
|
|||
Hello fellow nixers,
In this thread we'll discuss the general topic of audio, music, and audio manipulation on Unix. We'll try to assess its state and share experiences and problems. NB: This was supposed to be a podcast topic but the podcast has been dead for the past 4-5 weeks. #Configuring the audio Configuring the audio on Unix can be difficult depending on what OS and driver you are using. On Linux Alsa and the legacy OSS (open sound system) are available). Both are kernel driven sound card drivers and thus are loaded by your init system or deamon manager. Consequently, everything that can affect the init system might create a problem with the driver. Alsa can be configured via the asound.conf or asoundrc files where you can specify specific sound card configurations. Testing and manipulating the audio for alsa is done with: ``` Code: alsamixer #volume The advantages of using OSS: You'll have a per-application volume control, some legacy cards have better support, it is cross platform (runs on BSDs and Solaris), has a smaller and easier to use API. The advantages of using ALSA: You'll have better support for USB, bluetooth, HD audio devices, and all other funky hardware you can find. Personal note: Sound output from HDMI caused me troubles in the past the solution was a messy script. For more information consult this link. Configuring the sound on BSD variants differs from distro to distro. I won't enter the subject but for example NetBSD has the `audioctl` commands to set audio configurations and FreeBSD the `sysctl` to set the kernel state. #Pulseaudio Pulseaudio is a sound proxy application that gives and interface to the lower layer to other applications. It can detect the devices and automatically configure them (or we hope so). You can control all the lower layers from pulseaudio. It offers a sound equalizer loaded with: Code: $ pactl load-module module-equalizer-sink It has many frontends. #Codecs Quote:A codec is a device or computer program capable of encoding and/or decoding a digital data stream or signal. Media players need to know how to decode the audio to play it. Audio files have multiple formats and codec libraries are there to give those programs a way to understand them. Some said that one of the reasons they won't use a Linux Libre kernel was that it wouldn't support all codecs. It is partially true, libre kernels offers free versions of most codecs. I'm using a Libre kernel and didn't run into any issues related to codecs so far. #PC BEEP If you're a Unix users you're obviously knowledgeable about beeps. A PC beep is a sound, usually used as warning when the ram isn't in place for example, that comes straight from the motherboard and not the speaker (although it depends on the computer manufacturer and the components). The beep can be muted from multiple places, the audio driver (alsa, oss, and others), from the console (TTY), in the X11 environment, in the kernel, and at boot time. On Linux it's loaded via the pcspkr module Code: rmmod pcspkr A cross platform way, but only in X is `xset -b`. There are programs used to play with the frequency of the beep such as the program `beep`. You can find scripts to play music using the motherboard speaker. If you are even more of a beep amateur you've certainly heard of chiptunes. `sidplay2` is a program that emulates the commodore 64 to play music. Quote:Sidplay is SID-chip emulator for playing Commodore 64 music. #Music Player - Music tagging There are ton of music players. You have the choice between curses interface and gui. Choice between those that have a daemon interfaces and others that play the music directly. mplayer, mpd, xmms2, cmus, cplay, deadbeef, amarok, clementine, are common names. - Music files have metadata about authors, album, etc.. Unix has different tools to edit those information, they go by the name of tageditors:
And if you want to add a party ambiance you can use music visualizers, which are programs that us a fast fourier transform to create amazing shapes and forms that move around with the music. If it's not built in your music player you can use ProjectM or VSXu. #Music/Sound Editing - Converting After my research I was surprised that there was so many programs available for sound editing on Unix. I haven't tried them all but I've read good reviews about some. A list of interesting ones:
Or you could go real hardcore like this dude and create music by writing C programs to generate the sound. For spectrum analysis I'd use sonic visualisers. #TTS - Voice recognition(STT) Text to speech and voice recognition is an area that is poor in the Unix community. However, it's not only the Unix community that is lacking support for those. All the softwares that have a "natural feel" are proprietary and costly. They are sold to mobile operators. I've tried my share of them and will only retain one thing: festival is the best text to speech available on Unix even though it's hard to setup and you have to search for voice files on the web. As far as voice recognition goes I've also tried a few but none of them worked correctly and they were all insanely complex to setup. Sphinx is hell to understand. I hope this covers a general topic on audio and music on Unix. Now it's time for you to share your stories and experiences. |
|||
|
|||
I've been using cmus for music, and it works pretty damn well. It's nice and clean looking, along with not being complex to use. Just using ALSA though, because pulseaudio is still a buggy mess like 10 years after it was supposed to replace ALSA...
I just load up podcasts and stuff in mpv instead though, so I don't keep the files around after I listen to them. |
|||
|
|||
Also been using just alsa recently.. I think I will have to install pulse on my crux install however because on of my applications (teamspeak3) grabs the audio output entirely and won't allow any other programs to use the audio device (/dev/dsp). Doesn't seem to be any solution when using pure alsa.
|
|||
|
|||
http://tedfelix.com/linux/linux-midi.html
Great write up venam, thought I should add the link above to this thread, its got a lot of good info on it if a little outdated. Soon I'm gonna be setting up a midi keyboard so I hope that goes well, if I learn anything I'll post it here |
|||
|
|||
Nice breakdown of the options, venam. Gonna have to look into some of the audio editors.
I've been rolling with ALSA (plz kill pulseaudio... as well as systemd and anything else that Poettering touches), mopidy for music daemon, since it supports Spotify, and ncmpcpp + mpc for music control. Recently added sxhkd bindings so that the play button on my keyboard makes mopidy start/stop my starred playlist :) |
|||
|
|||
I keep it simple: ALSA + mpd + mpc. I've no need for other stuff so I haven't dug into other sound options for over a decade.
Github: https://github.com/darthlukan
CRUX Ports: http://ports.brianctomlinson.com GPG: 3694569D "We're all human, act accordingly." -- Me |
|||
|
|||
@venam:
You could also mention ogg123/ogg122/mpg123/mpg321. They are very nice minimal music players, but working perfectly if you are organizing your music in other ways. I also like to use ffmpeg to convert different audio and video formats. |
|||
|
|||
I've been trying hard, but audio still is deep magic to me, eg: .asoundrc. I genuinely think there is no doc abojt it, and that no one except *some* ALSA devs can actually understand how it works (they're the ones posting snippets on forums).
I've never managed to get a fully working microphone by myself, even if I know it can actually be decent (ubuntu proved it!) For the music playing part though, Ive tried many things. mpg123 /ogg123 are nice, but too limited in terms of format. my best choice is sox to play music: Code: $ play rick_ashley-never_gonna_give_you_up.ogg That's really all I need :) |
|||
|
|||
I used sndio a couple times, its not too bad.
Thats all I got to say in regards to audio. |
|||
|
|||
I just use as little ALSA as I can get away with and cmus. I always find configuring it a pain but once it's done it's done.
This reminds me of a problem I unsuccessfully tried to solve once, so I might as well ask here for some discussion. Is there a program that allows me to host my own music server and connect to it from various clients? I know of mpd but it wasn't really what I was looking for (though admittedly I didn't spend ages with it, so maybe there's some config to it), it was a massive pain to get sound coming out of the client machine and not the server, and when listening to songs I just tend to pick what I want as I want it, so being coerced into making a playlist each time was a bit annoying. Basically I just want all my music on one remote machine and a cmus-like interface whenever I need it. |
|||
|
|||
Gonna have to move to pulseaudio sadly... Would prefer a more minimum sound setup but when using teamspeak3 it grabs the entire audio output, or if audio is currently being used, has no sound output at all. Searched heavily but there doesn't seem to be a solution other than using pulseaudio >:|
|
|||
|
|||
Just use mumble instead :)
|
|||
|
|||
@Wildfyr - ALSA requires dmix / software mixing to handle multiple audio streams at once. I'll load up my .asoundrc after work so you can see how I had to set it up (based on info from the Arch Wiki). Hopefully it will help you out.
Github: https://github.com/darthlukan
CRUX Ports: http://ports.brianctomlinson.com GPG: 3694569D "We're all human, act accordingly." -- Me |
|||
|
|||
|
|||
|
|||
Maybe you should git it a go then? There might be a reason people mention it so often
|
|||
|
|||
The problem is that all my windows friends use teamspeak only and I've found getting people (especially non tech people) to use teamspeak is loads easier than getting them to use mumble.
|
|||
|
|||
Here's an answer to a question I've always wondered about:
Quote:Some audio output from files or streams is too low. It is obvious that hardware is able to play the same sounds but louder but because of the data it just plays it at some low level even at 100% volume. Vlc can generally increase the volume of a file up to 200%. Is there a way to do the same thing VLC does system-wide and if possible for an arbitrary v percentage value.http://superuser.com/questions/146784/so...e-on-linux |
|||
|
|||
I wonder if such a thing is possible without pulseaudio
|
|||
|
|||
If you have any stories with issues concerning the audio on Unix please bump this thread with it.
Gathering a source of horror posts can be fun. |
|||
|
|||
In NetBSD I was using default sound 'OSS' with mpg123/sox for cli and and cmus for a curses interface. I should add that worked out of the box with my hardware on 3 different machines.
Today decided to tackle mpd + mpc (after catching a glimpse of a character who lurks in the shadows carrying sharp pointed metal objects) Well mpd didn't work out of the box so I RTFM. Read the conf for maybe a clue to what was missing or which option was specific to my machine. A clue was given so off to see what the format of the device line. The NetBSD wiki had one reference to pulse-audio and mpd ugh. Oh the games we play the tests we take, long story short pieced together the answer from a few sources. Code: audio_output { And we are off and running. |
|||
|
|||
Here's my new audio horror story on Unix.
I bought a usb headset (headphone+microphone) yesterday. I plug it in and it doesn't magically work so I dive into documentation and online posts. Pavucontrol popped up, it is an application that let you interface with pulseaudio. It didn't work on my Arch machine and I decided to give it a try on my Debian box. It worked flawlessly. After doing a diff of the pulse configuration files I found my issue, that's what worked for me: Code: http://pub.iotek.org/p/vEOlSe3 But there was still an issue I couldn't hear any sound as a normal user. I was firing mplayer to test the audio and after hours of debugging the .mplayer/config had this faulty line: Code: ao=alsa Next on the list: MPD wasn't using my pulse configuration. As "I discovered in the manual", mpd lauches it's own instance of pulse when started as a global daemon and thus I had to switch from a global to a local setting. Done... Still no sound. I rechecked my .mpdconfig over and over again trying weird things that made no sense to finally find my issue: Code: audio_output { I had those lines for the audio output. The first one being for the "artsy" in ncmpcpp and second for my pulse output. However I didn't know that pulse had to listen on a TCP port to be usable from MPD localhost; the "server 127.0.0.1" in the above config. Adding this line to /etc/pulse/default.pa made everything finally work. Code: load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1 |
|||
|
|||
I feel your pain venam :(
PavuControl is such crap - it adds confusion for no good reason. Every time I change my audio setup in the slightest, it's bound to screw it up and I'll waste an afternoon fixing it. For instance, I recently bought a Schiit Fulla DAC, but when I plugged it in, no sound was sent through it. After opening pavucontrol, and fiddling around, I got it set up. However, when I went to play CS:GO, pavu decided that my mic should be the output of the DAC, so it just loopbacked (all because I forgot to set my mic as the default fallback). I don't know how it can be fixed, but linux's audio system is crap right now. ALSA is usable for the most part, but most things require pulseaudio at this point, which inevitably means one will block the other somehow. |
|||
|
|||
In the meantime, I have an audio anti-horror story.
When I installed Void and CRUX (on Arch I used Pulse, which kinda "just werked"), I had to spend a while configuring them in both environments for some reason. It took me a while to get the perfect `~/.asoundrc`. I installed OpenBSD on March 31, and to get audio working, I literally just had to `mixerctl -t outputs.master.mute` and it just worked. IIRC sndio can also be used on Linux if need be. |
|||
|
|||
The perfect .asoundrc
Code: defaults.pcm.rate_converter "speexrate_best" Good quality sound AND it works with firefox without pulse. |
|||
|
|||
(03-04-2016, 07:20 PM)arcetera Wrote: I installed OpenBSD on March 31, and to get audio working, I literally just had to `mixerctl -t outputs.master.mute` and it just worked. IIRC sndio can also be used on Linux if need be. Wow! If it's really that good I'll have to check OpenBSD out. I've been kinda reticent to install it since I've heard the hardware support is a few years behind linux (and I'm worried about wireless and graphics). Do you happen to know what the nvidia drivers are like? |
|||
|
|||
(04-04-2016, 11:03 AM)ninjacharlie Wrote:(03-04-2016, 07:20 PM)arcetera Wrote: I installed OpenBSD on March 31, and to get audio working, I literally just had to `mixerctl -t outputs.master.mute` and it just worked. IIRC sndio can also be used on Linux if need be. There are no nvidia drivers, period. Nvidia doesn't give enough info to do much. Nouveau exists, but it's heavily Linux-only, and doesn't work (obviously). |
|||
|
|||
(04-04-2016, 11:50 AM)arcetera Wrote:(04-04-2016, 11:03 AM)ninjacharlie Wrote:(03-04-2016, 07:20 PM)arcetera Wrote: I installed OpenBSD on March 31, and to get audio working, I literally just had to `mixerctl -t outputs.master.mute` and it just worked. IIRC sndio can also be used on Linux if need be. can't they just study nouveau's code? |
|||
|
|||
I would imagine that would prove pretty difficult, as nouveau is a reverse engineering of proprietary Linux drivers[1]. I don't think it would be a very trivial effort and there would need to be a large enough nvidia-using openBSD userbase who were both competent and cared for such a thing.
https://en.wikipedia.org/wiki/Nouveau_(s...chitecture Googling a bit led me to a thread and an article (under openBSD heading) https://lwn.net/Articles/616097/ http://openbsd-archive.7691.n7.nabble.co...35541.html |
|||
|
|||
How about we revive this one.
Lately I've been looking for a way to play local music files. Previously I've used many of the solutions mentioned earlier in this thread (mpd+mpc etc) however I am interested in what you are all using these days? Ever since spotify arrived I've been subscribed to that and thanks to the curses based spotify client ncspot I've had no need to store music on my hdd. I've just begun growing a local music library again and am somewhat disatisfied with the long list of options available. I dont want mpd on my system anymore. I dont think I need it. I don't even really need a full fledged client. What I really wan't is to be able to play music files with mpv/mpg123/sox/whatever, using a shell script. Something I can pipe through fzf would be sweet, with the ability to select multiple files perhaps in order to create playlists. For example, I use a pure sh terminal file manager called shfm (similar to nnn or fff). This was written by Dylan who also wrote fff, although the fork I'm using has also implemented core utils for cp/mv'ing files etc. Ideally I'd just hack shfm to be able to play multiple selected files using whatever player I want, but I think a simple script should do the trick. Me being fairly sh illiterate (when it comes to writing scripts at least) means I find it hard to put this together. I wonder if something this minimal already exists. If so, I haven't found it yet. But I digress. What do you guys use these days? |
|||
|
|||
What I personally use is still a combination of mpd and client interfaces such as ncmpcpp. I like the whole architecture of having a server manage the music library and be able to interact with it from different places.
I think it would also fit your scenario if you used the command line tool `mpc`. EDIT: you can also refer to this thread for setup (not player): https://nixers.net/Thread-Your-Audio-Setup |
|||