Alsa resampling

Alsa resampling

Alsa resampling
So I have been listening to a bunch of hokum and voodoo at some other head hifi forum where abx testing is banned and I need some reeducation. I run linux at home and I use kde. As I understand little about sound and how all the parts of the linux sound system work together, I would like to help to make sure that my sound is being output in the best fidelity possible. I use amarok and deadbeef to play my music. I just want to make sure that I am not doing any resampling that will introduce any distortion or noise. Sorry if this a topic that has been answered numerous times, but I searched and couldn't find anything that helped answer this. Thanks for the input. Wow, lots of viewers, but few posters, I'll take that as a gentle indication that I am asking a stupid or confusing question. Am I mistaken that upsampling causes unwelcome and audible distortion and other undesirable effects? Does anyone know what the ALSA and Pulseaudio defaults with respect to bit depth and sample rate are? I haven't touched either configuration since a vanilla install. I am really concerned about ALSA or Pulseaudio deciding to upsample my music as I am led to believe that such upsampling is undesirable if avoidable. Any help is appreciated. At best, you can stop using Pulse Audio i. If you choose to use Pulse Audio or ALSA's dmixer, or jackd or whatever and thus have to resort to resampling defaults to 48kHz IIRC, but don't quote me on thatyou can set the quality of the resampling algorithm to something that doesn't suck i. Hey thanks, that's perfect. I think you are correct concerning the 48kHz default by the way, I seem to recall reading this somewhere as well. Thanks for the help! Last Edit : by db Quote from: chickpea23 on Quote from: Richard Kimber on Quote from: Kohlrabi on Quote from: YellowOnion on Code: [Select]. You can't have software mixing without resampling, unless every software uses the same sampling rate which they don't : a music player will output at There's no way around that. If you're gonna use PulseAudio, there will be resampling, by design. With ALSA and presumably with PulseAudio you can set the quality of the resampling, though, to something that doesn't suck. I know this is an old thread, but for people searching for information on configuring their linux boxes for best sound quality, this is the first thread to pop up. Anyway, I'd like to give another shoutout for deadbeef as an audio player. By default most linux distributions ship with alsa and pulse audio set up to do mixing, and if you really want to mess with config files, see the above posts, or have a look at this wiki. This all assumes you'd be uninstalling pulse audio, which is kind of a hassle, may break stuff, and you lose the features of pulse. However, for me, the simplest, most elegant solution was to simply install deadbeef and change the output plugin to ALSA, the output device to my "direct hardware device without any conversions", remove the resampling DSP, and configure the ALSA output plugin to uncheck "use ALSA resampling". That way, when I want to listen to quality music, I can do so uninterrupted by system sounds or singing webpages, because deadbeef monopolizes your sound device. Then, when I want to listen to youtube or whatever, I still get the benefits of software mixing while not caring about the quality because, uh, it's youtube.

Alsa equalizer

Alsa resampling
Links : forums. Copyright Gentoo Foundation, Inc. Hosting by Gossamer Threads Inc. Quick Search :. ALSA resampling everything to 48kHz. View unanswered posts View posts from last 24 hours. Gentoo Forums Forum Index Multimedia. View previous topic :: View next topic. I'm guessing that ALSA is favouring dmix here, and that's what causing the problem. Back to top. Hm, are you willing to experiment? Wallsandfences Guru Joined: 29 Mar Posts: I'd try to explicitly route the aplay output to hw 0,0this way, dmix is ruled out. Not at my box at the moment, man pages should guide you to the correct syntax. Documentation for ALSA can certainly be quite unclear but outputting directly to hw:2,0 should have bypassed dmix and allowed the application to choose the sample rate Dmix only runs a single rate and format, usually and S16 for standard devices, but you can force the rate and format in dmix with something like the following mine just sets the dmix rate to ; Code:. Thanks for posting your ALSA configuration. However, I obviously then lose any type of mixing so I'm limited to one stream at a time. So, it's a toss-up on what's better. I personally could barely hear a difference especially at the relatively low volume at which I typically listenso I think that just leaving it with the default mixer might be the way to go for my needs. NathanZachary wrote:. Does your USB card really go up that high? Most that I've seen cap out at 96K. EDIT: nevermind, just read your link, wow, it seems that one goes to K! Ant P. Watchman Joined: 18 Apr Posts: I also note it doesn't seem to work with common programs and resamples in software anyway Alsa by default sets sample rate to 48K. You need to modify. More bad news. Firefox and Chrome dont like anything above 48K in sample rate and refuse to work. There is nothing we can do about it, as Firefox officially dropped support for alsa and only support hated pulseaudio. So only ugly workaround - to switch off browser if if you want to use above 48k sample rate. All times are GMT.

Alsa multi

