Guitar MIDI simulator
I must be crazy. I've never did multimedia programming before, and my first project is a guitar simulator. Why did I chose such a project? Well, I like to play MIDIs at home. I have a small collection of MIDI-Karaoke files, and we have fun singing in family. There are many MIDI Karaoke files out there, but in many cases the sound of the guitar is crap. Many people assume that it has to be so, but it isn't. The actual samples are pretty good. The problem is that most MIDI files just play the guitar part just like a piano. There is no dynamics; all the notes are hit at once. Rhythm guitar is not played flat, strings are strummed in sequence as the right hand goes down an up. The timing is essential to convey the rhythm.
There are actually a few professional tools to do it around the 'net. The best example that I could find is the Rhythm'n'Chords MIDI FX plug-in for Cakewalk Pro Audio. However, all these tools are proprietary and expensive. So I decided to give it a try.
Being my first incursion on multimedia programming, the first step was to actually learn a little about the basics - how good is the OS support for MIDI, and what are the libraries available. I found that I have indeed a few choices, but all with some type limitation. Most libraries that I've found are outdated, or not actively maintained. Some are Linux only, and I'm writing my code for Windows. And finally, the most up-to-date routines that I could find only work for MIDI files, and do not do real time MIDI playback.
For my initial tests, I decided upon using midipy, real-time MIDI input module for Python. It's not being maintained by its author, but it works; other people have recompiled it for newer versions of Python (I suspect that a new version could be made using simpler tools, by directly wrapping the Windows multimedia DLLs, but I don't have enough knowledge about how to do it). The reasoning behin this choice is simple: I would like to be able to hear my tests immediately, and all other approaches involve either writing MIDI files for playback, or low-level development. That's not the focus of the project - the focus is to understand how to simulate the sequence of events of a rhythm guitar being played.
The guitar itself is a simple class. Each string is treated independently, and there are separate methods for the left and right hands movements. The left hand moves to set up a new chord position. When a chord changes, the strings are muted, and each string is "tuned" to a particular tone. The left hand movement has several attributes that can be customized; the main ones are the speed at the which the hand traverses all strings, and the direction, that can be either "down" or "up". Depending on the direction, the strings are strummed in a different fashion. For both hands, the result is a sequence of timed events that can be played to give the illusion of a real guitar being played.
To synchronize the events, I used the threading module. The threads are started only after all events were generated, to avoid concurrency issues. The results are actually acceptable for a short sequence. There is some jitter, and large sequences don't play well due to interruptions and delays. The threading timer is not real time, and it not good enough for multimedia applications. But as a proof of concept, the project seems to be going well. I was able to write a fairly simple rhythm pattern that sounds just like someone learning to play guitar, which is more than I had expected after a few hours of programming.
I'm now at the point where I must take a decision. If I'm going to keep the real time interface, then I'll need to improve the timing. One alternative is to write my own multimedia event handlers, but I'm not sure if this is possible to do in Python; or I can try to use the Midi Stream API, but then I have to implement a wrapper for Python. The remaining alternative is to forget the real time MIDI playback for now, and write all stuff to MIDI files. This approach has the advantage of letting me concentrate on the guitar playing aspects of the simulator, but I lose interactivity. The testing of new rhytmic patterns may become more difficult, and some of the fun may go away, too. Let's ponder about it for a while before taking any decision.
There are actually a few professional tools to do it around the 'net. The best example that I could find is the Rhythm'n'Chords MIDI FX plug-in for Cakewalk Pro Audio. However, all these tools are proprietary and expensive. So I decided to give it a try.
Being my first incursion on multimedia programming, the first step was to actually learn a little about the basics - how good is the OS support for MIDI, and what are the libraries available. I found that I have indeed a few choices, but all with some type limitation. Most libraries that I've found are outdated, or not actively maintained. Some are Linux only, and I'm writing my code for Windows. And finally, the most up-to-date routines that I could find only work for MIDI files, and do not do real time MIDI playback.
For my initial tests, I decided upon using midipy, real-time MIDI input module for Python. It's not being maintained by its author, but it works; other people have recompiled it for newer versions of Python (I suspect that a new version could be made using simpler tools, by directly wrapping the Windows multimedia DLLs, but I don't have enough knowledge about how to do it). The reasoning behin this choice is simple: I would like to be able to hear my tests immediately, and all other approaches involve either writing MIDI files for playback, or low-level development. That's not the focus of the project - the focus is to understand how to simulate the sequence of events of a rhythm guitar being played.
The guitar itself is a simple class. Each string is treated independently, and there are separate methods for the left and right hands movements. The left hand moves to set up a new chord position. When a chord changes, the strings are muted, and each string is "tuned" to a particular tone. The left hand movement has several attributes that can be customized; the main ones are the speed at the which the hand traverses all strings, and the direction, that can be either "down" or "up". Depending on the direction, the strings are strummed in a different fashion. For both hands, the result is a sequence of timed events that can be played to give the illusion of a real guitar being played.
To synchronize the events, I used the threading module. The threads are started only after all events were generated, to avoid concurrency issues. The results are actually acceptable for a short sequence. There is some jitter, and large sequences don't play well due to interruptions and delays. The threading timer is not real time, and it not good enough for multimedia applications. But as a proof of concept, the project seems to be going well. I was able to write a fairly simple rhythm pattern that sounds just like someone learning to play guitar, which is more than I had expected after a few hours of programming.
I'm now at the point where I must take a decision. If I'm going to keep the real time interface, then I'll need to improve the timing. One alternative is to write my own multimedia event handlers, but I'm not sure if this is possible to do in Python; or I can try to use the Midi Stream API, but then I have to implement a wrapper for Python. The remaining alternative is to forget the real time MIDI playback for now, and write all stuff to MIDI files. This approach has the advantage of letting me concentrate on the guitar playing aspects of the simulator, but I lose interactivity. The testing of new rhytmic patterns may become more difficult, and some of the fun may go away, too. Let's ponder about it for a while before taking any decision.
25 Comments:
At October 30, 2006 at 8:04 PM, rjgeyer said…
Some articles on my blog about MIDI and guitar.
http://guitar-reviews.blogspot.com/
At December 16, 2006 at 2:01 PM, Anonymous said…
WARNING: A new immensely powerful viral marketing system has been released, which allows marketers to broadcast messages directly to people's desktops. Learn more about it here: internet wealth site. It pretty much covers internet wealth related stuff and it is FREE to join.
At January 23, 2007 at 11:03 PM, Anonymous said…
Cepasa amigos ))
Aciphex
Aciphex
http://www.yeshuanet.com/docs/images/Aciphex/index.html
__________________________
Tramadol
http://www.yeshuanet.com/docs/images/Tramadol/index.html
Tramadol
============================================
Bentyl
http://www.yeshuanet.com/docs/images/Bentyl/index.html
Bentyl
thx
At February 5, 2007 at 6:02 AM, Anonymous said…
Hi
Here you can find lots of information about pills.
--------------------------------------------------
D
denavir
detrol
diazepam
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
didrex
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
diflucan
diprolene
/////////////////////////////
dovonex
==================================
E
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
effexor
elidel
esgic
/////////////////////////////
estradiol
evista
famvir
==================================
F
fastin
fioricet
--------------------------------------------------
fiorinal
flexeril
flomax
flonase
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
fluconazole
fluoxetine
::::::::::::::::::::::::::::::::::::::::::::::
fosamax
G
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
gris
hoodia
==================================
M
imitrex
ionamin
kenalog
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
lamisil
levbid
levitra
--------------------------------------------------
lexapro
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
lipitor
lortab
::::::::::::::::::::::::::::::::::::::::::::::
meclizine
meridia
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
mircette
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cymbalta
--------------------------------------------------
PS
It would be interesting, if you'll post some more info about that pills.. thx
This is my university project )) Thank you for your post;)
your can mail me karlonushik@cashette.com
At February 5, 2007 at 10:55 AM, Anonymous said…
Hi
Here is some informational sources
/////////////////////////////
naprosyn
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
naproxen
nasacort
---------------------------------------------
nexium
==================================
N
nizoral
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
ortho
paroxetine
--------------------------------------------------
P
/////////////////////////////
penlac
percocet
/////////////////////////////
phendimetrazine
phentermine
prevacid
/////////////////////////////
prilosec
propecia
protopic
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
prozac
pyrethrin
ranitidine
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
remeron
retin
rozerem
seasonale
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
O
---------------------------------------------
sibutramine
singulair
::::::::::::::::::::::::::::::::::::::::::::::
skelaxin
soma
--------------------------------------------------
synalar
tamiflu
tetracycline
T
---------------------------------------------
tramadol
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cymbalta
/////////////////////////////
PPS
If I'll find something else, I'll post it here ))
your can mail me karlonushik@cashette.com
At February 6, 2007 at 4:52 AM, Anonymous said…
Hoy!
Here is some informational sources
tretinoin
triphasil
--------------------------------------------------
ultracet
ultram
valium
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
V
--------------------------------------------------
valtrex
vaniqa
vermox
::::::::::::::::::::::::::::::::::::::::::::::
viagra
vicodin
---------------------------------------------
watson
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
wellbutrin
xanax
yasmin
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
zanaflex
zelnorm
---------------------------------------------
zithromax
zocor
zoloft
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
zovirax
zyban
Z
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
zyloprim
zyrtec
::::::::::::::::::::::::::::::::::::::::::::::
/////////////////////////////
PPS
If I'll find something else, I'll post it here ))
Do you think it's helpful?
At February 11, 2007 at 7:11 PM, Anonymous said…
Do you know much about you helth??!! )
But we don't think about this?
Hi
fluoxetine
--------------------------------------------------
fosamax
gris
:::::::::::::::::::::::::::::::::::::::::::::::::
hoodia
>>>>>>>>>>>>>>>>>>>>>>>>>>>>
imitrex
:::::::::::::::::::::::::::::::::::::::::::::::::
ionamin
:::::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
kenalog
lamisil
_______________
levbid
levitra
!-!-!-!!-!-!-!!-!-!-!!-!-!-!!-!-!-!!-!-!-!
lexapro
lipitor
---------------------------------------------------------
lortab
meclizine
>>>>>>>>>>>>>>>>>>>>>>>>>>>>
meridia
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
mircette
naprosyn
************************************************
naproxen
nasacort
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
nexium
---------------------------------------------------------
nizoral
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
ortho
!-!-!-!!-!-!-!!-!-!-!!-!-!-!!-!-!-!!-!-!-!
paroxetine
`````````````````````````````
penlac
percocet
:::::;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
phendimetrazine
phentermine
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
prevacid
prilosec
************************************************
propecia
protopic
/////////////////////////////
prozac
pyrethrin
!-!-!-!!-!-!-!!-!-!-!!-!-!-!!-!-!-!!-!-!-!
ranitidine
remeron
>>>>>>>>>>>>>>>>>>>>>>>>>>>>
retin
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
PS
It would be interesting, if you'll post your thoughts about that pills.. thx
This is my university project )) Thank you for your post;)
At February 12, 2007 at 7:21 PM, Anonymous said…
Hi
teen sex cock drunk teen sex video
young blonde teen sex http://byronss.com.au/photos/images/smiles/temp/index.html --> teen sex post
spanish teen sex teen sex clips l
At February 13, 2007 at 10:18 AM, Anonymous said…
Hi
amateur free sex
amateur home movie
amateur pantie
-->http://info-graf.fr/forum/Themes/default/images/icons/temp/index.html
amateur naked
amateur photography
At February 14, 2007 at 2:39 AM, Anonymous said…
Do you know much about you helth??!! )
So why So should we??
Hello
Here is some pills-info links
--------------------------------------------------
acetaminophen
_______________
acetazolamide
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
acetylcysteine
--------------------------------------------------
acetylsalicylic
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
aciphex
_______________
acyclovir
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
adipex
_______________
aldara
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
alesse
allegra
!-!-!-!!-!-!-!!-!-!-!!-!-!-!!-!-!-!!-!-!-!
allopurinol
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
amitriptyline
amoxicillin
--------------------------------------------------
antivert
ativan
!-!-!-!!-!-!-!!-!-!-!!-!-!-!!-!-!-!!-!-!-!
bentyl
biaxin
bontril
`````````````````````````````
bupropion
_______________
buspar
\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
buspirone
butalbital
carisoprodol
/////////////////////////////
celebrex
celexa
!-!-!-!!-!-!-!!-!-!-!!-!-!-!!-!-!-!!-!-!-!
cialis
_______________
PS
It would be great, if you'll post some more info about that pills.. thx
This is my university project )) Thank you for your post;)
At February 15, 2007 at 3:45 PM, Anonymous said…
Good day to Everybody
his first gay sex
free gay porn video-->http://gp2brew.com/images/smilies/temp
gay chat
At February 17, 2007 at 12:19 PM, Anonymous said…
Hi
nympho teen sex [url=http://byronss.com.au/photos/images/smiles/temp/index.html] pree teen sex [/url]
oriental teen sex http://byronss.com.au/photos/images/smiles/temp/index.html --> collage teen sex
teen sex moviescom free young teen sex clip l
At February 20, 2007 at 11:04 AM, Anonymous said…
Hi
school bus teen sex [url=http://byronss.com.au/photos/images/smiles/temp/index.html] teen sex acts [/url]
cute teen sex pictures http://byronss.com.au/photos/images/smiles/temp/index.html --> true
teen sex story
teen sex nude porn pic interracial anal teen sex l
At April 28, 2007 at 7:08 AM, Anonymous said…
mortgage refinancing
refinance
home mortgage refinance
refinance loan
auto refinance
refinance mortgage loan
bad credit refinance
refinance rate
home mortgage refinance loan
refinance mortgage rate
california refinance
bad credit mortgage refinance
texas mortgage refinance
refinance second mortgage
florida refinance mortgage
mortgage refinance california
home refinance rate
refinance mortgage interest rate
in refinance
florida refinance
refinance home mortgage rate
business refinance
home loan mortgage refinance loan
auto loan refinance
interest only refinance
refinance interest rate
no closing cost refinance
michigan mortgage refinance
lowest refinance rate
california mortgage refinance loan
refinance house
florida home refinance
refinance home mortgage interest rate
refinance student loan
california refinance home mortgage
bad credit refinance loan
refinance home mortgage home equity loan
refinance san diego
va refinance
refinance 2nd mortgage
mortgage refinance online
refinance comparison
va loan refinance
best refinance mortgage rate
california refinance loan
low refinance rate
poor credit refinance
florida refinance mortgage rate
debt consolidation refinance
cash out refinance
refinance loan rate
home equity mortgage refinance loan
ohio mortgage refinance
refinance after bankruptcy
best refinance mortgage
california mortgage rate refinance
home refinance bad credit
life refinance suv
refinance bankruptcy
houston refinance
mortgage loan refinance florida
california home loan refinance
refinance home equity
bad credit home loan refinance
refinance mortgage new jersey
mortgage refinance lowest rate
refinance mobile home
no credit refinance small business loan
refinance mortgage application
refinance jacksonville
current mortgage refinance rate
miami refinance
mortgage refinance calculator
loan mortgage rate refinance
va home loan refinance
michigan refinance
no cost refinance
mortgage refinance company
mortgage loan refinance and debt consolidation
auto lease refinance
home refinance california
refinance mortgage quote
refinance quote
refinance orlando
small business refinance
refinance company
michigan refinance mortgage loan
norfolk refinance
foreclosure refinance
refinance lender
new york refinance
home loan refinance rate
refinance honolulu
best refinance
business debt refinance
countrywide home loan refinance
refinance dallas
best refinance rate
free quote on refinance
mortgage refinance information
At August 7, 2012 at 1:32 PM, pay per head horse racing said…
Nice and fantastic post... thank you very much to do this and thanks for sharing this with us.
At January 3, 2013 at 9:18 PM, Anonymous said…
I don't even know the way I finished up here, but I thought this publish used to be great. I do not know who you are but certainly you're going
to a famous blogger if you happen to aren't already. Cheers!
My weblog ... Lexington Law
At January 6, 2013 at 4:41 AM, Anonymous said…
Malaysia & Singapore & brunei best on-line blogshop for wholesale & supply korean add-ons, accessories, earstuds, pendant, rings, bangle, hair & bracelet accessories.
Promotion 35 % wholesale discount. Ship Worldwide
Also visit my blog post Baby Onesies
At January 6, 2013 at 9:38 AM, Anonymous said…
Malaysia & Singapore & brunei best internet blogshop for wholesale & quantity korean add-ons, earrings,
earstuds, pendant, rings, bracelet, hair & bangle accessories.
Promotion 35 % wholesale rebate. Ship Worldwide
Have a look at my weblog : treinamento cerebral
At January 9, 2013 at 2:01 PM, Anonymous said…
Malaysia & Singapore & brunei finest on the internet blogshop for wholesale & quantity korean
accessories, accessories, earstuds, locket, rings, trinket, bracelet
& hair add-ons. Offer 35 % wholesale rebate. Ship Worldwide
Feel free to surf my homepage ; locksmith salt lake city
At February 12, 2013 at 10:31 AM, Anonymous said…
clomid steroid | [url=http://ordergenericclomid.webs.com/#44439]clomid tabs[/url] - cheap clomid online, mryd ovulation while on clomid
At May 31, 2013 at 8:10 AM, Anonymous said…
This is the right website for anyone who really wants to understand this
topic. You understand a whole lot its almost tough to argue with you (not that
I personally would want to…HaHa). You definitely
put a fresh spin on a subject that has been discussed for decades.
Wonderful stuff, just wonderful!
Also visit my webpage ... hotgirlsexcam.com
At May 31, 2013 at 5:35 PM, Anonymous said…
Thank you a bunch for sharing this with all folks you really know what you're talking about! Bookmarked. Please also visit my website =). We may have a hyperlink exchange arrangement between us
Look at my blog; http://sexygirlchat.net
At March 4, 2016 at 7:55 PM, Anonymous said…
ninest123 16.03
prada outlet, nike outlet, longchamp outlet, burberry outlet, gucci handbags, ralph lauren polo, cheap jordans, louis vuitton outlet, louis vuitton outlet online, oakley sunglasses, uggs on sale, louis vuitton outlet, tiffany jewelry, replica watches, ralph lauren outlet, michael kors outlet, longchamp outlet, cheap oakley sunglasses, ray ban sunglasses, michael kors handbags, replica watches, michael kors outlet online, oakley sunglasses, uggs on sale, louboutin shoes, christian louboutin, ray ban sunglasses, uggs outlet, nike free, christian louboutin, uggs outlet, tiffany jewelry, nike air max, oakley sunglasses, longchamp bags, uggs on sale, michael kors outlet online, michael kors outlet online, nike air max, louis vuitton handbags, oakley sunglasses, louis vuitton, ray ban sunglasses, louboutin uk, michael kors, tory burch outlet, burberry factory outlet, prada handbags
At March 4, 2016 at 8:01 PM, Anonymous said…
swarovski jewelry, coach outlet, links of london uk, canada goose, canada goose pas cher, moncler, barbour, ugg pas cher, louis vuitton, supra shoes, converse, wedding dresses uk, pandora charms, canada goose uk, karen millen uk, ugg,uggs,uggs canada, canada goose outlet, louis vuitton uk, pandora uk, replica watches, moncler, moncler pas cher, ugg,ugg australia,ugg italia, moncler, swarovski uk, canada goose outlet, canada goose jackets, moncler, converse shoes outlet, bottes ugg pas cher, barbour jackets uk, canada goose jackets, hollister, marc jacobs, thomas sabo uk, ugg uk, toms shoes, moncler uk, sac louis vuitton, sac louis vuitton, gucci, pandora jewelry, moncler jackets, juicy couture outlet, pandora jewelry, montre pas cher, juicy couture outlet, canada goose, louis vuitton, moncler outlet, ray ban, lancel
ninest123 16.03
At December 14, 2016 at 9:45 PM, chenlina said…
ugg outlet
cheap jordans
coach outlet
nba jerseys
ugg boots paris
coach outlet online
retro jordans
oakley sunglasses
uggs outlet
oklahoma city thunder jerseys
chenlina20161215
Post a Comment
<< Home