个人工具

“UbuntuHelp:UbuntuStudioPreparation”的版本间的差异

来自Ubuntu中文

跳转至: 导航, 搜索
第7行: 第7行:
 
If you are still unsure of which you would like to use, or where to start, a sane set of defaults can be had by doing this:
 
If you are still unsure of which you would like to use, or where to start, a sane set of defaults can be had by doing this:
 
<pre><nowiki>
 
<pre><nowiki>
sudo apt-get install ardour-gtk hydrogen jackd jackeq jack-rack jamin qjackctl qsynth seq24 vkeybd zynaddsubfx lmms
+
sudo apt-get install ardour-gtk hydrogen jackd jackeq jack-rack jamin qjackctl qsynth seq24 vkeybd zynaddsubfx lmms
 
</nowiki></pre>
 
</nowiki></pre>
  
第14行: 第14行:
 
Install the LADSPA plugins so you get some effect plugins for your audio applications to use:
 
Install the LADSPA plugins so you get some effect plugins for your audio applications to use:
 
<pre><nowiki>
 
<pre><nowiki>
  sudo apt-get install blop caps cmt fil-plugins ladspa-sdk mcp-plugins omins swh-plugins tap-plugins vcf-plugins
+
sudo apt-get install blop caps cmt fil-plugins ladspa-sdk mcp-plugins omins swh-plugins tap-plugins vcf-plugins
 
</nowiki></pre>
 
</nowiki></pre>
  
 
Install the DSSI host and plugins:
 
Install the DSSI host and plugins:
 
<pre><nowiki>
 
<pre><nowiki>
sudo apt-get install dssi-host-jack dssi-example-plugins dssi-plugin-fluidsynth dssi-plugin-hexter dssi-plugin-xsynth
+
sudo apt-get install dssi-host-jack dssi-example-plugins dssi-plugin-fluidsynth dssi-plugin-hexter dssi-plugin-xsynth
 
</nowiki></pre>
 
</nowiki></pre>
  
第46行: 第46行:
 
All you have to do for this is give your audio group permissions to access the rtprio, nice, and memlock limits. To do this, you just need to run these commands:
 
All you have to do for this is give your audio group permissions to access the rtprio, nice, and memlock limits. To do this, you just need to run these commands:
 
<pre><nowiki>
 
<pre><nowiki>
sudo su -c 'echo @audio - rtprio 99 >> /etc/security/limits.conf'
+
sudo su -c 'echo @audio - rtprio 99 >> /etc/security/limits.conf'
sudo su -c 'echo @audio - memlock 250000 >> /etc/security/limits.conf'
+
sudo su -c 'echo @audio - memlock 250000 >> /etc/security/limits.conf'
sudo su -c 'echo @audio - nice -10 >> /etc/security/limits.conf'
+
sudo su -c 'echo @audio - nice -10 >> /etc/security/limits.conf'
 
</nowiki></pre>
 
</nowiki></pre>
  
第57行: 第57行:
 
If you are planning on using MIDI at all, you will want to load the ALSA sequencer module.
 
If you are planning on using MIDI at all, you will want to load the ALSA sequencer module.
 
<pre><nowiki>
 
<pre><nowiki>
sudo modprobe snd-seq
+
sudo modprobe snd-seq
 
</nowiki></pre>
 
</nowiki></pre>
  
 
To have your system load it at bootup, you have to add it to the /etc/modules file.
 
To have your system load it at bootup, you have to add it to the /etc/modules file.
 
<pre><nowiki>
 
<pre><nowiki>
sudo su -c 'echo snd-seq >> /etc/modules'
+
sudo su -c 'echo snd-seq >> /etc/modules'
 
</nowiki></pre>
 
</nowiki></pre>
  
第69行: 第69行:
 
The Ubuntu kernel currently is set to 250Hz timers, which is insufficient for MIDI. We can correct this:
 
The Ubuntu kernel currently is set to 250Hz timers, which is insufficient for MIDI. We can correct this:
 
<pre><nowiki>
 
<pre><nowiki>
sudo sysctl -w dev.rtc.max-user-freq=1024
+
sudo sysctl -w dev.rtc.max-user-freq=1024
 
</nowiki></pre>
 
</nowiki></pre>
  
 
To make it persistent across reboots, you need to add a line to the /etc/sysctl.conf file.
 
To make it persistent across reboots, you need to add a line to the /etc/sysctl.conf file.
 
<pre><nowiki>
 
<pre><nowiki>
sudo su -c 'echo dev.rtc.max-user-freq=1024 >> /etc/sysctl.conf'
+
sudo su -c 'echo dev.rtc.max-user-freq=1024 >> /etc/sysctl.conf'
 
</nowiki></pre>
 
</nowiki></pre>
  
第103行: 第103行:
 
If you use a USB MIDI keyboard or a USB sound card as your secondary device, you may run into issues with it taking priority over your PCI device as your main sound card. This tends to happen if you leave it turned on and plugged in during boot. Here is the solution:
 
If you use a USB MIDI keyboard or a USB sound card as your secondary device, you may run into issues with it taking priority over your PCI device as your main sound card. This tends to happen if you leave it turned on and plugged in during boot. Here is the solution:
 
<pre><nowiki>
 
<pre><nowiki>
sudo su -c 'echo options snd-usb-audio index=-2 >> /etc/modprobe.d/alsa-base'
+
sudo su -c 'echo options snd-usb-audio index=-2 >> /etc/modprobe.d/alsa-base'
 
</nowiki></pre>
 
</nowiki></pre>
  

2007年5月24日 (四) 14:34的版本

Setting up your system for an audio workstation currently requires several steps. This was written with Ubuntu 6.06 LTS (dapper) in mind.

