📜 ⬆️ ⬇️

Setting up e-mu 0204 usb in ubuntu GNU / linux

A couple of days ago I bought myself an external sound card e-mu 0204. I bought it from my hands, for 2 tr. The owner was happy, I am the same. Both thought they were cheating each other. There is a piece of iron in the store 4.5 tr. Brought home he knocked out, the sound is fabulous. But, the jamb was found. At unpredictable times, quiet clicks and interruptions of sound were heard. I have great ATH-SJ55 headphones. Corresponding to the card level, it is not clear why it suddenly began. Understand how to fix. Yes, I will immediately note that all these problems are described in the instructions !!! So all the op around the card says only that the screaming just did not open it. I did not have instructions in the kit, I later found it on the Internet. All settings in the article will still be needed.

Of course, I heard about the problems with the card and tried to use the method of playing a sound file with silence described in a bunch of places to occupy the channel and it seems like the clicks should disappear as “the card will no longer go into power saving mode”. What I just did not read, even the fact that she does not have enough power and need to buy an external usb hub with a separate power supply. All this did not help (the hub did not try, and in the later read instructions they are directly contraindicated).
Crawled into the settings pulseaudio. In the piece of iron there is a hardware buffer where data is put after digitization. The computer's sound system needs to put sound into it, in general, the sound of the computer is communicating through it and the computer so that the sound is not interrupted (there it must be looked at).
If the settings for working with the buffer are incorrectly configured on the computer, there will be clicks. This I found out by picking the settings and reading the forums with the calculation of the values ​​of these parameters. The second of the options described here, the settings may be suitable for Windows, since there is an assembly jackd for it, it seems. Although in Windows you can probably set up another way. On Linux, everything is easier. First, add yourself to the audio group:
usermod -a -G audio theusername 

It is necessary to add the user theusername to the audio group, because without it the server jackd and pulsaudio will not be able to allocate memory and start in real time if configured with it. Further settings may vary.

Option one, simple:



I broke my head before I managed to set it all up in Linux and generally understand what was going on, at first I started to get upset. By the way, first, try to choose a simpler resampler and nothing else. All the problems with artifacts in the sound rest against the performance of the computer and have absolutely nothing to do with sound. The easiest way to make it so that the computer would be able to generate the sound is to change the resampler to a simpler one. Although, what did it cost the manufacturer to include the instruction manual? Maybe it was, I took the interface from my hands. Those who want to configure, look in /etc/pulse/daemon.conf
 #       audio  .       ,  #,    . realtime-scheduling = yes #     realtime-priority = 10 #  ,     allow-exit = no exit-idle-time = -1 #       ,   ,   i7  ,   ,     #    src-sinc-best-quality              #    ! resample-method = src-sinc-medium-quality #    default-sample-format = s24le #     ,                #    default-sample-rate = 192000 alternate-sample-rate = 192000 #           ,      ,     (    ,  ) ;default-fragments = 4 ;default-fragment-size-msec = 3 

')
You may also need to go to: /etc/pulse/default.pa
And put there:
 load-module module-udev-detect use_ucm=0 tsched=0 

instead
 load-module module-udev-detect use_ucm=0 

After installing a simpler resampler method, I didn't need these settings. At first, it is worth trying without this parameter, since it will most likely work without it, but without it, the processor load even on the best resampler will be low. Actually low load on the processor and this option is good overall settings. Together with tsched = 0, everything works more stable, and it should be understood that with this parameter the load on the processor from pulseaudio will increase. This, by the way, will kill all the advantages of the pulses over the alsa, but it is too lazy to tune my alsu, and the clicks without pulses are the same.

The clicks will remain only at the start of the computer (when the card is turned on), small, and even when the next client is connected to the sound server. I will not describe here the pulseaudio setting for a weak computer, the point is that the resampler needs to be simpler set and the priority of pulseaudio raised. It should be noted that this method of tuning is highly dependent on the performance of the computer. If your frequency is floating on the processor (ondemand scheduler), sometimes there may be a lack of performance and there will be artifacts in the sound. There is a more interesting way to configure, according to my observations, it is much more stable and better.

Option two, kosher:


In /etc/pulse/daemon.conf
 #           resample-method = src-sinc-best-quality default-sample-format = s24le #     ,                #     default-sample-rate = 192000 alternate-sample-rate = 192000 

The rest is the default. Even tsched = 0 do not set! Skype users for whom he wheezes at the start, I think the same solution will do. The problem with skype is that the sampling rate of the file, which it loses at the start, does not coincide with the frequency of the resampler, and there are wheezing on many cards. Our card pretends to be an initial professional level, so it’s generally logical that it is designed for professional software. In general, we go further.
Put jackd, configure the number of samples in the buffer 1024 and the number of periods on buffer 2 (you can twist other variants of these values ​​if it clicks, since the buffer is adjusted depending on the specific computer and its capabilities). The minimum number of samples is 128 for this map, and the number of periods per buffer 2 can be experimented with.
Depending on whether you run jackd in real time or not, the buffer may be different. In fact, these are the same buffer parameters as in pulseaudio, only in their original form, and not calculated. It is possible to focus on fidelity on messages about desynchronization, they need to be 0, although in real time it is impossible to orient at all on this, and so not very reliable indicator, it remains just by ear. You can find this in the qjackctl in the message window, the status tab, you need to set it as well, these numbers are also in the status window in the main panel.
Also pay attention to the launch mode jackd, in real time or not, it is worth trying both and see how the sound will behave under the load of the computer. If you set the real-time mode, do not forget to set the same real-time mode for pulseaudio (in the same daemon.conf):
 realtime-scheduling = yes realtime-priority = 5 

Only priority pulses should be less than the jackd. By default, jackd starts up with a priority of 10.
In general, the settings window looks like this for me:
image
Pay attention to the “Time out” option, if small artifacts irritate you when you re-connect clients (for example, if there was no sound for a long time, and then you turned on the music), then you can set the time while jackd will hold the channel. For example, a minute. This will lead to constant CPU usage, but it will have the same effect as playing a file with silence. But, this is if the artifacts remain at all after the adjustment. I compared, the built-in card on my laptop works in the same way, a little twitching when switching melodies in the player, which is quite logical, so just heard a sharp cessation of sound or the beginning of a new one not from zero volume (without fade in / out). So do not make incredible demands where it is not necessary.
Then you force pulseaudio to output sound through jackd, by adding a command that is executed after starting jackd.
Team
 pacmd set-default-sink jack_out 
This is the same in the qjackctl parameters set. Now pulsaudio works as a mixer and outputs the result to jackd, which directly pours sound into the alsa driver and through it into a piece of iron.
In the end, I just took qjackctl and set it to autoload, setting all parameters in it. Unlike pulseaudio, the parameters for working with the buffer are clear and do not require calculations, as well as obviously affect the operation.

The clicks will disappear, the sound will be clear, silky. And always, in any case, I have not heard any more clicks under load, anywhere, even when playing several sound sources from different places and connecting different clients to sound.

UPD №1: I also twisted the latency of I / O, but did not get any sensible results, besides this I indicated specifically that two output channels are needed. I did not go into detail, as if the latency I / O set some accounting for the delays inside the sound engineer itself, it is possible to drive much larger values ​​into it. But, this is just picking the settings out of curiosity. It turned out that good sound and headphones have their flaws, I now hear even very small shoals in the sound, and the sound paranoia earned during the day of the proceedings with the settings leads to the fact that it is not clear whether this is in the original recording of the joint, or Does the buffer tweak. Although the sound quality is superb all the time.

UPD â„–2: I found an excellent review of the card. It has buffer parameters and delays for it. What can serve as the basis for more accurate settings.
RightMark Audio Analyzer 6.2.3 PRO

Device: ASIO E-MU 0204 | USB

Features:
Input channels: 2
Output channels: 4
Input latency: 440
Output latency: 440
Min buffer size: 88
Max buffer size: 22000
Preferred buffer size: 440
Granularity: 44


For comparison

Device: ASIO E-MU 0202 | USB

Features:
Input channels: 2
Output channels: 2
Input latency: 2138
Output latency: 2714
Min buffer size: 384
Max buffer size: 96000
Preferred buffer size: 1920
Granularity: 192


Device: ASIO E-MU 0404 | USB

Features:
Input channels: 4
Output channels: 4
Input latency: 22083
Output latency: 22216
Min buffer size: 88
Max buffer size: 22000
Preferred buffer size: 22000
Granularity: 44


Pay attention to the size of the buffer! That is why 0202, 0404 has no problems, but 0204 has it! In the case of 0404, the buffer is the same as that of 0204, but it reports “Preferred buffer size: 22000”, that is, it itself says, according to the protocol, that the buffer must be used to the full extent at once, therefore the setting is not required. That's why setting 0204 is required, in my amateur opinion, as it says the software on the computer is “Preferred buffer size: 440”. But, again, but look at the latancy, it depends on the buffer parameters, so 0404 has such a delay because 22000 offers a buffer, and it offers it for reinsurance, as the pro will reconfigure in its own way if necessary. Setting yourself quite leads the map in excellent condition. The manufacturers of other cards (and this series as well) had a calculation that probably “set the buffer to the maximum, if the user doesn’t notice the delay, fine, but there’s enough buffer, if he sees, he knows where to set up, he just noticed.” The calculation, as it turns out, is correct.

UPD number 3: Found a great article with the unfolding of all the shelves, which is associated with buffers. Yes, and do not forget, the resampler spends CPU resources, so the type of resampler you choose will depend on the maximum load on the percent, if you overdo it, then when resampling several sources, the process is not enough and there will be out of sync, which means clicks. In general, the measure must be known.

UPD №4: ATTENTION !!! I found a simple solution! Read the instructions :) It is written about these buffers and about the hum that occurs in some (there are special switches on the bottom that would remove the hum). In general, you do not know what to do, read the instructions ! :) I didn’t have it in the kit, so I was busy, otherwise I would have read it right away. And those who yell about the shortcomings just did not read it !!! :) True, I must admit, the software for Windows for the card is probably so-so, judging by the reviews, I did not see it myself.

UPD №5: For Linux users, I’ll additionally inform you that you can configure everything in a clean version and another link . Since 0404 and 0204 are very similar, most likely the instruction will work in this case, but, I did not check, as I said, laziness is busy with me. Plus, I am not so special that I can be mistaken, judging by the fact that the load on the processor at my settings varies depending on what the sampling rate of the original audio file, it means that the oversampling of the recording in 192000 does not work and the sound is output in this form to card. This means that the instructions on the above links and the output through a clean alsa are not so perfect compared to the output using pulseaudio + jackd + alsa. Imperfect with eyeglasses of ease of adjustment of course. But, it's up to you. However, it should be noted that since writing the instructions for these links, alsa has been improved and my device just automatically worked for me, just with clicks. So, setting up dmix and buffers is probably easy and simple in alsa.

UPD number 6:
Found the easiest way to configure all of the above. It is enough to set the sampling frequency of 88200 and everything plows with the usual pulseaudio. The frequency is set in the above settings ... unless of course this suits you. I arranged, the simpler the better.

UPD # 7:
In Ubunt 14.04, there are no more problems. But. I use sound normalization, maybe that's the thing. Therefore, I will leave here the method of sound normalization in Pulseaudio:
Install packages with ladspa plugins. What exactly I do not know, I just put everything on the search, they are small and put in one folder.
Add a few lines to the end of the /etc/pulse/default.pa file

1. load-module module-ladspa-sink sink_name = ladspa_output.dysonCompress master = 0 sink_properties = device.description = "Compress" plugin = dyson_compress_1403 label = dysonCompress control = -9.0,1,0,5,0.7
This line loads the sound normalization module. Normalization does not allow the sound volume to jump sharply and enrage me as a result :)

2. set-default-sink 2
I have number 2 because I need to turn on the desired sound by default, so that I don’t do it with my hands.

3. set-sink-volume 2 40000
Adjust the volume to the middle, again so as not to bounce when the first sound in the headphones sounds.

As a result, it may therefore, perhaps because the software has grown, there are no jambs in the operation of sound, even without other settings, and normalization is probably not needed, but I am comfortable with it.

Source: https://habr.com/ru/post/194588/


All Articles