how to turn a midi keyboard into an electronic piano

View: New views
16 Messages — Rating Filter:   Alert me  

how to turn a midi keyboard into an electronic piano

by Zhang Weiwu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello. I have a midi keyboard, once connected to my PC, cat /dev/midi
would produce junk text when I press the keys, thus I consider it
properly installed.

And the PC runs Debian Lenny, timidity runs by /etc/init.d/timidity, and
pmidi -p128:0 plays midi files just fine, so I think midi output is
working.

Now I am trying to connect the two, with the intention to use midi
keyboard + PC as an electronic piano. I hope I can start to play without
any feature like recording, mixing, composing, showing musical notes etc
and get to know other features slowly (really slow, I hope I can manage
other technical in one year or so) so i want to avoid diving into
complicated software like RoseGarden (it require jackd which is damn
difficult to get working right and stable on my PC, tired 2 days!
consider I am 4-year experienced Linux sysadmin this is really
difficult). is there a way to simply "connect" midi keyboard with a
minimal software that can play it?

A traditional Linux user would imagine:
$ something < /dev/midi > timidity
would work, after googling it seems obvious musician/geek think
differently.

Thanks in advance for hints!

P.S. I tried several days to run MusE/RoseGarden/seq24 while could not
making them work, and frustrated knowing what I need is only a fraction
of what these software I am working on.


------------------------------------------------------------------------------
_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk

Re: how to turn a midi keyboard into an electronic piano

by bvdp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I didn't know you could do this ... but you can. Easy.

1. Startup timidity as a sequencer client.

         timidity -iA &

2. Determine what ports you have. Use aplaymidi -l (aconnect -l doesn't work on my box). I have a number of timidity ports 128:0, 128:1, etc and a port for my keyboard 16:0

3. Connect the keyboard and timidity ports (this is probably the step you missed). In my case:

    aconnect 16:0 128:0

Now play the keyboard. Timidity plays the sounds.

Cool.


On Sat, Jul 4, 2009 at 3:35 AM, Zhang Weiwu <zhangweiwu@...> wrote:
Hello. I have a midi keyboard, once connected to my PC, cat /dev/midi
would produce junk text when I press the keys, thus I consider it
properly installed.


--
**** Listen to my CD at http://www.mellowood.ca/music/cedars ****
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bob@...
WWW:   http://www.mellowood.ca

------------------------------------------------------------------------------

_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk

Re: how to turn a midi keyboard into an electronic piano

by Marcin 'Rambo' Roguski :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

>     aconnect 16:0 128:0

Alternatively there's a small utility called
alsa-patch-bay that does it in GUI

------------------------------------------------------------------------------
_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk

Re: how to turn a midi keyboard into an electronic piano

by bvdp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Of course, the biggest problem with all this is that even on a fast machine the latency will kill you. Takes me less than 10 notes to be 1/4 second ahead/behind. Does it work any better with jack?

On Sat, Jul 4, 2009 at 10:37 AM, Marcin 'Rambo' Roguski <rambo@...> wrote:
>     aconnect 16:0 128:0

Alternatively there's a small utility called
alsa-patch-bay that does it in GUI

------------------------------------------------------------------------------
_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk



--
**** Listen to my CD at http://www.mellowood.ca/music/cedars ****
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bob@...
WWW:   http://www.mellowood.ca

------------------------------------------------------------------------------

_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk

Re: how to turn a midi keyboard into an electronic piano

by Zhang Weiwu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message



On Sat, 4 Jul 2009, Bob van der Poel wrote:

> Of course, the biggest problem with all this is that even on a fast machine the latency will
> kill you. Takes me less than 10 notes to be 1/4 second ahead/behind. Does it work any better
> with jack?

Thank you very much for all of your reply. Without your help I probably
would have to dig documents and manage to figure out after a huge learning
curve of RoseGarden first.

My jack sound server stop working when some application used it for
several miniutes or when it quits and second application start to use it.

I don't get the reason for latency. In my guess alsa shouldn't have big
latency because when I play first person shooter games the game require
latency less than 25ms otherwise there could be seriouls mistake aiming
and shooting, and alsa did that without jackd. What's hindering alsa
performance when it comes to midi that it latences 250ms?


Thanks.
Zhang Weiwu

------------------------------------------------------------------------------
_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk

Re: how to turn a midi keyboard into an electronic piano

by bvdp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

No idea what the latency issue is. Honestly, this is the big reason I don't use computers for recording. Too damn annoying for me. I prefer to record using my MR8 or Zoom H4 and then copying the files to the computer. Now I can edit tracks, etc. to my heart's delight and not worry about jack aborting, latency issues, etc.

Maybe someday I'll understand why a cheap 8 bit cpu in a dedicated device can do just fine ... and my quad core super-duper-cpu can't keep up. Progress, I guess.


On Sat, Jul 4, 2009 at 5:24 PM, Zhang Weiwu <zhangweiwu@...> wrote:


On Sat, 4 Jul 2009, Bob van der Poel wrote:

Of course, the biggest problem with all this is that even on a fast machine the latency will
kill you. Takes me less than 10 notes to be 1/4 second ahead/behind. Does it work any better
with jack?

Thank you very much for all of your reply. Without your help I probably would have to dig documents and manage to figure out after a huge learning curve of RoseGarden first.

My jack sound server stop working when some application used it for several miniutes or when it quits and second application start to use it.

I don't get the reason for latency. In my guess alsa shouldn't have big latency because when I play first person shooter games the game require latency less than 25ms otherwise there could be seriouls mistake aiming and shooting, and alsa did that without jackd. What's hindering alsa performance when it comes to midi that it latences 250ms?


Thanks.
Zhang Weiwu



--
**** Listen to my CD at http://www.mellowood.ca/music/cedars ****
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bob@...
WWW:   http://www.mellowood.ca

------------------------------------------------------------------------------

_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk

Re: how to turn a midi keyboard into an electronic piano

by wataru.em :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi.

>Date: Sun, 5 Jul 2009 08:24:44 +0800 (CST)
>From: Zhang Weiwu <zhangweiwu@...>
>Subject: Re: [timidity-talk] how to turn a midi keyboard into an electronic
> piano
>
> What's hindering alsa
>performance when it comes to midi that it latences 250ms?

TiMidity++ seems not to be designed for realtime MIDI playing,
tuned for midi file player, midi-to-wav converter.

Under WinXP, -q and -B option , and ASIO interface, will
make slightly better response, but, delay kills me playing
realtime with MIDI keys.:-p
# even CPU usages quite below 100%.

I've tried fluidsynth/qsynth, which seems to respond better
than TiMidity++ for realtime MIDI key playing.
# even under windows sound driver on WinXP.
# May be more better response on Linux box.

Hardware MIDI box did more better work (better response)
for realtime playing. (even MIDI signal path thru WinXP
box and returned to Hardware MIDI box.)
# compared with qsynth on WinXP.

--
wataru_em, Holiday Keyboard player.:-)


------------------------------------------------------------------------------
_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk

Re: how to turn a midi keyboard into an electronic piano

by wataru.em :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi. (again?)

>Date: Sun, 5 Jul 2009 08:24:44 +0800 (CST)
>From: Zhang Weiwu <zhangweiwu@...>
>Subject: Re: [timidity-talk] how to turn a midi keyboard into an electronic
> piano
>
> What's hindering alsa
>performance when it comes to midi that it latences 250ms?

TiMidity++ seems not to be designed for realtime MIDI playing,
tuned for midi file player, midi-to-wav converter.

Under WinXP, -q and -B option , and ASIO interface, will
make slightly better response, but, delay kills me playing
realtime with MIDI keys.:-p
# even CPU usages quite below 100%.

I've tried fluidsynth/qsynth, which seems to respond better
than TiMidity++ for realtime MIDI key playing.
# even under windows sound driver on WinXP.
# May be more better response on Linux box.

Hardware MIDI box did more better work (better response)
for realtime playing. (even MIDI signal path thru WinXP
box and returned to Hardware MIDI box.)
# compared with qsynth on WinXP.

--
wataru.em, Holiday Keyboard player.:-)


------------------------------------------------------------------------------
_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk

Re: how to turn a midi keyboard into an electronic piano

by Zhang Weiwu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bob van der Poel wrote:

> I didn't know you could do this ... but you can. Easy.
>
> 1. Startup timidity as a sequencer client.
>
>          timidity -iA &
>
> 2. Determine what ports you have. Use aplaymidi -l (aconnect -l
> doesn't work on my box). I have a number of timidity ports 128:0,
> 128:1, etc and a port for my keyboard 16:0
>
> 3. Connect the keyboard and timidity ports (this is probably the step
> you missed). In my case:
>
>     aconnect 16:0 128:0
Now I am sure my timidity output port is 128:0 to 128:3 but how do I
know for sure my input device ID? I have /dev/midi that pops up
character when I press the keyboard so I know it is the input device,
but aconnect recognize only numeric device number.

Here is my system:

zhangweiwu@zobeide:~$ aconnect -i
client 0: 'System' [type=kernel]
    0 'Timer           '
    1 'Announce        '
client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 16: 'Yamaha OPL3-SA23' [type=kernel]
    0 'Yamaha OPL3-SA23 MIDI'
zhangweiwu@zobeide:~$ aconnect -o
client 14: 'Midi Through' [type=kernel]
    0 'Midi Through Port-0'
client 16: 'Yamaha OPL3-SA23' [type=kernel]
    0 'Yamaha OPL3-SA23 MIDI'
client 17: 'OPL3 FM synth' [type=kernel]
    0 'OPL3 FM Port    '
client 128: 'TiMidity' [type=user]
    0 'TiMidity port 0 '
    1 'TiMidity port 1 '
    2 'TiMidity port 2 '
    3 'TiMidity port 3 '


I thought 14:0 is my output device and tested doing aconnect on it, result: no sound output.


By the way, what does the port "Yamaha OPL3-SA23" and "OPL3 FM synth"
mean? Does that mean I can play midi without using timidity? I tried to
pmidi with both device and can hear nothing.

------------------------------------------------------------------------------
_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk

Re: how to turn a midi keyboard into an electronic piano

by wataru.em :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Guessing your hardware configuration from aconnect
info.

GUESS:
--------------
  [midi key]==(midi cable)==[<MIDI card> desktop PC]
--------------
 MIDI card: OPL3-SA23 chip, MIDI in/out connecter.

>zhangweiwu@zobeide:~$ aconnect -i
>client 16: 'Yamaha OPL3-SA23' [type=kernel]
>    0 'Yamaha OPL3-SA23 MIDI'

This seems MIDI-input of your MIDI soundcard,
which is wired to your MIDI-input connecter
of your MIDI card.

>zhangweiwu@zobeide:~$ aconnect -o
>client 16: 'Yamaha OPL3-SA23' [type=kernel]
>    0 'Yamaha OPL3-SA23 MIDI'

This seems MIDI-output of your MIDI card,
which is wired to your MIDI-output connecter
of your MIDI card.

>client 17: 'OPL3 FM synth' [type=kernel]
>    0 'OPL3 FM Port    '

This seems FM sound chip interface on your MIDI card.
May need FM sound driver/application to use this.

>client 128: 'TiMidity' [type=user]
>    0 'TiMidity port 0 '
>    1 'TiMidity port 1 '
>    2 'TiMidity port 2 '
>    3 'TiMidity port 3 '

TiMidity's MIDI-input is here.
4port is waiting for MIDI input.

>I thought 14:0 is my output device and tested doing aconnect on it, result: n
o sound output.

16:0 seems your MIDI input and output.

So,
>>     aconnect 16:0 128:0
may help you.

--
wataru_em, Holiday Keyboard player.:-)


------------------------------------------------------------------------------
_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk

Re: how to turn a midi keyboard into an electronic piano

by Zhang Weiwu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

wataru.em@... wrote:
>>>     aconnect 16:0 128:0
>>>      
> may help you.
>  
Thanks for your detailed and clear answer. Now I made it working! Great.

The latency is less than 250ms in my case, but I cannot tell how much. I
guess less than 80ms because my ear could not tell the difference of
less than 80ms yet, so to me it is almost realtime.

------------------------------------------------------------------------------
_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk

Re: how to turn a midi keyboard into an electronic piano

by bvdp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Interesting about the latency. Could you share with the rest of us how you're doing this? Are you hitting a number of keys or just plinking one by one?

Oh, and what soundfont? I'm using a very large (good sounding) piano font ... and it's size might have a bearing. When I get a chance I should try with a short, crappy sounding one.

Glad it's working for you.

On Sun, Jul 5, 2009 at 8:00 PM, Zhang Weiwu <zhangweiwu@...> wrote:
wataru.em@... wrote:
>>>     aconnect 16:0 128:0
>>>
> may help you.
>
Thanks for your detailed and clear answer. Now I made it working! Great.

The latency is less than 250ms in my case, but I cannot tell how much. I
guess less than 80ms because my ear could not tell the difference of
less than 80ms yet, so to me it is almost realtime.

------------------------------------------------------------------------------
_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk



--
**** Listen to my CD at http://www.mellowood.ca/music/cedars ****
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bob@...
WWW:   http://www.mellowood.ca

------------------------------------------------------------------------------

_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk

Re: how to turn a midi keyboard into an electronic piano

by Zhang Weiwu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Bob van der Poel wrote:
> Interesting about the latency. Could you share with the rest of us how
> you're doing this? Are you hitting a number of keys or just plinking
> one by one?
>
It isn't really useful to share this I guess, because my set up crashes
if I hit a dozen keys or so, either plinking one by one or hitting more
keys together.
> Oh, and what soundfont? I'm using a very large (good sounding) piano
> font ... and it's size might have a bearing. When I get a chance I
> should try with a short, crappy sounding one.
I don't know how to get a sound font yet! Can you send the address to
download your sound file, if it is free of charge?

I did not use any sound font. timidity installation depends on freepat
package which introduced a lot of .pat files which I guess is used to
produce the sound, but the files' name doesn't end with .sf2

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk

Re: how to turn a midi keyboard into an electronic piano

by Zhang Weiwu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Zhang Weiwu wrote:

> Bob van der Poel wrote:
>  
>> Interesting about the latency. Could you share with the rest of us how
>> you're doing this? Are you hitting a number of keys or just plinking
>> one by one?
>>
>>    
> It isn't really useful to share this I guess, because my set up crashes
> if I hit a dozen keys or so, either plinking one by one or hitting more
> keys together.
>  
Forgot to mention, I uncommented the lines in /etc/timidity/timidity.cfg
that says should be uncommented for slow machine.

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk

Re: how to turn a midi keyboard into an electronic piano

by bvdp :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I don't recall where I got these. Best to do a google search (I just entered SGM-V2.01.sf2 into google and a wack of results ... the file is about 100meg, compressed. ... anyone know of a better, free, font please let me know!) As I recall, I had to get the file in chunks and then merge it ... but it's been several years. It does sound pretty decent to me. To use just make the following changes to the /etc/timidity/timidity.cfg file.

#source /etc/timidity/freepats.cfg
soundfont /home/bob/sounds/sfx-lib/SGM-V2.01.sf2  #where you file is stored!

But it's funny ... I can't get it to work at all tonight. But, it's not that worthwhile to try either.

I use timidity to play my MMA generated background tracks when I'm using my laptop as a device on small/solo gigs I do with my sax. With the SGM font package the sounds are quite decent.


> It isn't really useful to share this I guess, because my set up crashes
> if I hit a dozen keys or so, either plinking one by one or hitting more
> keys together.
>
Forgot to mention, I uncommented the lines in /etc/timidity/timidity.cfg
that says should be uncommented for slow machine.



--
**** Listen to my CD at http://www.mellowood.ca/music/cedars ****
Bob van der Poel ** Wynndel, British Columbia, CANADA **
EMAIL: bob@...
WWW:   http://www.mellowood.ca

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk

Re: how to turn a midi keyboard into an electronic piano

by Eric Welsh :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, 7 Jul 2009, Zhang Weiwu wrote:

> Forgot to mention, I uncommented the lines in /etc/timidity/timidity.cfg
> that says should be uncommented for slow machine.

I haven't tried using it with a realtime keyboard interface in Linux, but
I've been using it as a softsynth in Windows for general midi playback.
I don't know about latency issues, but it plays back smoothly for me on my
ancient box (circa 2001).  I've been using the following timidity.cfg
options:

#extension opt -s 44100
#extension opt -f
#extension opt -EFresamp=L
#extension opt -EFreverb=4,21
#extension opt -EFns=0
#extension opt -m 3000
#extension opt -p 256
#extension opt -EFchorus=2

Cut the sample rate from 48000 to 44100 to save some CPU, use the fast
decay rate (sounds better to me, will save CPU too), use Lagrange
interpolation (way faster than default Gauss-like), use the 4th reverb
mode with a global level of 21 (global is way faster than the default
per-channel mode), disable noise shaping (I think it sounds better off,
should save CPU too), set a 3 second downramp on pedal sustains to
prevent "stuck" pedals, make sure polyphony is set to max to prevent
prematurely discarded notes, and choose the pseudo-surround chorus mode
(your preference may vary, I think it's probably slower than the default
chorus mode too).  Setting -EFreverb=0 and/or -EFchorus=0 to disable
reverb or chorus will of course save CPU too.  I don't know if it will
help with latency or not, but it might be worth a try.

-Eric

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
Timidity-talk mailing list
Timidity-talk@...
https://lists.sourceforge.net/lists/listinfo/timidity-talk