LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-18-2010, 08:38 PM   #1
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
USB midi input device ?


I just bought an M-Audio Keystation 49e off of craigslist and I'm at a bit of a loss on where to start to use it as an input device for muse or rosegarden.

Distro: Debian Lenny
Kernel: 2.6.26-2-686
Laptop: Compaq V5305WM

Everything seems setup, but I'm at a loss on how to use it in the applications. It doesn't have any sound synthesis abilities on the keyboard, it's just an input device.

Without the keyboard I usually go this route:

jackd -R -d alsa &
timidity -Oj -iA &
rosegarden

And midi events output sounds and all that jazz.

I'm wanting to input notes / record from the keyboard. But still output all sounds in the aforementioned manner. If I could get those to happen while I record that would help a bunch. Maybe it's just too late in the day for me to wrap my brain around it at the moment.

Anyway the setup seems fine:

Code:
$ cat /proc/asound/cards

 0 [IXP            ]: ATIIXP - ATI IXP
                      ATI IXP rev 2 with unknown codec at 0xd0003400, irq 17
 1 [Modem          ]: ATIIXP-MODEM - ATI IXP Modem
                      ATI IXP Modem rev 2 at 0xd0003800, irq 17
 2 [K49e           ]: USB-Audio - Keystation 49e
                      Evolution Electronics Ltd. Keystation 49e at usb-0000:00:13.1-2, full speed
 3 [VirMIDI        ]: VirMIDI - VirMIDI
                      Virtual MIDI Card 1
Code:
$ aconnect -i
client 0: 'System' [type=kernel]
    0 'Timer           '
    1 'Announce        '
client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 24: 'Keystation 49e' [type=kernel]
    0 'Keystation 49e MIDI 1'
client 28: 'Virtual Raw MIDI 3-0' [type=kernel]
    0 'VirMIDI 3-0     '
client 29: 'Virtual Raw MIDI 3-1' [type=kernel]
    0 'VirMIDI 3-1     '
client 30: 'Virtual Raw MIDI 3-2' [type=kernel]
    0 'VirMIDI 3-2     '
client 31: 'Virtual Raw MIDI 3-3' [type=kernel]
    0 'VirMIDI 3-3     '
Code:
$ aconnect -o
client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 24: 'Keystation 49e' [type=kernel]
    0 'Keystation 49e MIDI 1'
client 28: 'Virtual Raw MIDI 3-0' [type=kernel]
    0 'VirMIDI 3-0     '
client 29: 'Virtual Raw MIDI 3-1' [type=kernel]
    0 'VirMIDI 3-1     '
client 30: 'Virtual Raw MIDI 3-2' [type=kernel]
    0 'VirMIDI 3-2     '
client 31: 'Virtual Raw MIDI 3-3' [type=kernel]
    0 'VirMIDI 3-3     '
/etc/modprobe.d/alsa_custom.conf
Code:
install snd-pcsp /sbin/modprobe --ignore-install snd-pcsp $CMDLINE_OPTS && /lib/alsa/modprobe-post-install snd-pcsp
options snd-pcsp index=-2

alias   char-major-116      snd
alias   char-major-14       soundcore

options snd                 major=116       cards_limit=3
options snd-atiixp          index=0
options snd-atiixp-modem    index=1
options snd-usb-audio       index=2
options snd-virmidi         index=3


alias   snd-card-0          snd-atiixp
alias   snd-card-1          snd-atiixp-modem
alias   snd-card-2          snd-usb-audio
alias   snd-card-3          snd-virmidi

alias   sound-slot-0        snd-card-0
alias   sound-service-0-0   snd-mixer-oss
alias   sound-service-0-1   snd-seq-oss
alias   sound-service-0-3   snd-pcm-oss
alias   sound-service-0-8   snd-seq-oss
alias   sound-service-0-12  snd-pcm-oss

alias   sound-slot-1        snd-card-1
alias   sound-service-1-0   snd-mixer-oss
alias   sound-service-1-1   snd-seq-oss
alias   sound-service-1-3   snd-pcm-oss
alias   sound-service-1-8   snd-seq-oss
alias   sound-service-1-12  snd-pcm-oss

alias   sound-slot-2        snd-card-2
alias   sound-service-2-0   snd-mixer-oss
alias   sound-service-2-1   snd-seq-oss
alias   sound-service-2-3   snd-pcm-oss
alias   sound-service-2-8   snd-seq-oss
alias   sound-service-2-12  snd-pcm-oss

alias   sound-slot-3        snd-card-3
alias   sound-service-3-0   snd-mixer-oss
alias   sound-service-3-1   snd-seq-oss
alias   sound-service-3-3   snd-pcm-oss
alias   sound-service-3-8   snd-seq-oss
alias   sound-service-3-12  snd-pcm-oss
In theory client 24: should be the input device I want. I just can't seem to connect the dots. 128: would be the timidity output devices. The TLDP midi tutorial seemed to help with said config. But that's about all it helped with. And I don't seem to even need the virmidi component.

I've tried amsynth and spiralsynthmodular, but I still can't figure out how to bridge the gap from midi input to timidity output. I've tried muse and rosegarden but I'm at a loss since I've always just edited, not inputed midi events with a midi device.

Any down and dirty get the ball rolling. At least to verify that the device actually works would help.

Thanks in advance.
 
Old 07-18-2010, 11:09 PM   #2
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137

Original Poster
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
Minor progress. In rosegarden under studio -> manage midi devices, there is a center column under record devices labeled current. It's an empty box with No by default. Clicking it makes it checked and yes. And the keyboard now makes sounds. Quite the latency on the event, but sounds at last. However pressing record yields no record device selected, and I'm still unsure of where to select that. I [X]'d out the other control panel where you usually set instrument bank and stuff and I don't seem to be able to regain it. Even after re-installing rosegarden through the gratuitous dpkg --purge --force-all and apt-get install method. Anyway I guess the keyboard does work, sort of.
 
1 members found this post helpful.
Old 07-19-2010, 01:02 AM   #3
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137

Original Poster
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
More progress. Using qsynth with fluid-soundfont-* and other parts I've been able to have a much less latent synth of sorts. I had to set the midi driver to OSS and the midi device to /dev/midi2, but once that was set, plus an sf2 soundfont selected, it works. I have sequencer and oss emulation active in alsa.

works
/usr/share/sounds/sf2/FluidR3_GM.sf2 (piano)
/usr/share/doc/libfluidsynth-dev/examples/example.sf2 (cheap organ)

doesn't work
/usr/share/sounds/sf2/FluidR3_GS.sf2 (???)
 
1 members found this post helpful.
Old 07-19-2010, 01:14 AM   #4
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137

Original Poster
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
I guess I should add, rosegarden run as follows.

$ jackd -R -d alsa &
$ timidity -Oj -iA &
$ rosegarden

qsynth run as follows.

$ jackd -R -d alsa &
$ qsynth

And I did have to:
# chown root:audio /usr/share/sounds/sf2/*.sf2

To get it to work with other .sf2's other than the libfluidsynth one.
 
1 members found this post helpful.
Old 07-19-2010, 09:58 AM   #5
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137

Original Poster
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
I was able to get recorded input from the midi device in rosegarden. I'm not entire sure how I did that, but I guess if you change enough options, things happen. Still not that useful with such a hefty latency. No luck restoring my segment something or other edit window. On to the svn version I guess. I was not able to assign anything other than program 1 of general midi to the synth (piano), although if that edit window didn't go on vacation it would have been possible to make that change IMO. Or not.

qsynth is a nifty little thing with whatever .sf2 files I can scrounge up on the internet. With some way to put that between rosegarden and timidity. And with qsynth -a oss (or -a alsa) you can do all that without jackd. I guess I'm figuring it all out, I'm just surprised that it's not simpler / default behavior. As some of the apps wouldn't even launch without a midi device present. But I guess typical midi devices have their own sounds on the device with zero latency. And I probably need to upgrade my 4yo laptop at some point.
 
1 members found this post helpful.
Old 07-19-2010, 06:11 PM   #6
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137

Original Poster
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
Upgrade to RoseGarden 10.06 complete from source.

$ rm -rf /home/user/.kde/share/config/rosegardenrc

before launching the update and everything is as it should be. With fancy new look. And the Studio -> Manage Midi Devices was simple and intuitive. Click in the input device I want(24:0 / Keystation 49e), it changes color. Click on the output device I want(128:0 / Timidity) and it changes color. Note on the keyboard sounds note on timidity daemon. With that Special Parameters / Segment + Track + Instrument panel back in place I can select different midi sounds and it just works. There's still a pretty hefty latency though. As in half a second after I push the key on the keyboard a sound comes out of the speakers.

Compile from source went without a hitch, although a bit resource hungry and time consuming. But I've previously installed stuff from source so all of my deps were met from those efforts.

Code:
$ sh bootstrap.sh
$ ./configure --prefix=/usr
$ make
$ su
# make install
$ exit
$ exit
I can record from the midi device and your basic stuff. (If I only knew how to play keyboard better). Now to see what I can do with Muse. Or if qsynth with rosegarden might ease the latency issue.
 
1 members found this post helpful.
Old 07-20-2010, 11:57 AM   #7
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137

Original Poster
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
More progress, but latency seems to be the issue of no remorse. I gave up on qsynth and went direct to fluidsynth.

Down to the basics.

in 4 Eterms on an inactive workspace / desktop in this order.

$ jackd -R -d alsa

$ timidity -Oj -iA

$ fluidsynth general_midi_soundfont.sf2

$ rosegarden

And switch to the other workspace before rosegarden launches. Once up you can select a new midi device which is fluidsynth as the output midi device. Everything else stays pretty much the same. I'm currently trying out merlin_gmv22.sf2 as the soundfont. It has a rather nice horn sound and brass in general, plus percussion sounds are better IMO. Volumes seem a little off which plays with the balance of some existing .mid files. But otherwise a nice collection. There is still a bit of latency, but it's mildly better with fluidsynth. I could probably forgo even running timidity, but old habits and all. It might also give an opportunity to A/B between general midi original and enhanced for all intents.

$ fluidsynth -ni soundfont.sf2 midifile.mid

To play a midi file with a particular soundfont. And probably tons of other stuff I have yet to discover.
 
1 members found this post helpful.
Old 07-26-2010, 01:06 AM   #8
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137

Original Poster
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
I managed to lower the latency a bit by mimic-ing what qsynth does in terms of settings. Relative to the defaults that didn't / don't match to fluidsynth.

Code:
$ fluidsynth -C no -R no -o
  audio.periods=2,audio.jack-autoconnect=1,audio.jack.id='custom',
  audio.driver='oss',synth.sample-rate=48000,
  midi.driver='oss',midi.oss.device='/dev/midi3' 
  /home/user/media/midi/soundfonts/merlin_gmv22.sf2
Some lines broken up to prevent the scrollbar thing. The main points of interest, driver shift to OSS (emulated in alsa --with-oss=yes), periods to 2 (default 16), well it's all somewhat important I guess. Still some latency, but I can almost track to something (or at least the click track) now.

$ fluidsynth -o help

Code:
audio.output-channels    INT   [min=2, max=32, def=2]
audio.periods            INT   [min=2, max=64, def=16]
audio.alsa.device        STR   [def='default']
audio.file.name          STR   [def='fluidsynth.raw']
audio.sample-format      STR   [def='16bits']
audio.period-size        INT   [min=64, max=8192, def=64]
audio.jack.autoconnect   INT   [min=0, max=1, def=0]
audio.jack.multi         STR   [def='no']
audio.jack.id            STR   [def='fluidsynth']
audio.oss.device         STR   [def='/dev/dsp']
audio.input-channels     INT   [min=0, max=2, def=0]
audio.driver             STR   [def='alsa']
midi.alsa.device         STR   [def='default']
midi.alsa_seq.device     STR   [def='default']
midi.alsa_seq.id         STR   [def='pid']
midi.oss.device          STR   [def='/dev/midi']
midi.driver              STR   [def='alsa_seq']
synth.reverb.active      STR   [def='yes']
synth.ladspa.active      STR   [def='no']
synth.midi-channels      INT   [min=16, max=256, def=16]
synth.polyphony          INT   [min=16, max=4096, def=256]
synth.sample-rate        FLOAT [min=22050.000, max=96000.000, def=44100.000]
synth.verbose            STR   [def='no']
synth.chorus.active      STR   [def='yes']
synth.effects-channels   INT   [min=2, max=2, def=2]
synth.gain               FLOAT [min=0.000, max=10.000, def=0.200]
synth.audio-channels     INT   [min=1, max=256, def=1]
synth.dump               STR   [def='no']
synth.audio-groups       INT   [min=1, max=256, def=1]
shell.prompt             STR   [def='']
shell.port               INT   [min=1, max=65535, def=9800]
 
1 members found this post helpful.
  


Reply

Tags
howto, midi, setup



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
HAL vs Xserver (/dev/input/mice?): convincing X to *not* use a given input device? stuartnlevy Linux - Desktop 6 01-24-2012 04:06 PM
creating MIDI notes from input events: which way to go? Nareto Programming 3 12-09-2011 07:42 AM
[SOLVED] Touchscreen input device not appearing in /dev/input rohshall Linux - Embedded & Single-board computer 4 08-21-2009 10:39 AM
Getting a USB device (touch screen here) to be recognized under /dev/input/ d2army Linux - Hardware 0 12-15-2008 01:26 PM
Set up midi device in suse 9.1 w/ AC'97 midi controller Guitarist88 Linux - Hardware 1 07-06-2004 03:09 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:46 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration