ubuntu studio 10.04 and novation x-station - trying to record audio 1 and 2

Pablo pablo.fbus at gmail.com
Mon Jul 19 14:04:08 BST 2010


Neil Jensen escribió:
> Hi All,
>
> Along this subject line, I too have been struggling with audio
> connections for jack.
> In particular I want to either use Ardour, QTrackter, Muse, and
> Rosegarden.
>
> When I connect my midi keyboard,m-audio 88es, to these applications I
> can get them to play and imported audio file track, but can't get it to
> record AND play my keyboard.
>
> I do have Qsynth and ZyAddSubFx hooked up to jack to  get sound from the
> keyboard just to use it.
>
> Can anyone either make a dummy proof diagram or flow chart on how to get
> this running?
>
> I would be so grateful.
>   
Hi Neil, It is hard to make a diagram but I will try to explain and put 
some basic workflow examples.
 I think you are almost there. Please, forgive my poor English, I 
sometimes lack the words.
I hope someone can explain it better than me.

Qsynth and Zynadd are software synths. You connect midi to them and they 
output audio. If you connect your midi keyboard to their
inputs in the alsa tab and you connect synths' audio outputs to 
"system_playbacks" in the audio tab,
 you have sound when you play the midi keyboard. So far so good.

Now, Rosegarden, Qtractor and Muse have midi tracks (audio tracks as 
well but let's focus on midi
first). So, they are midi sequencers. You can write midi notes on them 
with keyboard/mouse, in matrix or notation editors, depending on the 
program / your needs. You can also record notes on a midi track by means 
of your midi keyboard. But this is no sound, this is MIDI, it transmits 
event messages, such as pitch , note on, note off... To get sound of a 
midi track you need, again, a synth, something that translates MIDI
events to actual sound. It is the same case as your midi keyboard. It 
doesn't make sounds by itself.

To get sound of a midi track in these programs you need one of these:

- A synth plugin, e.g., a DSSI plugin.
- A external software synth
- A external hardware synth

In the first case, you "plug" the instrument inside the application.
In Rosegarden you right click on a track and choose "synth plugin". Then 
go to instrument parameters and push the "No synth" button and load the 
synth plugin, such as hexter, fluidsynth (with a soundfont loaded)... 
This way you have sound from the master outputs of Rosegarden.

In the second case, you route the midi track to the external synth, say 
Zynaddsubfx.
In Rosegarden, go to Studio -> Manage MIDI Devices and, in the top left 
window, MIDI playback, add a new device and call it Zynadd (for 
example). You also can rename the existing default "General MIDI 
device". Above all, connect it to Zynaddsubfx, which you will see in the 
right column as an availabe output. Close that window. Right click on a 
track and choose Zynadd, you have 16 channels. Choose the same channel 
in Rosegarden and zynaddsubfx. This is an "alsa midi" connection and you 
can check it in the alsa tab of qjackctl (in fact, you can make the 
connection there as well).

Ardour2 only has audio tracks, so you can't connect your midi keyboard 
to it, to record or play notes.

Workflow examples:

1. You want to record in ardour the sound from your midi keyboard 
connected to zynaddsubfx, and hear (monitor) the sound at the same time:

In qjackctl, connect (alsa) the midi keyboard to zynadd, connect (audio) 
the output of zynadd to the input of an ardour track (add a track 
first). To hear what you are playing, either connect zynadd's outs to 
system_playbacks, or
choose in ardour: options, monitoring, ardour does monitoring.


2. You want to record the notes from your midi keyboard to a midi track 
in Rosegarden, while you listen to the sounds through whatever synth, 
then you want make some corrections in the midi track, via 
keyboard/mouse and once it is OK, you want to record the result to ardour:

In Rosegarden, Studio -> Manage MIDI Devices, bottom left window, rename 
(if you wish) the capture device to "88es" or whatever,  and  connect  
the keyboard that you will see as an available midi input on the bottom 
right window. Arm the midi track to record (yellow button) and record. 
To hear what you are recording, you need to apply the above explained 
(either a synth plugin or an external soft synth). Once you have made 
the corrections to the midi track, you can record it to ardour. If you 
have used a external soft synth, disconnect (audio tab) rosegarden 
master outputs to ardour, you only want the synth connected to ardour. 
If you have used a synth plugin, then connect rosegarden master outputs 
to ardour audio track inputs.


Computer music is not a piece of cake and, in Linux it is a bit more 
involved because of its modular approach (there are exceptions but it is 
a bit like: one program, one task.  As opposed to integrated musical 
environments alà Windows/Mac). However, once you understand the basics 
(and learn some tricks and workarounds) you can make up your own 
workflow with the several and good tools you have. I mentioned ardour 
because I use it and it is "the" linux multitrack recorder, but for home 
recording it can be overkilling. You have audio tracks in Rosegarden  / 
qtractor / Muse as well.


I recommend these URL's:

http://wiki.linuxmusicians.com/doku.php
(linuxmusicians wiki, newbies section)

http://www.linuxmusicians.com/
(the forum, where linuxmusicians of all countries and distros meet)

http://lievenmoors.github.com/
(a series of lectures on Linux & Audio)

Also, www.ardour.org, www.rosegardenmusic.org, www.rncbc.org, and in 
general, official sites of the programs, in which you can find direct 
support form the devs and some advanced users.


>
> On Sun, 2010-07-18 at 23:47 -0500, jay gallivan wrote:
>   
>> On Sat, Jul 17, 2010 at 6:34 PM, Pablo <pablo.fbus at gmail.com> wrote:
>>         jay gallivan escribió:
>>         > Thanks for your reply. I'm a total newbie to all of this.
>>         
>>         Hi Jay,
>>         
>>
>> Greetings. Long couple of days growing my understanding of audio on
>> Linux. I've worked with micros since 1981, UNIX since 1988 and Linux
>> since 1996. I've never had to pay attention to audio before now. Is
>> this what happens when computer people find themselves in a band?
>> That's how I came to this. I play bass. It's tough to get the the
>> three of us together. So, the plan was to record the leader - who does
>> the singing and plays acoustic guitar - so i could practice. The
>> X-Station was lying around (bought for one of the kids years ago) and
>> I have 'extra' Linux boxes. So, the adventure began.... 
>>  
>>         Pulseaudio is a linux sound system (audio server) desktop
>>         oriented and
>>         Jack (Jack Audio Connection Kit) is another one, oriented
>>         towards music
>>         production (low latency, anything to anywhere connections...).
>>         Both use
>>         the alsa drivers (jack can also use the ffado drivers for
>>         firewire audio
>>         devices but this is not your case) but apart from that, they
>>         are very
>>         different beasts.
>>
>> ALSA had been just another four letter word to me. No more.
>>     
Alsa is a lot of things at the same time and depending on the context, 
"alsa" refers to completely different concepts. See 
http://lievenmoors.github.com/

>>  
>>
>>         
>>         Timidity is a default midi server. It can do jack, but it
>>         doesn't by
>>         default. In a musical environment timidity is not as used as
>>         qsynth for
>>         example, which is "jackified" by default. But you must load a
>>         soundfont
>>         in qsynth.
>>
>> I'm beginning to get the idea of MIDI. Another protocol. In Rosegarden
>> I can seen MIDI message flow. That's helpful in the same way that
>> looking at network packet traces are helpful. "Oh. So that's what's
>> going on."
>>  
>>         
>>         In order to use Rosegarden (the audio part) you need the jack
>>         audio
>>         server and forget about pulseaudio interfaces (once jack takes
>>         hold of
>>         your soundcard, pulseaudio is useless, and, hopefully,
>>         harmless). You
>>         launch the server by means of a graphical front-end called
>>         qjackctl
>>         (Jack Control in the sound and video menu). First, you press
>>         "setup" to
>>         configure the jack audio server. In the interface field you
>>         select your
>>         usb audio card (you will see a generic usb-audio or similar, I
>>         guess).
>>         Then press start to activate jack.
>>
>> Pulseaudio drops out of the picture but the motherboard audio i/o
>> still seems to be there. This appears to be the path to my external
>> speakers for monitoring. So that would be something like....
>> Ardour/Rosegarden -> Jack -> ALSA -> chips -> speakers?
>>     
Yes!

Jackified audio apps -> Jack -> ALSA driver -> hardware audio device -> analog in / outs -> micros / speakers

For firewire audio cards:

Jackified audio apps -> Jack -> FFADO driver (firewire) -> hardware audio device -> analog in / outs -> micros / speakers




>>         
>>         If jack does not start, this is the first problem you should
>>         solve (more
>>         below).
>>
>> I had quite a bit of trouble with Jack. First, a very slow box - eight
>> years old. I moved to a newer box - maybe three years old - and found
>> i had way to little ram. 1GB. Went to 2GB today and things are much
>> better - with Jack grabbing 1.5GB. Ouch! Do i need to get more?
>>
>>     
Not really, although jack loves RAM. There is this infamous bug that can 
make that pulseaudio locks memory and jack is affected:

https://bugs.launchpad.net/ubuntu/+source/jack-audio-connection-kit/+bug/491329

I really can't understand the reason why the importance is set to low.  
It affects lots of people with little RAM.

Check what you have in /dev/shm and remove the pulse files.

qjackctl suspends pulseaudio and this should be enough but this doesn't 
kill the pulseaudio daemon.

To kill pulseaudio and make sure it does not respawn, you have to, for 
the music production oriented user:

edit ~/.pulse/client.conf

and add the line:

autospawn = no

or edit the system-wide  file:

/etc/pulse/client.conf


Then, you kill pulseaudio with:

pulseaudio -k

And you can always restart it with:

pulseaudio --start


Users find a problem when they try to play music, see youtube, etc, when 
jack is active, because most multimedia players are not jackified by 
default. There are several approaches to this issue, like: jackify the 
player, use the pulse-jack audio sink, use one audio card for music 
production and another for desktop use, log in with a "music" user where 
pulseaudio is permanently killed or completely removed...

>>         
>>         If it starts, then the jack audio clients, like rosegarden,
>>         and many
>>         more (most music oriented programs are jack-aware by default)
>>         will show
>>         their ports in the connect window, audio tab, when you launch
>>         them.
>>         The MIDI tab stands for jack MIDI which is not used by
>>         Rosegarden
>>         nowadays. The alsa tab refers to alsa  sequencer or alsa MIDI.
>>         It has
>>         nothing to do with jack but it is there for convenience
>>         because several
>>         synths and sequencers use the alsa sequencer for MIDI and jack
>>         for
>>         audio. Some newer ones use jack MIDI and jack audio but not
>>         Rosegarden.
>>         This explains that you could capture midi in Rosegarden
>>         despite the jack
>>         server was not active.
>>         
>>
>> So both ALSA and Jack do MIDI? Can you point me to some data flow
>> diagrams?
>>     

Yes, both do midi. Jack midi is rather new on the scene. Alsa midi, the 
alsa sequencer, has been there for ages. Ardour3 will do jack midi. Some 
synths do both. There is not a lot of documentation on it. Supposedly, 
jack midi is more precise but I am not an expert. There is an alsa to 
midi bridge daemon called a2jmidid to allow connections between clients 
of both midi implementations.