By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I have a text-to-speech application, that generate an audio-stream raw-data with a samplerate of 22kHz. With my asound. My Application use the alsa-libs and set the samplerate of the device. In this case only 44kHz will succeed, because the hardware supports only this samplerate. But now, when i write the generated audio-stream to alsa, it sounds wrong, because the samplerates dosn't match. The audio-stream raw-data dosn't contain any header information, so I think alsa don't use any plugin zu convert the samplerate. Alsa don't know that the stream has a different samplerate. My question is now, what is the right way to tell alsa, that the generated audio-stream have a different samplerate, so the alsa-plugin convert it. Other way are, I manuelly convert the sample rate, before i put it to alsa, but i think: why not use the alsa-plugin. Learn more. Asked 5 years ago. Active 5 years ago. Viewed 2k times. Alsa don't know that the stream has a different samplerate My question is now, what is the right way to tell alsa, that the generated audio-stream have a different samplerate, so the alsa-plugin convert it. I don't have the option to get 44kHz audio-stream from the tts-engine it's another software. Or exist another way, that I don't see? Best regards. Some programmer dude k 29 29 gold badges silver badges bronze badges. Angelo Angelo 21 3 3 bronze badges. What did you do to your asound. Apr 2 '15 at In theory, the plug plugin does automatic resampling.

Alsa list devices

The buffer and period sizes for the sound card between the sound card hardware and the ALSA resampler are limited to the max buffer and period sizes available on the hardware. As a result, the available buffer and period sizes vary depending on hardware utilised. The resampler converts one hardware period size at a time. This results in the buffer and period size constraints explained in 1 arriving at the application as a direct ratio of source and destination sample rate. This is rounded down to frames. So the user application sees 2 periods of frames. If user space asks for 2 periods of at hz it will fail. The alsa-lib software resampler is only used if possible hardware sample rates! It is possible to detect if the resampler will be used at the requested sampling rate. While opening the ALSA device, use the function:. This will result in the application only being able to open the sound card at the sample rates that the sound card can do in hardware. So, taking rule 3 above, the alsa-lib software resampler will therefore never be used. Original created on by User:JamesCourtierDutton. Jump to: navigationsearch. Categories : Development MigratedFromDev. Namespaces Page Discussion. Views Read View source View history.

Alsa sample rate

Alsa resampling
Besides the sound device drivers, ALSA also bundles a user space driven library for application developers. This enables direct kernel interaction with sound devices through ALSA libraries. However, your sound may be initially muted. If it is, see Unmuting the channels. To allow remote users to use ALSA, you need to add those users to the audio group, however this is not recommended by default see note below. Install the alsa-utils package. This contains among other utilities the alsamixer and amixer utilities. This emulation layer is useful e. If you want OSS applications to work with dmixinstall the alsa-oss package as well. Then load the snd-seq-osssnd-pcm-oss and snd-mixer-oss kernel modules to enable OSS emulation. The alsa-utils package comes with systemd unit configuration files alsa-restore. These are automatically installed and activated during installation via package provided symlink to sound. Neither will run by default, as they rely on some conscious decisions by the user to know which method should be preferred. The options are as follows:. Both methods are mutually exclusive and you can decide for one of the two approaches depending on your requirements, for further information see alsactl 1. The alsa-firmware package contains firmware that may be required for certain sound cards e. Creative SB Audigy2. The MM label below a channel indicates that the channel is muted, and 00 indicates that it is open. The gain can be found in the upper left next to the Item: field. To get full 5. Those are channel names with Intel HD Audio, they may vary with different hardware. To enable your microphone, switch to the Capture tab with F4 and enable a channel with Space. If audio is being outputted to the wrong device, try manually specifying it with the argument -D. ALSA configuration files follow a simple syntax consisting of hierarchical value to parameter key assignments. Below are modified excerpts from asoundrc. Assignments define a value of a given key. There are different assignment types and styles available. Separators are used to indicate the start and end of an assignment, but using commas or whitespace is also possible. For easier reading, it is recommended to use first style for definitions including more than three keys. Everything depends on user preferences when it comes to different styles of configuration, however one should avoid mixing different styles. Further information on basic configuration can be found here.

Alsa dmix

At the moment it seems that most of my programs that output sound mpd, smplayer, vlc, aplay, etc. For example, the following is playing a However if I add the -Dhw:0,0 to aplay, alsa sends Dmix resamples audio to Hz by default afaik can be changed. If it supports hardware mixing you should use that instead of dmix. Can you post the output of aplay -l? Basically, if nothing is specified, dmix is activated, if hw:0,0 is used, the sound is sent directly to the hardware mixing wont work, but if you have several subchannels, you can utilize real hardware mixing. I've just discovered that if I add the following to my mpd. The important bit I think is the device line, because it uses hw to bypass the plughw devices? This should work for the pure sound. However, with this, only one app can play sound at a time. Which most often is just fine. I literally just found that near exact same fix as you posted it! I'm not sure whether the device line is required, as you say there are no additional subdevices, but I find it easier to think of it as 0,0 so I'll keep it that way. Which works an absolute treat! Atom topic feed. Arch Linux. Index Rules Search Register Login. You are not logged in. Topics: Active Unanswered. Basically, if nothing is specified, dmix is activated, if hw:0,0 is used, the sound is sent directly to the hardware mixing wont work, but if you have several subchannels, you can utilize real hardware mixing Last edited by Themaister This should work for the pure sound pcm.! Which most often is just fine Last edited by Themaister Pages: 1. Atom topic feed Powered by FluxBB.

Alsa linux

Follow SoundProgrammin. You will also need to have libasound2 and libasound2-dev installed. ALSA requires the the asoundlib. In a nutshell, we open the sound device, create a structure to hold the parameters we want to use, and then tell the sound device to use those settings. If successful, we then prepare the sound device for use. For the first example, we are using a global variable to keep track of our sound device. Globals are generally a bad idea, but in this case it keeps the example simple. One of the parameters is the sound device, into which we will pass "plughw:0,0", the default sound device, and a constant that tells the device we want to use it for playback. We check for errors throughout the code. Next we allocate memory for the hardware parameter struct. Here we set our sample format to PCM bit little-endian. If you are not using a little-endian i. Intel or AMD machine you will want to use a different setting. The code for this tutorial only initializes and then de-initializes the sound device. That isn't much, but it's a start. In the second tutorial we'll actually hear something come from the speakers. Linking requires the asound library. To link the file, we add -lasound to the linker flags. If everything goes as planned, the application should display the following messages, or something similar:. Audio device opened successfully. Audio device parameters have been set successfully. Audio device has been uninitialized. Here is the actual code used. Note that we have done everything in a single file, alsatut1.

Alsa disable resampling

By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. The dark mode beta is finally here. Change your preferences any time. Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. I have a text-to-speech application, that generate an audio-stream raw-data with a samplerate of 22kHz. With my asound. My Application use the alsa-libs and set the samplerate of the device. In this case only 44kHz will succeed, because the hardware supports only this samplerate. But now, when i write the generated audio-stream to alsa, it sounds wrong, because the samplerates dosn't match. The audio-stream raw-data dosn't contain any header information, so I think alsa don't use any plugin zu convert the samplerate. Alsa don't know that the stream has a different samplerate. My question is now, what is the right way to tell alsa, that the generated audio-stream have a different samplerate, so the alsa-plugin convert it. Other way are, I manuelly convert the sample rate, before i put it to alsa, but i think: why not use the alsa-plugin. Learn more. Asked 5 years ago. Active 5 years ago. Viewed 2k times. Alsa don't know that the stream has a different samplerate My question is now, what is the right way to tell alsa, that the generated audio-stream have a different samplerate, so the alsa-plugin convert it. I don't have the option to get 44kHz audio-stream from the tts-engine it's another software. Or exist another way, that I don't see? Best regards. Some programmer dude k 29 29 gold badges silver badges bronze badges. Angelo Angelo 21 3 3 bronze badges. What did you do to your asound. Apr 2 '15 at In theory, the plug plugin does automatic resampling. I see no reason why that code wouldn't work. Can you try to add defaults. Active Oldest Votes. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Cryptocurrency-Based Life Forms. Q2 Community Roadmap. Featured on Meta.

Alsa file plugin

Alsa resampling
By using our site, you acknowledge that you have read and understand our Cookie PolicyPrivacy Policyand our Terms of Service. It only takes a minute to sign up. My setup is Vortexbox 2. I have set up separate stereo devices in asound. Because their is only one clock for all players the audio needs to all be at the same sample rate. Most of my music is I have got this working through asound. However is seems ALSA is resampling everything to I'd like the native The plug plugin inserts a rate plugin only when needed, but when you insert a rate plugin manually, that is what you get. For the resampling algorithm, you can rely on the default setting. Sign up to join this community. The best answers are voted up and rise to the top. Home Questions Tags Users Unanswered. Alsa resampling Ask Question. Asked 5 years, 5 months ago. Active 5 years, 5 months ago. Viewed 2k times. Is there a way of making ALSA only resample when the rate doesn't match? Place your global alsa-lib configuration here Could use rate unchanged but not for here. Simon Simon 31 2 2 bronze badges. Active Oldest Votes. Sign up or log in Sign up using Google. Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Podcast Cryptocurrency-Based Life Forms. Q2 Community Roadmap. Featured on Meta. Linux Tutorial: Control Your ALSA Audio From The Terminal

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *