[Solved, But...] Crackling In 2.5 With Alsa

Hey,

I get crackling/popping audio with v2.5 under Linux with ALSA. It’s related to the Buffer size, the smaller the buffer, the higher the popping frequency. It pops even with very high buffer sizes like 4096x3. It sounds like not the entire audio buffer is filled or something. CPU usage is at ~4%. It first happened with one of the 2.5 betas, don’t remember which one. It didn’t happen with earlier versions. It doesn’t happen all the time – sometimes it crackles, then over time it gets somewhat better, then everything is fine, later the crackling starts again. Everything seems to work okay when using JACK. I’m using an ES1371 card. Other audio apps don’t crackle.

Using a 3ghz AMD dualcore, Kernel 2.6.31-16-386 SMP (non-RT), Ubuntu 9.10, ALSA 1.0.20.

Well yes, that is imho quite a natural behavior that the smaller your buffer-size becomes, the larger the risk is that crackling occurs.
It does not necessarily have to relate to cpu but can also be that more amount of samples have to be processed than the buffer-size allows to (that indeed depends which kind of samples or instruments you use and what bitrate and frequency)
I have no idea how this Alsa / host synergy could be best optimized though.

… do you have the same problem when disabling the capture/recording device in Renoises Audio prefs, only using an output device?

It seems that with some drivers synchronizing the recording and playback device causes a lot of troubles. We might try out some alternative ways to do so in Renoise, if Jack does a better job here. unfortunately this changes with every driver, aka every driver seems to behave different here.

Opened Renoise, played back a pattern, crackling. Disabled In Device in Prefs, played back a ~4 minute song, with no crackling.

I guess that’s it!

Edit: I’ll use that workaround for now. If it still crackles with In Device disabled I’ll post here.

When you say “sync the recording and playback device”, do you mean you read from the input and write to the output in one go (ie, in one callback function)? I can see why that might cause trouble. What if the input device doesn’t use exactly the same sampling rate? Might be driven by a different quartz… The ES1371 has (apparently) 2 DACs and 1 ADC, and I wouldn’t rely on any of them being at the exact same rate. Which device I choose for the output, hw:0,0 or hw:0,1 doesn’t seem to make a difference for the crackling.

The ES137* are relatively common chips. Good old Creative Labs stuff :wink:

I also have crackles when I set a recording AND output device for my SB Audigy 2. (Ubuntu 9.10 / Alsa 1.0.20) When I only set the Audigy in the output device and leave the input/recording device blank, no crackles occur.

Hope this can/will be fixed in a upcoming release.

If I want to record I use Pulseaudio. I route the output into gnome’s sound recorder and save the file. Then I import the sample in Renoise.

It should be nicer to record from inside renoise ofcourse. But this is a workaround for now.

Does jack do a better job with your soundblaster then, or does it behave the same when running full duplex?

Jack performs much better than running alsa in full duplex mode. When I use alsa with the output device only (and set the input device to none), I notice no big differences in performance in comparision with jack. Since I prefer alsa instead of jack I hope you can fix the full duplex problem with alsa. I don’t like jack and jackctl. I think it’s too complicated. Alsa is easier.

@taktik: is it possible to use Renoise with Pulseaudio to record in the sample editor? When I now want to record, I use the gnome sound recorder. This program will show up on the pavucontrol window so that I can record the audio output. When I start Renoise, Renoise itself doesn’t show up in the pavucontrol window, so I cannot record directly into Renoise. Does Renoise not support Pulseaudio (yet)?

What I mean is, does Jack run better when running in full duplex mode? Does it run better than running Renoise in ALSA full duplex mode directly?

About pulseaudio: Not thats currently not possible, but you can again use jack here. Jack is able to connect to pulseaudio. I don’t know how good that works and how exactly, sorry.

Perhaps this post could interest you: Linux Pulseaudio Support

I’m very happy with this setup. PulseAudio works regardless of if Jack is running or not. When Jack is started, everything from PulseAudio is available for other applications like Renoise, so recording to Renoise is no problem. It even enables recording directly from Spotify (via wine->jack) into Renoise. Which might of course be illegal, but at any rate is technically possible. The same goes for recording from Youtube or other media viewed in your browser.

I have added a few more things to the qjackctl scripts. Mainly to kill any processes that might stop pulseaudio from shutting down when starting Jack. Currently my “Execute script on Startup” looks like:

artsshell -q terminate; killall nspluginviewer; killall npviewer.bin; killall pulseaudio  

Maybe this is something to add to a tips-n-tricks page, I know Vv mentioned that earlier.

Thanks Johan for the info.

Hey Tom, how do you get Jack on 9.10? As it doesn’t seem to come as standard and isn’t in the Repository from what I can see either…

(Should probably start my own thread but hopefully it’s just a quicky.)

sudo apt-get install jackd

Is no jackd in the 9.10 repository. Or at least I had tried that initially and it didn’t work.

sudo apt-get qjackctl did seem to download and install some Jack stuff though…

Followup: Yes, full-duplex mode with Jack (using ALSA backend) works fine.
Being able to use ALSA to record again would be cool… It’s quicker to set up than Jack.