>>    
>>
>>         Also, take into account that Rosegarden does not make sounds
>>         by itself
>>         and it has not any default synth that makes it work out of the
>>         box.. It
>>         needs either a software synth plugin or an external synth,
>>         either
>>         software (say, qsynth, zynaddsubfx...) or hardware.  But this
>>         is a
>>         second step. The first step is jack setup.
>>         
>>
>> I'm do have Jack running in RT mode. The Ubuntu Studio installation
>> installed a preemptive kernel. First time I've ever needed that! I did
>> come across some documentation describing what you outlined. That
>> certainly caused me concern re memory.
>>  
>>         In order to have jack working in realtime mode (recommended)
>>         you need,
>>         as a user, some priorities that you can check in a terminal
>>         with:
>>         
>>         ulimit -r (this is realtime priority for the user)
>>         ulimit -l (this is memlock limit for the user)
>>         
>>         You need the first one at ninety-something and the second one,
>>         unlimited
>>         or a reasonable amount of your RAM, in kB. In turn, to gain
>>         these
>>         privileges, there must be a file called:
>>         
>>         /etc/security/limits.d/audio.conf
>>         
>>         with the relevant lines. So please, do a:
>>         
>>         cat /etc/security/limits.d/audio.conf
>>         
>>         and you must have something like:
>>         
>>         @audio - rtprio 99
>>         @audio - memlock unlimited
>>         
>>         Now you (you the user) have to belong to the "audio" group.
>>         Check in a
>>         terminal with:
>>         
>>         groups
>>         
>>         If you see audio (between others) you are done. If you don't,
>>         you must do:
>>         
>>         sudo adduser user audio
>>         
>>         where "user" is your login name. Then reboot and you will have
>>         the
>>         system prepared to use jack
>>         (check again with the ulimit commands)
>>         
>>         
>>         
>>         >
>>         > I don't see anything in Patchbay. In PulseAudio Manager I
>>         see
>>         > X-Station analong stero as a sink and the same as sources
>>         for stereo
>>         > and stereo monitor.
>>         
>>         
>>         Just don't use pulseaudio.
>>         >
>>         > When I connect (via Connect) X-Station to Timidity I am able
>>         to play
>>         > the keyboard and hear the results via my computer's
>>         speakers. And I
>>         > can record and playback via Rosegarden when I connect
>>         X-Station to
>>         > Rosegarden.
>>         
>>         Don't use timidity unless you do it jack-aware.
>>         
>>         >
>>         > I've tried Audacity on my Windows XP box and I've been able
>>         to
>>         > pickup/record from the X-Station audio ports - though merged
>>         into a
>>         > single track for some reason.
>>         >
>>         > So it seems that the X-Station is doing what it's supposed
>>         to do. But
>>         > that (some component of ) Ubuntu Studio is dropping the
>>         X-Station
>>         > audio. Any thoughts on that?
>>         
>>         See above.
>>         
>>         Cheers! Pablo
>>
>> So here's where things now stand. I bought an Alesis iO2 with a view
>> to being able to capture the mic and guitar at the same time. I've
>> been able to demonstrate that to myself by using the Puluseaudio
>> volume controller and the Sound Recorder application. Sound Recorder
>> created an ogg file which I then converted to wav. I was able to read
>> the file into Ardour. Then I ran out of weekend.
>>
>> Right now I'm in a good place: I can make the recording I need to
>> make. But I've also discovered a whole new area of interest! I've
>> always like Linux - and avoided MS and Apple. It's wonderful to see
>> how much amazing work has been done!
>>     

just start jack and record to ardour directly, by connecting the right 
system_capture port to an audio track. If you see that ardour is 
overkilling for certain tasks and you want a simple jack-aware audio 
recorder, try with timemachine or jack_capture (jack_capture_gui2 for a 
graphical front-end).

http://plugin.org.uk/timemachine/
http://archive.notam02.no/arkiv/src/

If don't want to compile, the first one is in the official repos and you 
can get jack_capture from the excellent ppa by Philip Johnsson:

https://launchpad.net/~philip5/+archive/extra/


>> Thanks very much for taking the time to reply.
>>     
You are welcome!

Regards, Pablo



More information about the Ubuntu-Studio-users mailing list