Install the applications

If you are still unsure of which you would like to use, or where to start, a sane set of defaults can be had by doing this:

sudo apt-get install ardour-gtk hydrogen jackd jackeq jack-rack jamin qjackctl qsynth seq24 vkeybd zynaddsubfx lmms

Effect Plugins and Instruments

Install the LADSPA plugins so you get some effect plugins for your audio applications to use:

sudo apt-get install blop caps cmt fil-plugins ladspa-sdk mcp-plugins omins swh-plugins tap-plugins vcf-plugins

Install the DSSI host and plugins:

sudo apt-get install dssi-host-jack dssi-example-plugins dssi-plugin-fluidsynth dssi-plugin-hexter dssi-plugin-xsynth

Kernel Preemption & Xruns

Xruns. What are they? Well, simply put, either they are buffer underruns or buffer overruns.

  • A buffer underrun happens during playback, when your sound card tries to read data from the buffer, but your software has not yet filled it.
  • A buffer overruns happens during recording, when your sound card tries to write data to buffer, but your software has not yet emptied it.

The only acceptable time to receive Xruns is during application startup. Currently, for whatever reason, JACK applications usually cause a few Xruns as it connects to the JACK server, but these will not hurt you in any way. The most critical time to not receive an Xrun is during recording, because it causes a permanent glitch in your audio, which may or may not be easily heard.

So now you should understand basically why you want to avoid Xruns. They will cause issues with your recordings, or cause annoyance during playback. Thankfully, you can get these down to a minimum, if not eliminate them altogether.

Breezy's stock kernel didn't have any kind of preemption built in, which produced horrible latencies for decent Xrun results (few to none).

Dapper's kernel has CONFIG_PREEMPT enabled, which gives better results, but still not the best results. However, some preemption support is better than none, and the current kernel has been much improved since Breezy's day. It might suffice for your purposes, so try it out, and if your latencies are good enough for your purposes and you get no Xruns during recording or playback, then you can move on to the next section.

If the performance isn't good enough for you, and you really want to get true low-latency with no Xruns, you can get a vanilla kernel, patch it with Ingo Molnar's -rt patch, and compile your own kernel. To do this, you will need to know somewhat what you are doing. For example, if you have compiled a kernel before, you should be good to go with our tutorial.

Ingo Molnar's patch gives us the CONFIG_PREEMPT_RT option, for realtime-preemption. This is the key to low-latency, real-time Linux audio. For a guide on compiling a vanilla kernel with Ingo's patch, read UbuntuHelp:HowToVanillaKernelWithRealtimePreemption. Note that this will be missing many patches that Ubuntu uses on their kernels, unless you try to patch them yourself, so you may end up with missing drivers for your devices if they aren't supported in the mainline vanilla kernel. You might also experience stability issues while running this kernel, so we recommend you keep a copy of the default Ubuntu kernel installed for everyday work.

Real-Time Support

Now you need to set up real-time access for your applications.

All you have to do for this is give your audio group permissions to access the rtprio, nice, and memlock limits. To do this, you just need to run these commands:

sudo su -c 'echo @audio - rtprio 99 >> /etc/security/limits.conf'
sudo su -c 'echo @audio - memlock 250000 >> /etc/security/limits.conf'
sudo su -c 'echo @audio - nice -10 >> /etc/security/limits.conf'

And that is it! You're all set for real-time acces!

ALSA Sequencer

If you are planning on using MIDI at all, you will want to load the ALSA sequencer module.

sudo modprobe snd-seq

To have your system load it at bootup, you have to add it to the /etc/modules file.

sudo su -c 'echo snd-seq >> /etc/modules'

Timer Resolution

The Ubuntu kernel currently is set to 250Hz timers, which is insufficient for MIDI. We can correct this:

sudo sysctl -w dev.rtc.max-user-freq=1024

To make it persistent across reboots, you need to add a line to the /etc/sysctl.conf file.

sudo su -c 'echo dev.rtc.max-user-freq=1024 >> /etc/sysctl.conf'

This guy [1] even recommends setting the max-user-freq to 8192. He claims that he is achieving latencies <1ms with stable zero xruns There may be other useful information on this page. For example setting rtc and soundcards IRQ priorities higher than everything else using something like:

chrt -f -p 98 `pidof "IRQ 8"`
chrt -f -p 82 `pidof "IRQ 4"`

where IRQ 8 is the irq of the real time clock and IRQ 4 has to be the soundcard's current irq, which may change between reboots. chrt is part of the package schedutils (Linux scheduler utilities).

IRQs can be listed via

cat /proc/interrupts

I'm not sure if, when using above chrt settings, one must also change the rtprio setting in /etc/security/limits.conf accoringly, or if it can remain at 99



USB MIDI Keyboard/USB Secondary Sound Card Fix

If you use a USB MIDI keyboard or a USB sound card as your secondary device, you may run into issues with it taking priority over your PCI device as your main sound card. This tends to happen if you leave it turned on and plugged in during boot. Here is the solution:

sudo su -c 'echo options snd-usb-audio index=-2 >> /etc/modprobe.d/alsa-base'

Getting it All Going

First, you will want to launch Qjack``Ctl by itself, and configure it for your soundcard. Follow the UbuntuHelp:HowToJACKConfiguration page if you need help.

Next, we recommend you have a read through the UbuntuHelp:HowToQjackCtlConnections tutorial, which is used to quickly connect the various applications and it should give you a grasp of the concept behind JACK and how modular the Linux audio world is.

Once you understand how JACK connections work, you might like to follow a tutorial on composing a basic song with Seq24. Check that out here: UbuntuHelp:HowToSeq24Introduction.