DIYstompboxes.com

DIY Stompboxes => Digital & DSP => Topic started by: Mark Hammer on November 02, 2009, 01:07:26 PM

Title: Guitar-to-MIDI project article
Post by: Mark Hammer on November 02, 2009, 01:07:26 PM
...in the October (current ...or recent...or last month's...or soon to arrive....depending on where you live) issue of Everyday Practical Electronics.  It uses a 16F88 PIC and is mono.  While mono is a bit of a constraint, this is a pretty darn simple project by any standards.  Just 2 or 3 chips and a couple of jacks.  This project and a cheap 2nd hand tone generator (I've bought General MIDI tone generators for as little as $25 new) and you have a pretty inexpensive introduction to the world of guitar synths.

Their portal is here: http://www.epemag3.com/  The hex code for programming the PIC can be found here: http://www.epemag3.com/index.php?option=com_docman&task=cat_view&gid=52&Itemid=38
Title: Re: Guitar-to-MIDI project article
Post by: carrejans on November 02, 2009, 01:19:59 PM
Quote from: Mark Hammer on November 02, 2009, 01:07:26 PM
...in the October (current ...or recent...or last month's...or soon to arrive....depending on where you live) issue of Everyday Practical Electronics.  It uses a 16F88 PIC and is mono.  While mono is a bit of a constraint, this is a pretty darn simple project by any standards.  Just 2 or 3 chips and a couple of jacks.  This project and a cheap 2nd hand tone generator (I've bought General MIDI tone generators for as little as $25 new) and you have a pretty inexpensive introduction to the world of guitar synths.

Their portal is here: http://www.epemag3.com/  The hex code for programming the PIC can be found here: http://www.epemag3.com/index.php?option=com_docman&task=cat_view&gid=52&Itemid=38

I'm very interested in this.
What's the problem with mono? A guitar is always mono, no?

So, this works without a midi pickup? I really wanna know how this thing functions; and especially how good/bad.

I just tried to order the issue.  :-[ They only accept credit card; and I don't have one.  :-\



Title: Re: Guitar-to-MIDI project article
Post by: Taylor on November 02, 2009, 01:46:40 PM
Quote from: carrejans on November 02, 2009, 01:19:59 PM
I'm very interested in this.
What's the problem with mono? A guitar is always mono, no?

So, this works without a midi pickup? I really wanna know how this thing functions; and especially how good/bad.

He means monophonic, that is, only one note at a time, rather than monaural (coming from only one speaker). It works without a midi pickup because it can only interpret one note at a time. MIDI pickups are just 6 tiny magnetic pickups; there isn't any MIDI conversion going into the pickup, all it does is split the 6 strings into separate channels, so the processor can sense them separately.

So this very neat project would be good for leads, basses, etc. but no good for chords.
Title: Re: Guitar-to-MIDI project article
Post by: carrejans on November 02, 2009, 02:46:09 PM
Quote from: Taylor on November 02, 2009, 01:46:40 PM
Quote from: carrejans on November 02, 2009, 01:19:59 PM
I'm very interested in this.
What's the problem with mono? A guitar is always mono, no?

So, this works without a midi pickup? I really wanna know how this thing functions; and especially how good/bad.

He means monophonic, that is, only one note at a time, rather than monaural (coming from only one speaker). It works without a midi pickup because it can only interpret one note at a time. MIDI pickups are just 6 tiny magnetic pickups; there isn't any MIDI conversion going into the pickup, all it does is split the 6 strings into separate channels, so the processor can sense them separately.

So this very neat project would be good for leads, basses, etc. but no good for chords.

Oh, off course. I thought of mono as the opposite of stereo.
So, you could use a larger PIC (if necessary), and copy the code 6 times; and use a hexaphonic pickup.

Mark, maybe you can send me a copy of the article? I will send some germaniums to you...  :)
Title: Re: Guitar-to-MIDI project article
Post by: Mark Hammer on November 02, 2009, 02:52:13 PM
...and while I wish I could say that it is so simple that there is no reason why you couldn't make six of them and slave them to a hex pickup, the reality is that they would stilll remain 6 mono signals, and not one integrated signal conveying information about 6 pitches.  This means that you would need to use 6 tone generators feeding a mixer, which tends to negate the cost-effective aspect a bit!  Could you integrate all 6 signals within a single PIC?  I suppose, but you'd have to do the code development yourself, instead of using their PCB layout and already-develped code.

That being said, give a listen to all those classic Pat Metheny recordings in which he uses a Synclavier or Roland synth, and 95% of it is single-note runs.  So, if you were planning on using synth for polyphonic "washes" or pads, fuggedaboudit.  If you were interested in playing flute or trumpet lines, though, this EPE project would be the ticket.
Title: Re: Guitar-to-MIDI project article
Post by: carrejans on November 02, 2009, 02:55:33 PM
Quote from: Mark Hammer on November 02, 2009, 02:52:13 PM
...and while I wish I could say that it is so simple that there is no reason why you couldn't make six of them and slave them to a hex pickup, the reality is that they would stilll remain 6 mono signals, and not one integrated signal conveying information about 6 pitches.

I never used MIDI, don't know how the signal looks like.
But I guess it's not that hard to make the 6 midi signals, just 1. No?
Title: Re: Guitar-to-MIDI project article
Post by: scratch on November 02, 2009, 09:17:45 PM
Mark, is this issue out in newstands now?

Sounds interesting ... I've got one of those cheap GM modules (actually it's my wife's ;-) I could use.
Title: Re: Guitar-to-MIDI project article
Post by: Mark Hammer on November 03, 2009, 07:58:42 AM
It's out in Ottawa now, at least.  I saw it while flipping through mags at Chapters 2 days ago.
Title: Re: Guitar-to-MIDI project article
Post by: markeebee on November 03, 2009, 10:35:25 AM
Thanks Mark, you may have saved me a wedge of cash.

I was about to order one of these guitar-to-midi converters:

http://www.dolphinmusic.co.uk/product/39923-sonuus-g2m.html (http://www.dolphinmusic.co.uk/product/39923-sonuus-g2m.html)

But instead I've just ordered a back issue of the mag. 
Title: Re: Guitar-to-MIDI project article
Post by: scratch on November 04, 2009, 11:08:52 PM
Mark,

thanks for the heads up, managed to get out at lunch today and pick up a copy. Not much to the circuit itself, going to have to download the code and get me a programmer ...

More stuff I don't have time to play with ...
Title: Re: Guitar-to-MIDI project article
Post by: Marcvv on November 05, 2009, 02:40:42 AM
Quote from: Mark Hammer on November 02, 2009, 02:52:13 PM
.
This means that you would need to use 6 tone generators feeding a mixer, which tends to negate the cost-effective aspect a bit!  

But maybe you are forgetting that that is why multi-timbral modules solved that solution already a while ago: each string its own midi channel and voila....

Best, Marc
Title: Re: Guitar-to-MIDI project article
Post by: Kon_fuciĆ³n on November 06, 2009, 08:47:15 PM
Being a King Crimson fan and seeing Robert Fripp play with hes MIDI gear, made me wanna do something like this. Thanks Mark, you are always helpful, in the right place at the right time. Every advice from you has always nailed it.
Too bad they used a PIC. It would have been a good idea to use an AVR with the USB implementation.
Im gonna go keep reading the magazine.
Title: Re: Guitar-to-MIDI project article
Post by: Tonemonger on November 12, 2009, 10:20:41 AM
Hmm! I should check out this section of the site more often.
I just bought the Sonus unit that Markeebee referred to YESTERDAY !
Still , for $Aud150 I'm pretty damn happy.
Title: Re: Guitar-to-MIDI project article
Post by: potul on November 17, 2009, 12:11:17 PM
Good heads up!

I bought the magazine some days ago and took a look at the project. I was surprised to see there is no hardware filtering of the signal before inputting it into the PIC, just some amplification.
All filtering is done by the software. In case you're interested, the software is basically doing a "zero count" algorithm at the beginning of the note to determine the pitch, and then tracking the amplitude to decide when the notes ends or a new note comes in. The "zero count" is using some thresholds to ensure only relevant harmonic is counted.

I'm planning to test it this week, and probably modify the project to see if I can get a decent chromatic tuner as well.

Potul
Title: Re: Guitar-to-MIDI project article
Post by: potul on November 19, 2009, 12:13:58 PM
I breadboarded it tonight, and it works fine, at least it works as I expected it to work after reading the code.

-Tracking is not perfect (having the guitar in tune helps, though :P )
-You need to pick very cleanly.
-The unit is only tracking pitch at the attack of the note, so if after picking you modify the pitch (bending, slide, pull up...), it is not tracked.
-Volume of the note attack is translated into midi note velocity. But velocity is constant until note fades.

Not bad, considering that I skipped the part of the circuit that references the ADC max and min, so probably accuracy can be improved in the final build.
I will investigate if adding some filtering by hardware, the tracking can be improved.
Modify it to have bend tracking will be tricky... because of the way the algorithm works. It tracks pitch at the note attack on purpose to avoid harmonics... so if we continuously track pitch, probably will have wrong pitch detected at the note decay. And, if we add a schmidt trigger type of filter to focus on the main harmonic, we will lose the dynamics.

I cannot compare with the Sonnus G2M, because I have never tried it.

Going back to the hex pickup topic, IMHO if you use a PIC with enough ADC inputs (6), it should not be an issue to modify the code to "mix" the midi signals of each string. The timing could be challenging, though (you have to be tracking pitch in all strings at the same time, or "multiplexed"). But taking into account that in this project the PIC works at 4Mhz  but it could be configured up to 20Mhz, the PIC should be able to handle the workload (although the ADC could be the bottleneck if it is shared by the inputs).

Potul
Title: Re: Guitar-to-MIDI project article
Post by: Mark Hammer on November 19, 2009, 01:55:01 PM
Wow.  I'm impressed by the diligence of your response to the entire topic.  Many thanks.  not only from me, but I'm sure from many others as well. :icon_biggrin:

Mark
Title: Re: Guitar-to-MIDI project article
Post by: space_ryerson on November 19, 2009, 03:32:31 PM
Yes, thank you Potul!

I bought the pdf version of the issue, and am reading it over. My wife plays synth and bass, so it may be a perfect fit for her :)
Title: Re: Guitar-to-MIDI project article
Post by: potul on November 19, 2009, 05:20:55 PM
Quote from: space_ryerson on November 19, 2009, 03:32:31 PM
Yes, thank you Potul!

I bought the pdf version of the issue, and am reading it over. My wife plays synth and bass, so it may be a perfect fit for her :)

I didn't know you could buy the issue in pdf! I didn't see this option when I ordered my hardcopy one  ??? ... I had to wait to have it mailed to me  :icon_cry:  (an I live in Spain... )

Once I have it built I will post some pics and samples, if it is useful, and eventually an alternative layout and any mod I may apply.

Potul
Title: Re: Guitar-to-MIDI project article
Post by: Jaicen_solo on December 04, 2009, 05:13:20 PM
I don't suppose someone could explain how I get my hands on this project? I don't seem to be able to find a link to buying the PDF?
Title: Re: Guitar-to-MIDI project article
Post by: space_ryerson on December 05, 2009, 04:17:22 PM
I had to dig a bit around the site to find it the first time. Try this link. (http://www.epemag3.com/index.php?page=shop.product_details&flypage=flypage.tpl&product_id=818&category_id=48&option=com_virtuemart&Itemid=26)
Title: Re: Guitar-to-MIDI project article
Post by: mikestorm on December 17, 2009, 09:11:17 AM
hi

is there some way to get a free copy of the article/project?

thanks all
Title: Re: Guitar-to-MIDI project article
Post by: mikestorm on January 11, 2010, 05:12:31 AM
Hi all

i'm working on this project, done the pcb, but the problem is to find the pic 16f88(i've got many 16f84A and 16f84) here in Italy.

however, does anyone allready done this circuit and tasted yet?

would someone be kind and let me listen to some sample, in order to see what really can do the project?

thanks to all

Mikestorm
Title: Re: Guitar-to-MIDI project article
Post by: Jarno on January 11, 2010, 09:10:04 AM
You can get the programmed PIC at Magenta Electronics.

I am wondering about this project, since it's such a simple build. Has anyone else built it? How's the tracking/ delay? Anyone try it on bass?
Title: Re: Guitar-to-MIDI project article
Post by: G. Hoffman on January 11, 2010, 03:29:33 PM
Quote from: Jarno on January 11, 2010, 09:10:04 AM
You can get the programmed PIC at Magenta Electronics.

I am wondering about this project, since it's such a simple build. Has anyone else built it? How's the tracking/ delay? Anyone try it on bass?


I haven't tried this project, but many years back I did play around with MIDI guitar for a while.  The tracking is always an issue, and if your technique isn't clean you will have problems. 

The problem with the tracking is that it takes at least half a cycle for the device to figure out what note you are playing.  One of the side effects of this is it takes longer to detect lower notes than higher, so tracking on a bass will ALWAYS be a problem.


Gabriel
Title: Re: Guitar-to-MIDI project article
Post by: Jarno on January 12, 2010, 05:28:23 AM
Yes, it seems we don't always have physics on OUR side  :)
Title: Re: Guitar-to-MIDI project article
Post by: mikestorm on January 12, 2010, 08:21:08 AM
Thanks Jarno
but i've got a pic programmer, so i would like to take a new  16f88 and program by myself.

here in italy isnt easy to find one, i've got a couple of 16f84 but i think it wont be nice

let me know if there is some news
Title: Re: Guitar-to-MIDI project article
Post by: markeebee on January 13, 2010, 06:26:39 AM
mikestorm - if i send you two pic 16f88 chips from the UK, would you be able to program them and send one back to me?
Title: Re: Guitar-to-MIDI project article
Post by: mikestorm on January 13, 2010, 11:31:07 AM
yes i can , but it will be too expencive for me and for you

i pay 10 euro for the delivery

i can help you to program the pic, programmer schematics and software
Title: Re: Guitar-to-MIDI project article
Post by: potul on January 13, 2010, 12:28:50 PM
As I said some posts above, I built it in a proto-board some weeks ago. See my comments below

Quote from: potul on November 19, 2009, 12:13:58 PM
I breadboarded it tonight, and it works fine, at least it works as I expected it to work after reading the code.

-Tracking is not perfect (having the guitar in tune helps, though :P )
-You need to pick very cleanly.
-The unit is only tracking pitch at the attack of the note, so if after picking you modify the pitch (bending, slide, pull up...), it is not tracked.
-Volume of the note attack is translated into midi note velocity. But velocity is constant until note fades.

Not bad, considering that I skipped the part of the circuit that references the ADC max and min, so probably accuracy can be improved in the final build.
I will investigate if adding some filtering by hardware, the tracking can be improved.
Modify it to have bend tracking will be tricky... because of the way the algorithm works. It tracks pitch at the note attack on purpose to avoid harmonics... so if we continuously track pitch, probably will have wrong pitch detected at the note decay. And, if we add a schmidt trigger type of filter to focus on the main harmonic, we will lose the dynamics.


I cannot post any sample because:

-I didn't record anything
-The unit does not produce any sound... it depends on the MID instrument you attach to it. so I don't see if a sample would be of any usefulness.

I plan to build it in a definitive pcb in brief.. I will keep you updated.

Potul
Title: Re: Guitar-to-MIDI project article
Post by: Taylor on January 13, 2010, 04:00:07 PM
One way that can be useful to record these things is to record the clean guitar in the right channel and then the synth or piano or whatever in the left channel. This gives a good representation of the latency and shows how the unit translates playing techniques into MIDI data.
Title: Re: Guitar-to-MIDI project article
Post by: space_ryerson on January 13, 2010, 06:22:00 PM
When I read the article, I got the feeling that the code would need to be modified to work for bass, since the code seemed to be based on the lowest harmonic of a guitar. Whenever I got around to this project, I was planning on doing it with a bypass, add an audio-in jack for whatever midi module I planned on using, and a blend control for original bass signal vs. the midi module. That way, I can run the synth to the same amp, and potentially overlap the sounds if I wanted.
Title: Re: Guitar-to-MIDI project article
Post by: potul on January 14, 2010, 04:30:57 AM
Oh, I see. Next time I build it in the definitive pcb I will try to record something, but it will not be in the next days because I'm fully dedicated now to program a MIDI bootloader for my projects.

Regarding the bass question, as somebody pointed, the code needs to be modified because it will not track low notes. There is a timeout set based on the guitar lowest frequency that must be modified, and there is a lookup table that probably needs to be adapted to include more octaves.

Potul
Title: Re: Guitar-to-MIDI project article
Post by: potul on January 15, 2010, 03:07:48 PM
Quote from: mikestorm on January 12, 2010, 08:21:08 AM
Thanks Jarno
but i've got a pic programmer, so i would like to take a new  16f88 and program by myself.

here in italy isnt easy to find one, i've got a couple of 16f84 but i think it wont be nice

let me know if there is some news

16F84 will not work, for a number of reasons...

I recently found a source for 16f88 online in Europe. Go check this web. I don't know about the shipping costs, you will need to check.

http://www.voti.nl/shop/catalog.html (http://www.voti.nl/shop/catalog.html)
Title: Re: Guitar-to-MIDI project article
Post by: mikestorm on January 16, 2010, 04:38:40 AM
thanks Potul

i will contact him in these days
Title: Re: Guitar-to-MIDI project article
Post by: mikestorm on January 20, 2010, 04:04:48 AM
found the PIC here in Italy
maybe next week i will contact them and buy one.

someone got news on the project?
Title: PIC newbie seeking help for Guitar-to-MIDI project
Post by: wordstep on January 20, 2010, 04:44:41 PM
About this project, I built the circuit. And wondering how to program the chip.

I use pickit2 clone with version 2.61 software.

There are 2 HEX files.

GUITAR TO MIDI.HEX
ignprgm.HEX

Can someone explain that why there are 2 files?

Thanks a lot.
Title: Re: Guitar-to-MIDI project article
Post by: wordstep on January 21, 2010, 04:58:42 AM
It works with the G*****.hex
I still like to know why there are 2 files.

Thanks.
Title: Re: Guitar-to-MIDI project article
Post by: mikestorm on January 21, 2010, 05:06:57 AM
hi wordstep

i think you have only to load the G######.hex file

the otherone i think is the code for another project in the same issue

would you like to make some audio sample?

maybe as  Tylor said:

One way that can be useful to record these things is to record the clean guitar in the right channel and then the synth or piano or whatever in the left channel. This gives a good representation of the latency and shows how the unit translates playing techniques into MIDI data.

thanks for all
Mikestorm
Title: Re: Guitar-to-MIDI project article
Post by: potul on January 21, 2010, 07:58:52 AM
Yes, the GUITAR TO MIDI.HEX is the file to use. I compiled the ASM file as well and it also worked.
The other hex file is from another project.

Regards,

Potul
Title: Re: Guitar-to-MIDI project article
Post by: wordstep on January 21, 2010, 06:29:16 PM
Thanks for the replies.

Maybe I can record sth. When it is ready, I will post here. I need 2 weeks.
Title: Re: Guitar-to-MIDI project article
Post by: wordstep on January 22, 2010, 05:37:50 AM
to mikestorm
I sent a e-mail to you.

There are 2 files in the e-mail. One is wav, the other is mid.

My recording setup:
Guitar --> zoom ps-02 (complete clean) ---> guitar to midi --> midi to usb interface --> PC (Overtune 4.0)
The wav file is from PS-02.( cut and save in smaller size by goldwave)
The mid file is record by Overtune.

I do not have time to adjust the guitar sound and the setting in Overtune. So the result can be better. Feel free to use them.
Title: Re: Guitar-to-MIDI project article
Post by: potul on February 02, 2010, 11:43:57 AM
Hi guys,

I've been thinking about potential improvements to this project lately... 
If I compare this to the Sonnus G2Midi, the main gap is the fact that this project is not able to track pitch changes after the note attack. So no bends, no pullups, no hammerons, no slides. (well.. BIG hammerons should work)

The way the current algorithm works is not allowing this, because the pitch is not continuously tracked, but it is only measured during the initial attack of the note, and then only the amplitude is tracked to determine when to end the note or start a new one.

So the flow is something like:

Amplitude tracking -> New note detected -> Velocity calculation -> Pitch determination -> Amplitude tracking -> New note or end note -> ......

This is done this way with the assumption that at the beginning of the note, right after the pick, the fundamental frequency will be strong enough not to be messed by the harmonics. But if we continue to track pitch with the used algorithm (zero counting), at some point during the note decay harmonics will be strong enough to mess up things.

If I want it to be continuously tracking, I see 2 options: Modify the algorithm or add some hardware to do part of the job in order to remove the harmonics.

Regarding changing the algorithm, I've been thinking around other pitch detection techniques that can live with the extra harmonics, like FFT and Autocorrelation, but definitively there is not enough horsepower with the 16f88 to do such a thing.

Regarding adding some hardware, I was thinking on using something like the OC-2 fundamental extractor. This could give a better tracking, but would eliminate the dynamics, so no amplitude tracking anymore (no velocity calculation possible). A potential solution could be to combine the original signal envelope with the fundamental extracted by OC-2, using a compandor or something similar, so that we get the fundamental frequency but the dynamics of the original signal.
But after some thought, I think it would be easier to simply use 2 DAC channels of the PIC and input into them both the fundamental (from the OC2) and the original signal (or maybe an envelope of it). This way the PIC will still be able to continuously monitor pitch and amplitude.

On the other side, I'm trying to understand how the OC2 fundamental extractor works. I wonder if the same principle of fundamental extraction could be used on the software side, and avoid adding more hardware to the thing...

What do you think?

Regards,

Potul
Title: Re: Guitar-to-MIDI project article
Post by: Andre on February 03, 2010, 08:41:56 AM
Here are 2 small demo's of my Guitar to Midi build.

This demo shows the tracking and delay:
http://www.youtube.com/watch?v=zOiG9qEXN9E

This demo shows just a bit of playing around with it.
http://www.youtube.com/watch?v=SsWi7GWlPD8
Title: Re: Guitar-to-MIDI project article
Post by: potul on February 03, 2010, 11:56:38 AM
Good demos. Looks like it tracks pretty well, and the latency is not bad.
Title: Re: Guitar-to-MIDI project article
Post by: Jaicen_solo on February 03, 2010, 01:49:46 PM
Wow, i'm surprised how well that tracks actually! I'm even more interested in getting the project files now!
Title: Re: Guitar-to-MIDI project article
Post by: potul on February 03, 2010, 05:51:28 PM
Regarding my idea of feeding 2 different versions of the same signal into the PIC, it seems that (as usual), there's nothing new under the sun. Today I found this Tom Scarff's project
http://www.synthdiy.com/files/2008/pt_uc_ct.gif (http://www.synthdiy.com/files/2008/pt_uc_ct.gif)
It does exactly this. It is tracking separately the frequency of the signal and the amplitude, and trying to optimize the signal for each purpose before the ADC. One portion gets squared trying to retain mainly the fundamental, and the other is rectified to be used as an envelope.

I'm now taking a look at the source code to see if I find anything interesting to be reused.

regards

Potul
Title: Re: Guitar-to-MIDI project article
Post by: potul on April 21, 2010, 05:44:49 AM
Hi All,

I've had this in stand-by for some time while I was working on some analog builds...

This week I re-breadboarded this and did some tests.
I've abandoned the idea of adding the OC-2 tracking part, because after analysing in depth what the circuit was doing, I realized it was exactly (or close to) what the software is doing... So I would not expect any improvement from it. Instead I decided to focus on the software portion and try to improve it.
I have a first beta that implements tracking of hammer-on, pull-offs and slides. What it basically does is keep on monitoring the frequency after the attack of the note, and based on some logic decide if the note has changed. If so, the current note is ended and a new note is triggered.
I'm still having some issues on trying to distinguish a real new note from tracking errors, but looks promising.
When I'm satisfied with this modification, I plan to jump into a harder one, which is to enable bends. This will be more complex and may require some hardware mods in order to increase sample rate. I will keep you updated.

Potul
Title: Re: Guitar-to-MIDI project article
Post by: space_ryerson on April 22, 2010, 01:51:32 PM
Very interesting. Definitely keep us posted! I keep meaning to get into this project, but keep getting sidetracked.
Title: Re: Guitar-to-MIDI project article
Post by: potul on April 23, 2010, 02:05:38 AM
Well,

my modified code to allow slides/pulloffs/hammerons seems to work well. And I've added a switch to be able to change to the "normal" mode if desired.

But I tried to implement the tracking of bends, and so far it's been a failure. It seems that the system does not have enough accuracy for this. The question is, I don't know if it's a problem of resolution or a problem of the natural limitations of the used algorithm with a guitar signal.

Next step I'll try to speed up the PIC to have more timing resolution, and see if this makes a difference. But this will require quite a code re-write, as all the timings and lookup tables depend on the oscillator frequency. Next 2 weeks I'm on a business trip, so I will not be able to experiment more. When I'm back I will continue.

PD: If anyone is interested in the modified code (without the bend part), just ask and I'll send it to you.

Potul
Title: Re: Guitar-to-MIDI project article
Post by: potul on April 23, 2010, 02:10:24 AM
By the way, I was thinking on adding an "octave down" mode so that the midi signal is transposed one octave down. This would allow me to play a midi bass preset at the correct octave.

Any other feature you think could be added?

Potul
Title: Re: Guitar-to-MIDI project article
Post by: space_ryerson on April 23, 2010, 11:30:57 AM
The ability to use it with a bass was one thing I was considering. The ability to track bends would be great, simply so I could play the guitar synth line at the end of 'Ashes to Ashes' in my own home :)
Title: Re: Guitar-to-MIDI project article
Post by: Jaicen_solo on April 23, 2010, 03:36:58 PM
For sure, tracking hammer ons and pull offs would be a great boon to this relatively simple project, if the PIC is capable of processing that much info. How glitchy does it get in this mode? Having a mode switch is great by the way.
Don't forget, the early MIDI guitar synths like the GR700 sacrificed pitch bend to improve accuracy because the hardware just could not cope. Heck, the JX3p it's based on would freak out if you tried to use MIDI control with lots of MIDI information (trust me, I know!). I've found that pitch bends with latency really suck, they make it sound so sloppy and out of tune, I usually use my guitar synths in chromatic mode where available. I think a simpler option is an analogue input for a pitch bend pedal. Much simpler, uses MIDI commands (so it's faster, less processor intensive).That's teh way I would go for sure.
+1 for the octave switching, perhaps you could have an on-off-on for +/1 octave?
Title: Re: Guitar-to-MIDI project article
Post by: potul on April 30, 2010, 02:08:47 PM
Here you have the modified version of the code of this project I'm working on.

http://sites.google.com/site/potulfx/marketing-docs/G2Mplus.asm?attredirects=0&d=1 (http://sites.google.com/site/potulfx/marketing-docs/G2Mplus.asm?attredirects=0&d=1)
http://sites.google.com/site/potulfx/marketing-docs/G2Mplus.HEX?attredirects=0&d=1 (http://sites.google.com/site/potulfx/marketing-docs/G2Mplus.HEX?attredirects=0&d=1)

The tracking of hammer-on, pulloffs and slides seem to work fine.
The switch to select mode must be connected to RA1, setting it to high or low depending on the mode (I think 0v is "legacy mode" and 5v is "hammer on mode")

In order avoid false pitch changes there is a rule, so if a pitch change is detected higher than a threshold, and no new attack is detected,  it is ignored. It is set to 5 semitones, but you can easily change it to a bigger value. The idea is that you usually don't do a hammeron of big intervals unless you're into tapping... Slides are no problem because the note is changing in 1 semitone intervals as you slide.

Note: This version is configured for MCLR pin acting as MCLR, because my programmer requires it. This means you need an additional conection of the MCLR pin of the PIC to 5v through a 10k resistor. If you want to make it compatible with your hardware you may need to change the configuration bits.

If you trie it, just let me know the results

Regards

Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on May 27, 2010, 07:25:39 PM
I'm not sure exactly how midi works, but does this encompass a range of the midi number/notes? If so, what range does it cover numbers wise. Say, looking at THIS CHART (http://upload.wikimedia.org/wikipedia/commons/7/7a/NoteNamesFrequenciesAndMidiNumbers.svg) for example. You will have to scroll to see the entire list.
Title: Re: Guitar-to-MIDI project article
Post by: potul on May 28, 2010, 04:40:20 AM
The device covers all octaves in a guitar. If you plan to use it with other instruments (like bass guitar), the code needs to be adapted. Do you need the exact numbers? I don't remember by heart, but I can check in the code.

Potul
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on May 28, 2010, 06:56:31 AM
Man that would be great if you get a chance! I am working on another project that I am going to try to incorporate with this, but I need to know the exact numbers. Don't go out of your way, but if you can I would greatly appreciate it! Also, I am using a PICkit 2 to program the chip. Do I still need the pull-up resistor on MCLR for your code?

Thanks,
J
Title: Re: Guitar-to-MIDI project article
Post by: potul on May 28, 2010, 08:26:37 AM
The MIDI note numbers of a guitar can go from 40 (E2 - 6th string open) to 90 (F#6 - 1st string 26th fret).
The program can handle this for sure. I think the code is able to generate midi notes from 35 to 94, but I'm not sure if the tracking algorithm will be able to track notes under 40 (E2), because of a limit of around 12ms in the tracking routine.

From my understanding, with the PICkit2 you don't need the pull-up resistor in the MCLR (but you have to modify the configuration bit).

Let me know if you need more information.
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on May 28, 2010, 12:03:55 PM
Thank you so much for that valuable info!! That is just what I needed.

I do have another question. I know just enough about programming IC's to get the HEX file to the chip. I loaded the hex into PICKit 2 and here is what showed up. Below it is the default config bits. I have the LED's on the Guitar-to-Midi board flashing so I know that it at least loaded when I ran it, but I am getting no midi-out activity on midi-ox. I am using a midi-to-usb adapter with it that I know is working. I can only assume that the fuses are not set right unless there is a short somewhere on the board that I am missing.

Any advice would be greatly appreciated!

(http://i227.photobucket.com/albums/dd238/jman_31/Electronics/PICKit2.jpg)

(http://i227.photobucket.com/albums/dd238/jman_31/Electronics/configbits.jpg)
Title: Re: Guitar-to-MIDI project article
Post by: potul on May 28, 2010, 03:58:12 PM
If the 2 LEDs are flashing once when you power on the device, it means then that the program is loaded and working (this flashing is done by the program, so if the pic would not power on you would not see it). Try connecting the guitar and play... the midi activity LED should flash as well.
If this does not happen, the guitar signal is not reaching the PIC, so check the audio path from the jack to the PIC input.
If the midi activity LED flashes, but no midi in midi-ox, double check the midi out connections. It is a quite common mistake to connect the cables reversed in the midi out jack, because it is not very clear in the schematics if the midi jack is seen from the inside or from the outside.
Murphy's law causes that I always do it wrong the first time...

Let me know your findings,

potul
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on May 28, 2010, 04:30:05 PM
Thanks again Potul. Both leds flash when I power it up, and I have both leds getting the signal from the guitar so it has to be after that. I checked over my midi jack traces and it is all correct. I just can't figure what I have done wrong. I can't find any shorts or breaks with my continuity tester. I am going to go back over all of the components and make sure I have them all in the right places. I think they are though.

Thanks for the info!
J
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on May 28, 2010, 06:13:16 PM
OK, now I am embarrassed. It was the midi lines. I an not sure why, but the midi jack in Eagle cad was opposite of the actual drawing. I have used that jack in eagle before so I am not sure why it was that way. Anywho, it works awesome! Thanks for the help Potul!!!
Title: Re: Guitar-to-MIDI project article
Post by: potul on May 29, 2010, 04:18:42 AM
Murphy's law again... :)

It always happens to me, so if it doesn't work, I try reversing the MIDI out wires. I'm happy to see it works. LEt us know your experience.

Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on July 15, 2010, 01:24:56 PM
I had another question if you guys don't mind. I have designed midi driven lights for my electronic drums and I want to do the same for the guitar using this circuit. My light system will run 39 separate lights. Since I have the possibility of 144 notes on my guitar I am needing to double up some of the notes. My thought was to have every third octave trigger the same light or something along those lines so that the 39 lights would cover all of the guitar notes. Would it be possible to tailor the FW to do that? I don't need it to trigger anything on a computer (it's for live shows) so it doesn't matter if the notes are doubled up.

Potul, if it would work, would you be interested in doing it? (for a fee of course) :icon_cool:
Title: Re: Guitar-to-MIDI project article
Post by: potul on July 15, 2010, 01:48:25 PM
Sure, it should be easy to do. What octaves your lighting device uses?
By the way... the guitar does not have 144 notes. Take into account that most of the notes in the fretboard are repeated. In a 24 fret guitar of 6 strings you have only 49 notes. A possible approach would be to simply reduce the octave number of the 10 higher notes. This would give you 39 possible notes.

Regards,

Potul
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on July 15, 2010, 02:44:06 PM
For some reason my lights will not flash if I use an octave. Say if I strum an open "E" and assign the midi value of 40 to it as you suggested it works fine. But if I move up to the 12th fret and strum that "E" the same light won't flash. That is why I assumed that it would require a different midi number. My lights use any note numbers 1-127 on the midi scale. I assign a number according to the note that I want to use and it will flash. Does any of that make sense? I wouldn't mind if the same light would flash for every "E" on the fret board, but it doesn't seem to work that way. I must be missing something. Here is a video of how my lights work.  http://www.youtube.com/watch?v=_zV3aN6SSNg

Thanks for the help Potul!!!

J
Title: Re: Guitar-to-MIDI project article
Post by: potul on July 15, 2010, 04:55:19 PM
Let me see if I understood. Your lighting device works so that you assign to each midi note a light to trigger, right? And have you can handle all 127 notes, but you have only 39 lights. (can you assign multiple notes to the same light?)

The way the midi interface works is you will get a midi note 40 with a low E (6th string open), but you will get a 52 at the 12th fret. You need to have both of them assigned (40 and 52) to something for the light to trigger.
If you want all "E" to trigger the same light (the one assigned to midinote 40), this can be done easily in the code, but then you will only be able to light 12 lights.

Am I missing how this works?....

To better understand the purpose of this. Are you trying to get some kind of light effects out of it? Is it  important the note assignment? (I mean,.. do you always want to trigger a given light with a given note, or is it not important?)

Potul
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on July 15, 2010, 05:59:43 PM
Quote from: potul on July 15, 2010, 04:55:19 PM
Let me see if I understood. Your lighting device works so that you assign to each midi note a light to trigger, right? And have you can handle all 127 notes, but you have only 39 lights. (can you assign multiple notes to the same light?)

Yes that is exactly right. My coding and hardware is set up to handle 39 triggers. I can assign more than one light to a midi note, but I can't assign more than one note to a light.

Quote from: potul on July 15, 2010, 04:55:19 PM
The way the midi interface works is you will get a midi note 40 with a low E (6th string open), but you will get a 52 at the 12th fret. You need to have both of them assigned (40 and 52) to something for the light to trigger.
If you want all "E" to trigger the same light (the one assigned to midinote 40), this can be done easily in the code, but then you will only be able to light 12 lights.

Am I missing how this works?....

You seem to be understanding how it works, and I understand the 12 lights that you mentioned. This was my initial thinking in having every third octave or so trigger the same light. That way I could use more of the lights than just 12. Does that make sense? How does the 49 note variations figure in to all this?

Quote from: potul on July 15, 2010, 04:55:19 PM
To better understand the purpose of this. Are you trying to get some kind of light effects out of it? Is it  important the note assignment? (I mean,.. do you always want to trigger a given light with a given note, or is it not important?)

Yes I am using it with power LED's or LED strands to make interactive stage lighting. I will also be designing it for a keyboard and hopefully other midi instruments. I think the only way to do this would be for a given note (or notes) to trigger a given light.

Thanks again,
J

Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on July 15, 2010, 06:01:04 PM
edited: accidental post, sorry.
Title: Re: Guitar-to-MIDI project article
Post by: potul on July 16, 2010, 01:58:20 AM
good, what I don't understand is why your E on the 12th fret is not working. Is it because you haven't mapped note 52 to any light?

What I would propose is to add a check so that if the midi note is higher than 76, we reduce it by 3 octaves. This way you will always have a  value between 40 and 76. And then you will need to map midi notes 40 to 76 to some lights.

Potul
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on July 16, 2010, 07:07:16 AM
Yes, I had not mapped it to 52 which I'm sure will work. I also think I understand the 49 notes now and I am going to try some variations with that to see if it works.

I will get back to you today after I play around with that.

The idea that you presented may indeed be the way to go. Then I could use 36 of the lights right? I think you have a good grasp on what I am trying to do! :icon_cool:

Thanks for your patience,
J
Title: Re: Guitar-to-MIDI project article
Post by: potul on July 16, 2010, 08:15:05 AM
Ok, let me know your results. I will try to change the code during this weekend.

By the way, I was thinking... instead of 36 we can do 48 (12x4)... this would utilize almost all of your lights.

Have a nice weekend.
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on July 16, 2010, 10:25:09 AM
I am not sure exactly what you mean by the 48. I only have 39 lights to work with. Am I missing something there? :icon_redface:

I tested the 49 note theory and it checks out. As long as the pitch is the same it will flash, so midi note 52 works for the 12th fret on the E string and also on the "E" on the A string and the D string and so on. So I actually just need to map the notes so that the 49 pitches will work with 39 lights. I would say that it would be best to map the single pitch notes to a corresponding same letter note, so say the low "E" string which only has one pitch note would be midi note 52 instead of midi note 40. See what I mean?

Please check your PM's when you get a chance.

You have a great weekend also!

J
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on July 16, 2010, 03:41:44 PM
I charted out the 49 different pitches on a 24 fret guitar and I think it would actually be better to do it in octaves. Using the pitch method, some of the notes/pitches are repeated up to six times, and some as few as 1. That would make certain notes flash a lot more than others. What do you think?
Title: Re: Guitar-to-MIDI project article
Post by: potul on July 16, 2010, 06:16:48 PM
Quote from: jman 31 on July 16, 2010, 10:25:09 AM
I am not sure exactly what you mean by the 48. I only have 39 lights to work with. Am I missing something there? :icon_redface:

sorry... I messed up the numbers.... and for whatever reason I understood you had 49 lights...

I don't get the point on sending note 52 with the low E. I see 2 options

Option 1- Add a condition in the code, to do something like:

If midinote>76 then midinote=midinote-36

This way, you will have different midinotes in all the fret except when you reach the forth octave, and the midinotes start again at 40. You will havfe 36 different midinotes output.

Option 2 - Restrict output to one octave only. This way, all E in the fretboard will have the same note. But this means you will only have 12 different possible values.

Let me know your preference and I can implement the change. (I think easily)
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on July 16, 2010, 06:39:56 PM
I think the first with the octaves will be he cleanest application. I am glad that it won' be a terrible amount of work for you! I look forward to testing what you come up with!

Thanks again,
j
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on July 28, 2010, 05:28:31 PM
Just wanted to thank Potul publicly for his help on my project. He rewrote the programming for me to work with my application and it works perfectly. He did it purely out of kindness and I really appreciate it.

Thanks again man! You rock!
J
Title: Re: Guitar-to-MIDI project article
Post by: potul on July 28, 2010, 05:33:21 PM
I'm happy to see it works. When you finish the project, don't forget to post a demo video so that we can see the result!

Regards
Title: Re: Guitar-to-MIDI project article
Post by: Boogdish on August 05, 2010, 08:19:00 PM
I really want to try this out, could someone please post a diagram or explanation of the circuit surrounding the chip?
Title: Re: Guitar-to-MIDI project article
Post by: Taylor on August 05, 2010, 08:23:00 PM
I think you might have to buy the article to see the schem.
Title: Re: Guitar-to-MIDI project article
Post by: Gurner on September 03, 2010, 08:55:27 AM
was there any ever conclusion here wrt tracking/handling pitch bends?
Title: Re: Guitar-to-MIDI project article
Post by: potul on September 03, 2010, 09:52:59 AM
I haven't abandoned the idea yet, but couldn't find a solution.

I tried to speed up the processor to its max using an external cristal, and then try to do some filtering/averaging in order to get a stable pitch detection that could be used for bends,.. but never got anything satisfactory.

I still have a the hope that something could be done to improve the pitch detection algorithm, but I'm running out of ideas.

Potul
Title: Re: Guitar-to-MIDI project article
Post by: Gurner on September 03, 2010, 10:05:33 AM
My reason for asking is I'm runninng a smaller project that detects guitar pitch (though weirdly I'm detecting when pitch *hasn't* changed.....don't ask!). I was pondering having a pop at pitch to midi inc pitch bends etc ....but if you're struggling with the latter, chances it'd take a bit of my time (which I haven't got a lot of spare capacity at the moment)

Thanks for the update & good luck!
Title: Re: Guitar-to-MIDI project article
Post by: connectable on September 03, 2010, 07:37:10 PM
Hi,
I've followed with interest your respective comments on the EPE article. Having purchased a MODUS G2MIDI and been properly disappointed with it, I built the unit in the article, and as it stands it is very good. One of the aspects you have discussed has been pitch bending, and in fact I used to filter out the annoying tidal wave of pitch bend messages from the Modus unit. Mostly I play finger-style and only bend for stuff like the blues. I'll be reckless here and say that MIDI electronics will NEVER be able to reproduce the subtleties of guitar string-bending, especially on a modest little engine like the 16F88.

I too have hacked the source and re-coded it to use the 8Mhz clock rate, though upping the pre-scale rate for TMR1. As you know the timer value is divided and then interpolated in a look-up table, which contains a handful of same-value entries for a small-range of the TMR value. Possibly it is here that you should look for a method of detecting bends. Currently all the multiple-entry table does is save face for either an out-of-tune string, or inbuilt timing errors in the code, but the value that is used to index the table could be used as an indication of  percentage bend, providing that an accurate setup, and tighter code is implemented.

For a much simpler solution (and one that might be deemed a work of the devil) can I mention Whammy Bar? Implementing a two-pot (like a joystick) whammy setup and using this as a controller will get round all of the niggly problems mentioned so far. The use of a whammy bar in the hands of a very skilled practitioner can be every bit as soulful and expressive as string-bending. Examples include good ol' Hank Marvin, who can make a guitar sound exactly like a human voice if he chose to. Personally, my whammy technique is rubbish, so I don't use it, but might if there wasn't the choice.

A couple of other points that have been raised are to do with detuned strings. Currently the initial 'window' for detecting a working trigger level and velocity is nominally 12ms - according to the authors code comment. I measured this window and it was nearer 15ms, so dropped 'D' tuning and the like will still work. I tightened mine up a little by tweaking the loop count. This nominal 12ms is a broad brush - set to accommodate the lowest string frequency. A window of just under 4ms is all that is necessary for the 'high' E string. On my home-made pickup each string has it's own coil, and I'm putting together a 6-channel version of the circuit, but using only one (more powerful) PIC, consequently I've trimmed these 'windows' to a proper length for each string, in an effort to cut down on latency.

One other thing I noticed was that as I'm using high-gain amplifiers (the coils are relatively insensitive) residual high-frequency spot noise on the input to the PIC was causing it to omit the MIDI-OFF sequence. I slugged the op-amp feedback resistor with a 1n5 capacitor (NOTE my final op-amp has a 100k feedback resistor - the article value is different) so that the response starts to roll off above 1200Hz (highest note on the guitar I use)

Keep up the good work. I'll post my progress from time to time.
Joe.

http://joebrown.org.uk
http://connectable.org.uk
Title: Re: Guitar-to-MIDI project article
Post by: potul on September 04, 2010, 03:23:59 AM
Quote from: connectable on September 03, 2010, 07:37:10 PM

...As you know the timer value is divided and then interpolated in a look-up table, which contains a handful of same-value entries for a small-range of the TMR value. Possibly it is here that you should look for a method of detecting bends. Currently all the multiple-entry table does is save face for either an out-of-tune string, or inbuilt timing errors in the code, but the value that is used to index the table could be used as an indication of  percentage bend, providing that an accurate setup, and tighter code is implemented.
That's in fact what I implemented in the code. And it's working in the sense that it detects percentage of pitch, and responds to pitch changes. The problem is accuracy. Most of the notes are detected as bended even if they are not, and pitch fluctuates. The end result is an out of tune MIDI signal that sound horrible...
The problem is the device accuracy is good enough to be able to distinguish semitones, because these innacuarcies get corrected by the lookup table and rounded to semitones. But when you try to go to semitone cents, doesn't seem to work.

Anyway, I've seen some projects implementing a guitar tuner using a similar PIC, and I assume these require a sub-semitone accuracy, so I will take a look and see if I can find anything that could be applied here.


regards
Title: Re: Guitar-to-MIDI project article
Post by: connectable on September 04, 2010, 07:47:44 AM
Hi potul,

Yeah, I get what you are saying, and this brings me back to my assertion regarding the almost impossible task of synthesizing guitar string-bending in any realistic way. We get used to applying just the right pressure behind a fret to get the note on 'perfect' pitch (after years of practise and getting to know a particular instrument) and this is a cognitive process that is well-nigh impossible to duplicate using the comparatively primitive system we are discussing.

Your comment: Anyway, I've seen some projects implementing a guitar tuner using a similar PIC, and I assume these require a sub-semitone accuracy, so I will take a look and see if I can find anything that could be applied here.
is interesting, but I doubt whether anything more useful than what we already have can be found. By far the most accurate and useful guitar tuner project I've seen, used a selectable bandpass filter and frequency-to-voltage converter set up, but these type of instruments are too specialised to be useful for what we want - an accurate repeatable note value output for any string/fret combination, plus information on any bend applied.

My experimental setup tries to obviate some of the problems in the following ways:

1. Each string has it's own pickup and amplification chain.
2. The guitar fretboard/strings are also scanned as a matrix. (This needs each fret to be wired as a 'row', and each string as a 'column') This gives an accurate and consistent note value for any strings fretted.

Using the above in combination with some firmware, some of the problems go away. For example:

a) We always know which string is being plucked, irrespective of the output frequency, hence any 'notes' derived from a particular string that are out-of-range for that string can be ignored.
b) The software can recognise when a string is being bent, as on initial fretting/pluck, discrepancies between the actual and 'desired' unbent pitch can be measured and stored, allowing an easy calculation of subsequent percentage bend thereafter.

Downsides are of course the relative complexity of the hardware/software, and irreversible surgery required to the guitar. At this point I'm still working on the project, and I bought a second-hand Fender Squier Acoustic (suits my fat fingers) for Ā£35 (GBP) on which to implement the prototype. Currently this instrument looks even worse than some of the other FrankenGitbox stuff I've produced, but ultimately I'm aiming for a relatively acceptable solution that is not obtrusive in any way.

When I have a fully-debugged and usable system, I'll be publishing details on my site(s). I am still fiddling with the EPE code at the moment, but will publish any improvements I have to this in the meantime.

Regards from Joe.

http://joebrown.org.uk
http://connectable.org.uk



Title: Re: Guitar-to-MIDI project article
Post by: potul on September 04, 2010, 03:23:55 PM
yeah, for sure the hex pickup can help a lot, and it can allow for polyphony as well.
The idea of "relative" bend is interesting. From what you mention, I understand that your algorithm assumes the note is always pluck unbent, and the bend happens afterwards. Althuough it covers the most typical uses of bending, there are some cases where the note is plucked already bent. Anyway, if it works it's an interesting approach.
Title: Re: Guitar-to-MIDI project article
Post by: connectable on September 04, 2010, 05:23:11 PM
Hi,
Yeah, as far as it goes. However, because the fretboard is scanned, as soon as you fret a note, it is 'recognised', and it's notional absolute value calculated and stored. What you do with this is up to you. In fact it is not necessary to pluck the string/strings before having it/them heard - a bit like tapping, and this is one weird way to play, though I have found it strangely pleasing. So, the string/fret combination is known before you either bend or pluck it, therefore pre-bend is entirely possible. The key to making everything work 'in tune' is knowing the absolute string/fret combination as I hinted earlier. As it is at the moment, because the note forming is being done in duplicate, but different systems, I can play soft string (MIDI) chords by just fretting these, and by plucking a string or strings have these play separate MIDI (on another channel) and/or 'normal' mag. pickup through an amp. Add on a peizo pickup for good measure and the guitar can sound like an orchestra.

To clarify. In the above the fretboard/string matrix scanner software/hardware maintains a set of lists. In the following, I've used the word 'key' to mean a string/fret crosspoint as I haven't a short alternative. Constant scanning of the fretboard is done, and as string/fret combinations are detected they are put in a 'keylist'. At the end of the scan, this keylist is compared with a copy of the previous 'keydown' keys, and any duplicates are removed from keylist. Next, any keys in 'keysdown' not found in the newly scanned 'keylist' are marked as 'keyup' and put into 'keyuplist'. Finally, any new 'key' down is added to 'keysdown'. All of this happens after each full scan of the fretboard. The foreground process examines the keysdown and keyuplist and can, if required, generate MIDI ON or OFF. All of this can happen without plucking any strings.

Adding the multi-head pickup and processing the output from this augments and/or controls the above process, and the combination is very powerful. However, as I said earlier, this is at the expense of some complexity. But... I love messing about, especially with hardware and PICs in particular, and I don't have a problem coding stuff, having been in the business since 1979.

I hope this clarifies some of my thinking aloud.
Regards from Joe.
Title: Re: Guitar-to-MIDI project article
Post by: connectable on September 05, 2010, 02:36:33 PM
Hi,
I've posted two oscilloscope dumps showing PEAKS and TIMING routines working with an upper open 'E' string pluck, on my site joebrown.org.uk. I've also detailed the removal of the software loop in PEAKS and replaced this with TMR0. Full source-code project is also given.

I've also posted a ping-back to this discussion group. The post URL is: http://www.joebrown.org.uk/wp/?p=3273

Regards from Joe.

http://joebrown.org.uk
http://connectable.org.uk
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on November 03, 2010, 01:32:16 PM
I finally got my boards made up for my add-on to my Midi triggered LED kits. Works great thanks to Potul customizing the firmware for me. I hope to have a video of it in the near future, but in the meantime here is a video of my drum light kits in action by one of my customers.  Midi Knights Video (http://www.youtube.com/watch?v=pDokgnR9L6c)


(http://i227.photobucket.com/albums/dd238/jman_31/Electronics/Midi%20Knights%20PCBs/1103101244.jpg)



Title: Re: Guitar-to-MIDI project article
Post by: potul on November 03, 2010, 04:28:38 PM
nice PCB!

I'm impatient to see it in action!

Regards,

Potul
Title: Re: Guitar-to-MIDI project article
Post by: chitarrastonata on November 08, 2010, 12:14:55 PM
Dear all,
I'm working daily with PIC using 'C' language, so I'm interested to add my help to this project.
Reading the posts I have not understand which hardware and software to use.
'potul' has posted ASM source, but it seems that is running on a different hardware than I have found in 'pt_uc_ct.gif'. I'm wrong?
Can anybody explain to me the algorithm to recognize the note pitch?
Thanks, and sorry for my bad English  :icon_redface:
Title: Re: Guitar-to-MIDI project article
Post by: potul on November 09, 2010, 02:45:20 AM
If I recall it correctly I used a PIC 16F88

Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on November 09, 2010, 11:51:51 AM
Hi Potul,

I am sorry to be a bother, but I have one more favor to ask you if you have the time. I tried to get your .hex code for the G2MPlus (http://sites.google.com/site/potulfx/marketing-docs/G2Mplus.HEX?attredirects=0&d=1) that you wrote but I can't get it to work with the PICKit 2. When you wrote that modified code for me you did something that made it work with the PICKit 2, is there any chance that you could do the same for the G2Mplus? If not, no problem, I know you have done a lot for me, but if you can I would sure appreciate it!

Thanks,
Jeremy
Title: Re: Guitar-to-MIDI project article
Post by: potul on November 10, 2010, 07:51:25 AM
As far as I remember, you just need to change the config bits in the ASM file and make them look like this:

   __CONFIG _CONFIG1, H'2F10'

(my file has   __CONFIG _CONFIG1, H'2F30')

Compile and burn.

Potul
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on November 10, 2010, 10:37:45 AM
OK. Thanks, I will give it a try!  :icon_cool:
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on November 10, 2010, 04:31:52 PM
Thanks Potul, that worked perfectly.

I have a problem that I just noticed though that has nothing to do with the programming. When I run it into my amp I get a kind of clicky noise every time I play a note. It is only just the brief period at the very beginning of the pluck of the string. Almost sound like an electrical staticy click if that makes any sense. Does anyone have any idea what could be causing that? I tried swapping the TL072 with a different one, and I even checked my original prototype. They both have the same click with every note palyed. I wonder if it is the layout of my components or if someone else has had this issue. Any advice would be greatly appreciated.

Thanks
Jeremy
Title: Re: Guitar-to-MIDI project article
Post by: potul on November 10, 2010, 07:28:53 PM
mm, I never noticed this,.. but I have to admit I've almost always used it without amping, just using the MIDI part.
Maybe somebody else can confirm this?
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on November 11, 2010, 02:29:32 PM
Just for a test, I removed the PIC16F88 and the noise went away. It still had power to it and everything was treated the same except the chip being removed. The "click" seems to coincide with the led's flashing.
Title: Re: Guitar-to-MIDI project article
Post by: potul on November 11, 2010, 08:28:37 PM
Interesting... maybe some power filtering issue? (just wondering...).
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on November 12, 2010, 09:08:17 AM
I tried another experiment today. I put an unprogrammed pic16f88 into it and no click. So something in the wiring of the chip or like you said "filtering" must be causing it. I am going to breadboard the original schematic today and see if I still get issues. If not then it will have to be in the small changes that I made. In the meantime, here is my revised schematic. SCHEMATIC (http://i227.photobucket.com/albums/dd238/jman_31/Electronics/Midi%20Knights%20PCBs/G2MSchematic.jpg)
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on November 12, 2010, 09:08:56 AM
Sorry, Here my revised schematic. SCHEMATIC (http://i227.photobucket.com/albums/dd238/jman_31/Electronics/Midi%20Knights%20PCBs/G2MSchematic.jpg)

EDIT: Fixed my first post. Sorry about the double post!
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on November 12, 2010, 11:32:07 AM
Well, I breadboarded it today with the original schematic and what do you know, no click! So I have screwed up somewhere in my schematic or layout.
Title: Re: Guitar-to-MIDI project article
Post by: Gurner on November 16, 2010, 10:43:40 AM
I'd lay money on those LEDs being the source of your click (I can't say why when you've breadboarded it, that the click disappeared - you schematic photo/scan isn't complete).

When the PIC switches on those LEDS, there's a small transient of current running which get's into the PIC VCC rail, this in turn gets into the TL072 supply, which in turn gets into your signal....becuase a guitar signal is so small, this current jolt is right there in with it & gets amplified up big time.

The solution is normally to have a separate regulated rail for your digital & your analogue (and the ground planes come to that) ...or you could disconnect the LEDs!
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on November 16, 2010, 11:17:07 AM
Hi Gurner and thanks for the response. I already tried removing the LED's and it didn't change anything. My next thing to try though is to separate the rails like you suggested. I haven't had time in the last few days to mess with it, but that was my next thing to try. You may still be on to something with the LED's, though I'm not sure what. I didn't include them when I breadboarded it.

Thanks,
J
Title: Re: Guitar-to-MIDI project article
Post by: potul on November 20, 2010, 02:09:31 AM
Hi J,

What's the difference between the original schematic and yours? I've taken a quick look at both and the only difference I spot is the filtering on the 7805. I think in the original, the 2 condensers are in the output of the 7805 while you have put them in the input.

Potul
Title: Re: Guitar-to-MIDI project article
Post by: jman 31 on November 20, 2010, 06:26:43 AM
That's pretty much it Potul. I've added an alternate output, but I'm pretty sure that is not what is affecting it. And I don't have the power switch on through the audio jack (seems that should help, not hurt). I've even added the filtering back in like the original schematic to eliminate that difference. I'm afraid it may be my power trace routing on the PCB, but I haven't had much time to look at it this week. I'm hoping to get back on it soon. This is very frustrating. I am working on a surface mount version right now, so I will test that when I get it done to see if it has the same issue. I sure hope not.
Title: Re: Guitar-to-MIDI project article
Post by: HB on March 12, 2013, 06:35:58 AM
I've just bought the EPE magazine October 2009 back issue but the software/source code is no longer available to download from EPE's website.  Does anyone know where I can find it (I have searched hard on the Internet) or can someone please post it to download.
Title: Re: Guitar-to-MIDI project article
Post by: potul on March 12, 2013, 07:42:29 AM
From this link you can download the one that I modified, but I don't have the original one anymore.


https://sites.google.com/site/potulfx/marketing-docs/G2Mplus.asm?attredirects=0&d=1 (https://sites.google.com/site/potulfx/marketing-docs/G2Mplus.asm?attredirects=0&d=1)

Title: Re: Guitar-to-MIDI project article
Post by: HB on March 12, 2013, 08:22:21 AM
Thank you very much Potul.

Would you mind explaining the hardware modification that you made for the hammer-on/slide mode selection?   I think you have added a switch so that the comparator input RA1 can be set to high or low, but you also mention including a resistor - is the resistor connected between the switch and pin 18 (RA1) as a current limiter?  What value did you use?

regards

Harry
Title: Re: Guitar-to-MIDI project article
Post by: potul on March 12, 2013, 09:22:13 AM
The change you need to do is add a switch and a pull-up resistor. So, RA1 should be connected to either 5v or 0v. I don't remember what position is what... (I think 0v is "legacy mode" and 5v is "hammer on mode")

This version is configured for MCLR pin acting as MCLR, because my programmer requires it. This means you need an additional conection of the MCLR pin of the PIC to 5v through a 10k resistor. If you want to make it compatible with your hardware you may need to change the configuration bits.


Title: Re: Guitar-to-MIDI project article
Post by: deadastronaut on April 23, 2013, 11:36:49 AM
 :)
Title: Re: Guitar-to-MIDI project article
Post by: Lurco on April 24, 2013, 01:17:07 AM
Polyphonic without special pickup? Is it real? http://www.jamorigin.com/midi-guitar/
Title: Re: Guitar-to-MIDI project article
Post by: potul on April 24, 2013, 03:32:25 AM
wow....
It's not the first polyphonic recognition we see (remember polytune), but for midi.... that's a challenge. I've downloaded the demo to try... tonight I will try to test it.

Mat
Title: Re: Guitar-to-MIDI project article
Post by: Jdansti on April 24, 2013, 04:00:26 AM
I'm going to give that app a try. I've got a Sonuus G2M, but it's monophonic and I don't play clean enough for it to sound decent.
Title: Re: Guitar-to-MIDI project article
Post by: deadastronaut on April 27, 2013, 02:43:09 PM
thanks to artifus i'm now building the Guitar 2 midi  project...(even though its only mono i'm looking forward to hooking it up and messing around with it as my first introduction to midi guitar)

i have to wait for my 18pin socket for the pic, but other than that its ready to go... 8)

below are the files artifus kindly sent me. 8)


(https://dl.dropboxusercontent.com/u/7464107/P270413_18.14.jpg)

https://dl.dropboxusercontent.com/u/7464107/G2MaPCB.pdf

https://dl.dropboxusercontent.com/u/7464107/G2MaRob1.pdf


@potul/john  did you try that demo plugin?

Title: Re: Guitar-to-MIDI project article
Post by: Jdansti on April 27, 2013, 10:02:19 PM
^ I haven't tried the plugin yet. It's been a while since I've used my DAW due to having to overhaul my computer. I hope to give it a try after my wife turns me loose from my remodeling work. 
Title: Re: Guitar-to-MIDI project article
Post by: potul on April 28, 2013, 02:38:54 AM
Quote from: deadastronaut on April 27, 2013, 02:43:09 PM

@potul/john  did you try that demo plugin?


not yet. This weekend my home PC decided to stop working... looks like the HDD passed away.  Once I have this fixed I will try

Mat
Title: Re: Guitar-to-MIDI project article
Post by: deadastronaut on April 29, 2013, 09:08:16 AM
update on those pdf's..

reverse the 7805. ;)...other than that all fine. ;)

voila' i have a midi guitar now...its pretty cool with the glide/slide mode... :icon_cool:

a little tinkering on resistor values that i had subbed and its good to go i think...

its brilliant playing the synths in cubase/reason etc....lots of fun to be had...even though its mono its great to mix with guitar...or on its own

get it to trigger 5ths and octaves  or sus2's / chords and your laughing.....well worth a build imho...

i'll try and do a vid, but my soundcard doesn't like cubase and windows movie maker on at the same time.. ::)...

Title: Re: Guitar-to-MIDI project article
Post by: deadastronaut on April 29, 2013, 10:25:27 AM
ok really bad phone demo vid...the mics on phones just cant handle it...but you get the idea..

sounds superb in reality..

https://dl.dropboxusercontent.com/u/7464107/mifdimovie1.wmv
Title: Re: Guitar-to-MIDI project article
Post by: Jdansti on April 29, 2013, 10:43:48 AM
Very nice Art and Rob!  Sounds great!  Now you can play the oboe!  ;)

How clean did you feel you had to play to get a good sound?  What happens with a little overlap between notes?
Title: Re: Guitar-to-MIDI project article
Post by: deadastronaut on April 29, 2013, 10:59:58 AM
I'm still tweaking it, but yeah you have to play pretty cleanly...

many thanks to potul (mat) for this too.. ;)

going  by the guy on here who did a demo, it tracks pretty damn well.....hopefully mine will in a bit.. :)

http://www.youtube.com/watch?v=SsWi7GWlPD8

no oboes here...just lovely  cubase/reason synths.. ;)


@mat:  any advancements on this since you built it?



Title: Re: Guitar-to-MIDI project article
Post by: potul on April 29, 2013, 05:06:38 PM
Not really.

I tried without success to implement a better tracking algorithm with the intention to track bends. And I put it in a box (finally!). That's all.

Title: Re: Guitar-to-MIDI project article
Post by: Hemmel on April 30, 2013, 01:06:24 PM
I have a IVL PitchRider 7000 MKii at home...
Never use it since I can manage ok on my keyboard controller...

I guess I'll try to sell the PitchRider...
Title: Re: Guitar-to-MIDI project article
Post by: deadastronaut on May 01, 2013, 06:20:49 AM
i added a 'hold' function to it...just switching between 330k and a 2.2M on the input..





Title: Re: Guitar-to-MIDI project article
Post by: Jdansti on May 03, 2013, 02:40:57 AM
Here's some polyphonic for ya'...



I looked up the Roland GR-1 and it uses a special pickup, so it's not true guitar to MIDI, but its still pretty cool!
Title: Re: Guitar-to-MIDI project article
Post by: deadastronaut on May 07, 2013, 08:00:15 PM
mid converter done... ;)

(https://dl.dropboxusercontent.com/u/7464107/P080513_00.31.jpg)

(https://dl.dropboxusercontent.com/u/7464107/P080513_00.32.jpg)

(https://dl.dropboxusercontent.com/u/7464107/P080513_00.33.jpg)
Title: Re: Guitar-to-MIDI project article
Post by: Jdansti on May 07, 2013, 08:31:11 PM
Nicely done!

Just curious if there was a reason that you went "lid up" on this one?
Title: Re: Guitar-to-MIDI project article
Post by: deadastronaut on May 07, 2013, 08:37:53 PM
ha ha well spotted, yes it was an old unused/undrilled pulsewah etch...bit of recycling ;)

ideal for the job.
Title: Re: Guitar-to-MIDI project article
Post by: Jdansti on May 07, 2013, 08:38:36 PM
Nothing wrong with that!  :)
Title: Re: Guitar-to-MIDI project article
Post by: potul on May 08, 2013, 11:12:13 AM
Can you explain what the "hold" function does and how it was implemented?
Title: Re: Guitar-to-MIDI project article
Post by: deadastronaut on May 08, 2013, 11:18:55 AM
hi mat, 

i put a switch  where  R2 (680k) is...(though i'm using 470k)

and it switches between the 470k, and a 2.2M...the 2.2M blasts the input, and triggers 'sustained' notes..hands free. (depending on sound)

though its being a bit temperamental with me at the mo...i'm sure you know how it is....i'll sort it later.. ;)

here ya go a pic paints a thousand words eh...

https://dl.dropboxusercontent.com/u/7464107/MIDIG2MODDED.jpg

rob.

Title: Re: Guitar-to-MIDI project article
Post by: potul on May 09, 2013, 02:31:47 AM
Oh, I get it. interesting solution. It would be much more reliable to implement this via software in the PIC though.
Title: Re: Guitar-to-MIDI project article
Post by: deadastronaut on May 09, 2013, 05:53:30 AM
lol..interesting bodge more like ... ;D

yeah i guess it would, but i have no experience whatsoever in pic's,+  programming etc.....thats a whole new ball game for me. :)
Title: Re: Guitar-to-MIDI project article
Post by: davent on May 09, 2013, 04:08:57 PM
Quote from: Jdansti on May 03, 2013, 02:40:57 AM
Here's some polyphonic for ya'...



I looked up the Roland GR-1 and it uses a special pickup, so it's not true guitar to MIDI, but its still pretty cool!

OK way off topic but i googled Jeff Baxter to basically see if he was still alive, what has he been up to in recent years... Wikipedia and this gig sorta popped up unexpectedly...  More recently, he has been working as a defense consultant and chairs a Congressional Advisory Board on missile defense.

http://en.wikipedia.org/wiki/Jeff_Baxter

Back to topic.
dave
Title: Re: Guitar-to-MIDI project article
Post by: Jdansti on May 09, 2013, 10:02:41 PM
Quote from: davent on May 09, 2013, 04:08:57 PM
Quote from: Jdansti on May 03, 2013, 02:40:57 AM
Here's some polyphonic for ya'...

I looked up the Roland GR-1 and it uses a special pickup, so it's not true guitar to MIDI, but its still pretty cool!

OK way off topic but i googled Jeff Baxter to basically see if he was still alive, what has he been up to in recent years... Wikipedia and this gig sorta popped up unexpectedly...  More recently, he has been working as a defense consultant and chairs a Congressional Advisory Board on missile defense.

http://en.wikipedia.org/wiki/Jeff_Baxter

Back to topic.
dave

He's got a video out there where he talks about how the defense consulting came about.
Title: Re: Guitar-to-MIDI project article
Post by: deadastronaut on May 10, 2013, 03:44:12 AM
midi guitar controlled drones... ;D
Title: Re: Guitar-to-MIDI project article
Post by: kooroshi60 on September 29, 2013, 07:31:40 AM
Quote from: deadastronaut on May 01, 2013, 06:20:49 AM
i added a 'hold' function to it...just switching between 330k and a 2.2M on the input..






Hello Rob. Can you tell me if it has any effect on tracking efficency? Does it change the sensing threshold? And would you please upload the firmware you are using currently? Thank you
Title: Re: Guitar-to-MIDI project article
Post by: deadastronaut on September 29, 2013, 08:50:33 AM
@kooro: 

i didn't programme the chip...another guy did, and sent me it...

as for the hold mod, it doesn't quite work as expected....


if i were you i would just buy the sonuus v2...looks pretty cool , and reasonably priced too.
Title: Re: Guitar-to-MIDI project article
Post by: Diodac on November 25, 2013, 05:41:28 AM
Hi all
I'm new here :)
Post G2M interested me for a long time. I built several MIDI pitch tracker but do not work best with the guitar.
I built G2M and it is almost perfect for playing a guitar solo.

I'm not a the best PIC programmer and I have a question which suggests to change the source code to G2M worked with a bass guitar ?

I think the change table " MIDI NOTE DATA TABLE " according to the bass guitar but I'm not quite sure what values ​​to enter in the table. Because originally not reads the lowest tones of 6 threshold the down! My dream is that my bass playing all sounds :)
Is it enough to change the tables or something else I need to change in the code? I beg help make a change :)

Other issues of G2M -Polyphonic
I think of polyphonic interface, need to do four interfaces, one for each string and pick-up polyphonic make . MIDI merge used to sum all MIDI OUT to one channel. Maybe a good option ? What they think ?

Second idea - Read slides
Mate Stephen Hobley built a very good pitch tracker for theremin.
http://www.stephenhobley.com/blog/2011/01/24/pitch-and-volume-tracking-midi-interface-for-the-theremin/

I built it out of original plans from him, works well for guitar, reads the slides and and changes tone with floyd rose bridge! so good for freatless guitar but there is one f. problem ... controller not sends note-off message :D I want it overcome but far without results. Stephen does not help, I wrote to him. If they want, I share via email some schematics and code. The project was really interesting. We can expand and rebuild our guitar needs.

The third idea - Modulation,

I decided the G2M add of a system that will recognize changes in the modulation of sound when the tension of the strings, etc. and  send messages, for example Rezonance or Cut-of. Need to use another uC and circuitry. I have an idea and I'm going to do this.


Someone asked about the G2M original code, please be here:
ASM - https://drive.google.com/file/d/0B54jdI_xntNTeHBnNEltZG5FTjQ/edit?usp=sharing
HEX - https://drive.google.com/file/d/0B54jdI_xntNTUThZWXI3NWNid3M/edit?usp=sharing

Best regards for all
Arkadius from Sydney
Title: Re: Guitar-to-MIDI project article
Post by: deadastronaut on November 25, 2013, 06:33:06 AM
hi welcome.. 8)

i have no idea with code etc, but i would be interested in a new improved version of this...its great fun.
Title: Re: Guitar-to-MIDI project article
Post by: potul on November 25, 2013, 08:19:16 AM
Let me try to answer some of your questions and give my  2 cents....

-Bass:

I think this was discussed some posts before in the same thread...
The original project is designed for guitar and will not track the lower notes on a bass. This is due to the fact that the PIC reads only 12ms of data trying to find zero crossings. 12 ms is not enough for bass guitar (a typical 4 strings bass goes down to 41Hz). So you will need to increase the sampling time to at least 24ms or more. In addition, you will need to modify the note_table and review the piece of code in "MIDINOTE", probably it needs some adjustments.
As you will be doubling the sample window, you will have some more latency. Maybe some optimization could be done here to avoid it.

-Polyphonic

This has also been discussed in the past.
Having the same interface 4 times and then mix the MIDI signal looks overcomplicated. I would rather go into building a completely new project reading 4 ADC in parallel in the same PIC.  PIC 16F88 has up to 7 Analog pins, and it can run up to 20Mhz wiht an external cristal, so in theory you could read 4 ADCs and do the note detection in parallel and you would still have free cpu cycles. (the original project runs at 4Mhz)

Of course, this would require a major re-coding of the project... almost start from scratch.
On the other hand, you will need a quadraphonic pickup to get the signal of each string separately.

-Read Slides:

I did a modification to the software that allows for reading slides in the guitar. It only works in steps of semitones, so it does not work for bends, tremolos, etc... You have the modified code somewhere in the thread.
If you want to go beyond this, it gets very tricky. I recoded the whole thing trying to get bends to work and I didn't succeed. I think the algorithm has some limitations and it does not detect accurately enough to be used this way.
If I would start a similar project now I would probably go using a more powerful dsPIC, and use some kind of autocorrelation or combined autocorrelation with FFT tecniques.
I haven't looked at the theremin project, but looks interesting. If your problem is the note-off, you need to define how the device will determine when to send a note-off.
What you can do is send a note-off when sound amplitude goes below a threshold, or when a new note is detected.


-Modulation:

Same as above. If you want to detect vibratos, etc... you need to have a better detection algorithm.

My general advice is to consider that this project has some limitations, but it does what it does reasonably well. But if you start adding requirements to it, it's probably better to start from scratch using more modern DSP techniques.

I hope this will be of some help.

Regards




Title: Re: Guitar-to-MIDI project article
Post by: Diodac on November 26, 2013, 05:58:40 AM
Buddy Potul
Thank you for your answer helped me a lot.

I'd like to do is my dream, but the lack of a knowledge base to adapt the code to the bass as well as the usual guitars and even at 4 or 6 independent ADC.

My thought with 4 independent circuits and MIDI merge results from a "go shortcuts" because they do not have to modify the code, but the idea that a single processor can be done is wonderful.

Already stop to such rarities as the detection bending, slides, tremolos etc. :)

The option to use dsPIC good but out of my reach, at least for now: - \
FFT and autocorrelation solves many of the problems I think.

G2M regards the improvement could be used, for example, filters, or other solutions.
I tried, Smith Tigger from the Tom Scarff, I connected directly to the input PIC16F88 improved some problems with overlapping harmonics but there are new ... do not read high tones correctly. Similarly, when I used the Delta-Sigma modulator input before TL072.
 
Anyway, still looking for the optimal input interface, because it determines the major part of the success.

Potul please help me with made ​​into G2M on poly-bass, or at least mono B2M :)? I'll take care of finding the perfect harmonic filter and the input.

With modulation I thought to do a trick involving the use of the frequency to voltage conversion and adding some simple ATmega168 uC that will send control change messages or something. I used to do another project where I used this trick can up that will do it in G2M

Today, many have tested the system by Tom Scarff Pitch2Midi. I know that you Potul you checked it too. It would could do to the guitar. It reads good tone, quite resistant to less clean strum. I was so impressed, copes with bass guitar and solo .. I try to reach as Tom defeated the problem of 24ms and passing through 0 - reads the entire range of tones! But the defining the end of the amplitude is poorly done because it takes an awfully long time. Maybe to do as the G2M is a project of Tom would be something really good. Maybe a way to detect new note will be a better solution?

Potul you could fix it in a project of Tom?




Project Stephen - I sent you email something to the watch :)

Best regards
Title: Re: Guitar-to-MIDI project article
Post by: potul on November 26, 2013, 11:34:10 AM
I've been digging into the project to see how difficult it would be to adapt it to bass. I think that only by changing some numbers you can achieve it.

First of all, we must expand to 24ms the timing for note peak detection in lin 204 change 2 by 4

;--- WAVEFORM PEAK LEVEL DETECTION FOR 12MS ---

PEAKS
CLRF PEAKH
MOVLW 255
MOVWF PEAKL
MOVLW 4
MOVWF DELAY1


Now we need to increase as well the timeout threshold for frequency detection in the TIMING routine. This is done by changin "BTFSC    TMR1H,5"  to "BTFSC TMR1H,6" in all 4 occurences. This will double the time to wait until failure.



;---- MEASURE TIME FOR ONE WAVE, BETWEEN PEAKS -------
 

TIMING CLRF TMR1L
CLRF TMR1H

T1 BTFSC TMR1H,6
GOTO TERROR
BCF MARKER,3
CALL ADC
MOVF TRIGL,W
SUBWF ADRESH,W
BTFSC STATUS,C ;IS ADRESH - TRIGL +VE IE CARRY SET?
GOTO T1 ;NO, SO RETEST UNTIL IT IS

T2 BTFSC TMR1H,6
GOTO TERROR
CALL ADC
MOVF ADRESH,W
SUBWF TRIGH,W
BTFSC STATUS,C ;IS ADRESH - TRIGH +VE IE CARRY SET?
GOTO T2 ;NO, SO RETEST UNTIL IT IS

CLRF TMR1L
CLRF TMR1H
NOP

T3 BTFSC TMR1H,6
GOTO TERROR
CALL ADC
MOVF TRIGL,W
SUBWF ADRESH,W
BTFSC STATUS,C ;IS ADRESH - TRIGL +VE IE CARRY SET?
GOTO T3 ;YES, SO RETEST UNTIL IT IS

T4 BTFSC TMR1H,6
GOTO TERROR
CALL ADC
MOVF ADRESH,W
SUBWF TRIGH,W
BTFSC STATUS,C ;IS ADRESH - TRIGH +VE IE CARRY SET?
GOTO T4 ;NO, SO RETEST UNTIL IT IS

BCF T1CON,0 ;STOP THE TIMER TO RETRIEVE THE DATA

MOVF TMR1L,W
MOVWF LOBYTE

MOVF TMR1H,W
MOVWF HIBYTE

BSF T1CON,0 ;RESTART THE TIMER
RETURN

TERROR
BSF MARKER,3
RETURN




Now we need the code to compute correctly the octave (original code cannot go below note 35 and we need to go down to 28). This is achieved by changing 2 things, on one side we have to change the octave offset in line 239. Change 48 to 60


;----- GET MIDI NOTE FROM FREQUENCY TIMING ----------

MIDINOTE  BCF MARKER,1
MOVLW 60


And the last change is we need to decrease all numbers in NOTE_TABLE by 12.


;------ MIDI NOTE DATA TABLE ----------

NOTE_TABLE ADDWF PCL,F

DT 35,35,34,34,34,34,34,34,34,33
DT 33,33,33,33,33,33,33,33,33,32
DT 32,32,32,32,32,32,32,32,31,31
... etc....



I haven't included the whole table, you should be able to do the math on your own, it's only subtracting 12 to all numbers.

I haven't tried it, but on paper it looks like this should do the trick and give you one lower octave of range.

Give it a try and let me know.

Mat

Title: Re: Guitar-to-MIDI project article
Post by: potul on November 26, 2013, 11:40:49 AM
Quote from: Diodac on November 26, 2013, 05:58:40 AM

I tried, Smith Tigger from the Tom Scarff, I connected directly to the input PIC16F88 improved some problems with overlapping harmonics but there are new ... do not read high tones correctly. Similarly, when I used the Delta-Sigma modulator input before TL072.

If I recall it correctly, it is not needed to add the smidth trigger to our G2M and it will deliver low value and degrade the velocity sensing. This was needed in Tom Scarff project because he was using a digital input for frequency measuring, and a separated analog input for amplitude. In G2M project, we just use an analog input and do the equivalent to the smidth trigger via software.

Title: Re: Guitar-to-MIDI project article
Post by: Diodac on November 27, 2013, 01:54:53 AM
Mat double thank you :) Done. However, I do not know what the conversion to Intel 32 hex file 90kb it weighs too much. Programmer crashes that message above the permissible size for 16F88
What could I have done wrong .. after all it's a breeze : - \ so glad once I play the bass midi : (

It gives the code for inspection by interested : https://drive.google.com/file/d/0B54jdI_xntNTVWg3ZGFPR0xaMnc/edit?usp=sharing


Maybe someone here will convert and throw good hex : D and now I still will search for my mistakes.

Regarding the draft Tom Scarff , I know that do not need Shmidth Tigger , etc. I tried what happens and what the effect will be.
 
To our will need a good filter but it experimentally  we must choose.

I am very intrigued the design by Tom, if in some way to improve the detection of the end of the amplitude, I have an idea how to do it all in one digital filter harmonics and Shmitd Tigger for the digital input from in audio.

I still want to do the project by Stephen,  another G/B2M :)
because those give you the ability to detect bending, etc.

It's fascinating to find the best way to unique B/G2M we have to try everything.
Regards Ark
Title: Re: Guitar-to-MIDI project article
Post by: potul on November 27, 2013, 03:14:26 AM
The file looks good.

Just to be on the safe side.... did you compile it before trying to send it to the PIC?   8)
If yes, what compiler did you use? Standard MPLAB?
Title: Re: Guitar-to-MIDI project article
Post by: Diodac on November 27, 2013, 03:41:55 AM
Yes I did compile before sending. Almost got tears in my eyes : - \ I'm using MPLAB IDE v8.43, v2.40 PICkit programmer.

I still do not go, maybe a newer version of the compiler help?
Title: Re: Guitar-to-MIDI project article
Post by: potul on November 27, 2013, 04:23:18 AM
Just in case I will compile it and send it to you. As I have always a virtual machine configured for MPLAB it will take 5 minutes.
I will send it via email.

Mat
Title: Re: Guitar-to-MIDI project article
Post by: potul on November 27, 2013, 04:26:41 AM
Done it.
You should have it in your email... :)

Give it a try and let us know. Once you verify it works we can add the slide/hammeron/hammeroff tracking code from my modified G2M and see if it works.

Mat
Title: Re: Guitar-to-MIDI project article
Post by: Diodac on November 27, 2013, 05:35:28 AM
I have to set everything, but something tells me that I need to bring an old computer out of my garage on back to main work. There on XP it was all good: D

Mat do not know how I return the favor you for your help :) WORKS with my bass :) also continue to work with the guitar!
I am more than happy that so
I think we can go ahead with the project. Make new things tracking slides.
After the first tests, I conclude that it is really OK, bass guitar does not do much problems as it was in version G2M even with the guitar. Circuit has become somewhat more resistant to the harmonic and sloppy strumming a guitar solo as well. What surprised me positively. Now I take to be the filter.

The only thing we can somehow improve at least a minimum response time to new note? Where should I try?
Even if not it's still a very good result:-D


You know, I keep thoughts of the polyphonic bass I am, look at the code and wonder how to go in this direction.
Title: Re: Guitar-to-MIDI project article
Post by: potul on November 27, 2013, 06:59:00 AM
I'm happy to see it works.

Regarding the response... do you mean that there is some lag between your string pluck and the MIDI note being sent?

I guess this has now got worse because of the increased "listening" timing to accomodate for bass wavelength..

Looking at the code... I guess something could be done to improve this, because now I think it first detects amplitude, and only when it decides there is a new note, it starts tracking pitch. This adds some delay that maybe could be reduced. I will think about it...
Title: Re: Guitar-to-MIDI project article
Post by: Diodac on November 27, 2013, 07:38:32 AM
Great, I'll be thinking and go tests in the direction of the optimal filter harmonics :D
Title: Re: Guitar-to-MIDI project article
Post by: potul on November 27, 2013, 10:17:56 AM
I took a deeper look at the code during luch break...
I see that part of the latency is due to the uneffective algorithm used. Let me explain more or less what the PIC is doing:

-Monitor ADC during 24ms. Register min and max values and compute amplitude based on this. Compute positive and negative triggers (these will be used to compare with signal and find if we are in a peak)
-If a note is detected, start reading ADC again and wait for a negative peak (comparing with the trigger).
-When a negative peak is detected, wait for a positive peak. When this is detected, it means we just transitioned from a negative to positive peak, and we start counting time.
-Repeat the wait for negative-wait for positive peak again. When the second positive peak is detected stop the timer.
Now with this time measured we can compute the frequency and midi notes.

The issue is that the first step of detecting amplitude takes already 24ms, and the pitch detection for a low E can take between 24ms and 48ms depending on the point of the wave we are when we start measuring. This can be a worst case of 70ms latency plus some added lag due to computation.

Theoretically we can shorten this simply by having a smarter code. I.e, if we don't wait always for a negative peak to positive peak to start the timer, and we simply look for whatever transition, this can reduce by 12ms the max latency. And we might be able to find a way to do the amplitude detection at the same time we do the frequency measuring... but this would require some thinking, as in the pitch detection we use the amplitude found in the previous step.

Title: Re: Guitar-to-MIDI project article
Post by: potul on November 27, 2013, 11:54:26 AM
Going back to things... I've adapted the G2MPlus to Bass as well. I'm sending you the hex file via email.   8)
It should be able to track slides/hammer-on/hammer-off now. (note that hammer on-off of more than 5 frets will not be tracked, but this can be modified in the code if needed)

In order to use the new feature, you need to add an extra switch to the PIC. The program is reading RA1 (pin 18), if it finds 5v is uses the slide/hammeron, if it reads 0v it will stay "classic" without tracking slides.
If you don't have a switch, just stick 5v to RA1 with a jumper to test it.

Mat
Title: Re: Guitar-to-MIDI project article
Post by: Diodac on November 28, 2013, 05:37:25 AM
B2Mplus tested , and I have some thoughts on what we can do  :icon_biggrin:

1 Slides, hammer on / off 5 thresholds think as we increase will give us a better effect of liquidity in playing . We can pick up about 100% ?
Now with 5 begins to react well to bending , etc. I think that as we raise will be even better. We have to check it out .

Then we can attempt to a trick , namely to obtain the most realistic bending , etc. moreover, we need to introduce additional reading next ADC and sending from CC messages . Reading frequency and calculation , hammer on / off just as we have done, but must convert to CC # 1 0-127 , no note on / off .

This will allow us to get I think the most realistic reflection of the audio signal from the guitar .
Sometime in other audio-midi project taken at the Arduino platform I used a similar trick I used this with CC # 1 and it worked well. Only there did 0-5V input to the ADC and here we have to do reading frequency and amplitude.

2 Now I kind of shifted in time
Delays detection and delayed the end of how hold function, even when immediately after striking dampens the strings. As if that is not the resistor, because I use ok.330k

Smarter code , reduce the time from 24 to 12 ms and the way to look at any of the transition and the amplitude of this idea very well. We should try to achieve it.


3 Programming sustain / hold function similarly run like a hammer .
I think it should work in the following way , it keeps the detected note and the amplitude drops to a low , goes to detect the next .

See here http://www.instructables.com/id/Frequency-Detector-using-PIC-12F683-Processor/?ALLSTEPS its a very useful and helpful article to our idea of ​​B2M

Ok I'm going to test and optimize the harmonic filter  :icon_twisted:
Title: Re: Guitar-to-MIDI project article
Post by: potul on November 28, 2013, 06:27:52 AM
Quote from: Diodac on November 28, 2013, 05:37:25 AM
1 Slides, hammer on / off 5 thresholds think as we increase will give us a better effect of liquidity in playing . We can pick up about 100% ?
Now with 5 begins to react well to bending , etc. I think that as we raise will be even better. We have to check it out .
This will not work. This is not how the code works... 5 means you can only hammer-on notes separated by 5 semitones. If you increase this number you will only be able to do hammer-ons with higher intervals, but it will not improve accuracy, in fact it will probably get worse. This is the reason I added this limit, to avoid octave jumps and similar.
On the other hand, bending will be detected as it is now, but only in full semitones steps. The code is going to resolve always to the closest midi note, but no bending info will be sent. This means that if you do a bend, the note will change in steps, not smoothly

Quote
Then we can attempt to a trick , namely to obtain the most realistic bending , etc. moreover, we need to introduce additional reading next ADC and sending from CC messages . Reading frequency and calculation , hammer on / off just as we have done, but must convert to CC # 1 0-127 , no note on / off .
This will allow us to get I think the most realistic reflection of the audio signal from the guitar .
Sometime in other audio-midi project taken at the Arduino platform I used a similar trick I used this with CC # 1 and it worked well. Only there did 0-5V input to the ADC and here we have to do reading frequency and amplitude.
The issue is not sending note-off/note-on or sending CC messages for bending. The issue is that this algorithm with this PIC is not able to accurately detect bends. If you want to detect bends (and go below the semitone resolution), you need to start from scratch. I'm not saying it can't be done using this PIC, but code must be rewritten and probably we would need to increase operating freq to 20Mhz with an external crystal.

Quote2 Now I kind of shifted in time
Delays detection and delayed the end of how hold function, even when immediately after striking dampens the strings. As if that is not the resistor, because I use ok.330k
I don't get the point...What is the issue here? that the note is ending too early?
Title: Re: Guitar-to-MIDI project article
Post by: potul on November 28, 2013, 08:32:50 AM
Quote from: Diodac on November 28, 2013, 05:37:25 AM
See here http://www.instructables.com/id/Frequency-Detector-using-PIC-12F683-Processor/?ALLSTEPS its a very useful and helpful article to our idea of ​​B2M

Oh, I forgot to mention. The article you linked is interesting, but will not work for us. I already went down this road some time ago....
The Goertzel agorithm that is used in this article is used to detect a concrete frequency in a signal. In some way, it is like doing an FFT only for one bin instead of the full spectrum.
It could be used maybe for a tuner or similar, where you have a target frequency you want to detect, but not for a pitch tracker.

According to my knowledge after reading multiple articles here an there, for monophonic pitch detection nothing beats autocorrelation derived methods in terms of accuracy. But... you need a lot of calculation power and big samples.
An interesting autocorrelation based method is SNAC. Take a read at this link if you are interested in the topic:  http://www.katjaas.nl/helmholtz/helmholtz.html (http://www.katjaas.nl/helmholtz/helmholtz.html)

In the frequency domain, Cepstral analysis seems to work fine as well, but I've never tried to use it.

Anyway, neither autocorrelation nor FFT analysis are in the ballpark of what we can do with this PIC, so we need to stick to zero detection unless we want to jump into more powerful uC.

Title: Re: Guitar-to-MIDI project article
Post by: Diodac on November 28, 2013, 09:11:35 AM
OK not touch the hammer this time  perhaps.

I'd tried to pick up the PIC into 20Mhz and we introduced modifications to the code as far as you like. It will surely make this project very special. I am also willing to migrate up here if the can not. But it seems to me that the PIC can suffice if the to conquer into 20Mhz and improve our algorithm, add the filter and the idea that I described in the email.
I hope ..
Migration is a big job looks but why not in the future  8)
QuoteI don't get the point...What is the issue here? that the note is ending too early?
I mean it's too late finishes but the value of the capacitor gave, 22pF and 250k resistor. It helped.
Start delay are for obvious reasons 24ms etc.

I'm sorry that sometimes my words are difficult to understand English is my second language.


Article that you offered promises to be very interesting. SNAC seems that it must work well.
Title: Re: Guitar-to-MIDI project article
Post by: Diodac on November 29, 2013, 08:53:18 AM

I made some tests to safely B2Mplus and another more specific thoughts I have.
Test without a low pass filter :
1 Shades shoots each time there is no problem unless they come to the front overlap harmonics.
2 Hammer lightly not keep up - the reason? too many components in the sound , requires a filter , skipping the code we need to do a little intelligent .
3 Reading the key long - as above, the signal has to be filtered is somewhat shorten the time and improve . And then we should try to read it at 12ms .
4 And the most painful problem of uneven and too late detection
plucking and jerking strings - filtering can help a little .
Ideas for improvement :
Pick a few filters, today I started the bread board , tests and will continue all weekend. Later I will write here what has improved and will add schematic of the applied solution .
I think we should also browse the code relating to the problem of 24ms and especially the detection of plucking the strings .
Already at the beginning can we put an external crystal 20Mhz for our future expansion.
This time I'm looking for a good solution to the LPF and I will inform about the progress .
Title: Re: Guitar-to-MIDI project article
Post by: Diodac on December 01, 2013, 06:10:41 AM
As promised , B2M tests done. I tried the bass and solo . For clarity, 90 % of the problems of overlapping tones appeared in the " hammer on" in normal mode B2M is delayed reading pitch and

plucking .

I wanted to solve the problems :
- Overlapping tones.
- Delays and errors occurring during rapid plucking the strings , etc. .
- Delay reading the key .

Use less intelligent filter LPF 2 and 4 in a row, composed of op-amp type TL074 , LF347 or TL084 little help I would say even more hurt when B2M worked in " hammer "

In the next weeks the tests carried out with an intelligent filter LTC1065 . During testing, I came to the conclusion that a positive result can be achieved through the use band equalizer that

tomorrow I will try to check .

Therefore, it attempts to apply the active filter did not help , I watched the whole arrangement again and decided to rearrange something .
In place of the TL072 which I put TLC272 works well in 5V and has better performance for this project. In addition, R2 replaced the potentiometer 1M. Smooth adjustment resistance was very helpful,

because it allowed exactly set the input level to the PIC.

I turned on everything and came to the expected result. There have been improvements.
In the "hammer" and normal and bass guitar.
- Significantly minimized the problem of overlapping tones.
- Improved reading speed tones
- A much faster process picking.

The need to accurately determine the input level to get equilibrium. Because the large entry level picking good but overlapping appear.
After connecting a guitar solo and change the level of the input signal using a potentiometer was also a significant improvement.

When working with a guitar solo here, you can apply the filter:

https://drive.google.com/file/d/0B54jdI_xntNTY0RxQ1poVGM2ZGc/edit?usp=sharing

Plug in directly to the input.
Op-amp - TLC272 powered symmetrical + - 5V

This filter helps in B2M with a guitar solo. Makes B2M becomes universal. Much eliminates overlap of tones. Use only with a guitar solo.

Did not check this filter with a classic G2M, and a guitar solo but there also should help. With free time G2M check the filter and write what happened.


Overall, I'm glad I improved design for my needs. Check yet LTC filter as it will work.

As regards the improvement of code:

I think we need to try the method of 12ms for B2M and any other convertion. Not to count everytime anew just looked in. Mat knows how to do it :)

Mat if you found moments of time that would be great.

When we improve everything we can then think of other modifications.


I think it's almost good, improved code that will do almost perfect 8)



Title: Re: Guitar-to-MIDI project article
Post by: Diodac on December 04, 2013, 12:53:03 AM

Written I have made changes to the hardware, and also in the code. Later describe more because at the moment I do not have time.
Title: Re: Guitar-to-MIDI project article
Post by: potul on December 04, 2013, 01:50:47 AM
Good to see it in action!

:D
Title: Re: Guitar-to-MIDI project article
Post by: deadastronaut on December 04, 2013, 05:17:30 AM
^ yeah cool... :icon_cool:
Title: Re: Guitar-to-MIDI project article
Post by: Diodac on December 04, 2013, 09:45:56 PM
The changes that I made in the code
Setup

        PAGE1
MOVLW B'01101100'
MOVWF OSCCON ;INTERNAL OSC SET TO 8MHZ


Waveform Peak Level Detection,   line 222  change to 250

;--- WAVEFORM PEAK LEVEL DETECTION ---

PEAKS
CLRF PEAKH
MOVLW 255
MOVWF PEAKL
MOVLW 4
MOVWF DELAY1
CL2 MOVLW 250
MOVWF DELAY2


Turn on line 439

;Insert here code to keep tracking frequency

CALL    NOTE_CHANGE
movwf TEMP
btfss TEMP,0
    GOTO NOTE_OFF ;KEEP READING ADC
BCF MARKER,0 ;AMPLITUDE DETECTION ACTIVE
goto NEXT2


Later I will update hardware changes. Although I would prefer to wait until the end of the experiments and publish all in one thread. In order not to make a mess in the topic  :icon_biggrin:
Title: Re: Guitar-to-MIDI project article
Post by: potul on December 05, 2013, 02:52:35 AM
Some comments regarding the code change:

The last one, the "amplitude detectio active".... Looks OK. I remember I put this line of code thinking it should work but I had some issues with the LEDs not working as expeted and I commented the line. But... if it now works, great.

Regarding the OSC change, I'm a little puzzled here.You changed the system frequency to 8Mhz, but you did not change the TMR1 prescaler, so at the end the timer is running at double speed. Are you getting the notes in the correct octave? I would expect that everything is now one octave low.
On the other hand, I don't see much benefit in increasing the frequency without adding something else, ... you gain some ADC resolution, so you will probably improve something in the higher notes, but that's it.

And, you didn't change most of the delays in the code, so now everything is happening in half of the time. I see you increase a little the delay when detecting amplitude, but only around 25%. This means that now your amplitude detection range is around 15ms... If it works this way, great! But I would expect some issues with pulse and velocity detection for the lower notes because you are not waiting for a full note period.
There are some other delays in the project that control somehow how long to wait until deciding that the note detection failed. These are now half of the time, so you might have issues with notes not detected (too soon)

Title: Re: Guitar-to-MIDI project article
Post by: Diodac on December 05, 2013, 03:58:44 AM
Not quite done as I would like, I'm not sure the correct values​​. Especially in raising the 8Mzh.
Some errors happen.
You could share scraps properly revised code? Would be the a reference point. :D
Title: Re: Guitar-to-MIDI project article
Post by: Diodac on December 16, 2013, 04:09:51 AM
Small update:
- Separation of the ground and power supply for the digital part and the analog signal quality has improved much. Gone interference.
Still ongoing experiments using active lowpass filters MAX Linear Technology Series, LTC and various high quality Op-Amp.

Although I now have less time to design and writing of the work in progress. After Xmas write that filter worked best and I will add an updated schematic.
Title: Re: Guitar-to-MIDI project article
Post by: Diodac on December 27, 2013, 08:18:38 AM
So far the best working version of B2M or G2M

https://drive.google.com/file/d/0B54jdI_xntNTT1JPSDZQOHBUSms/edit?usp=sharing

As can be seen above I made major changes. I invite colleagues to test the system.

I test yet 3 other projects and I finish testing I'll report.

I think that when Potul will optimize the code by which we discussed will be full of happiness.

Regarding the polyphonic
Potul advised to do it at a faster processor. I do not really feel up to do it. I have no such knowledge.

At the beginning I thought  do six parallel systems and combine them into one MIDI output. I see how this will work as a polyphonic system.

I wonder how to connect the 6 inputs to one output, all on channel 1
I use the gate AND - CD4073B in a way as in the attached diagram.

https://drive.google.com/file/d/0B54jdI_xntNTR3M5cERjSm14NEU/edit?usp=sharing

Does it have a chance to work properly? Is the unused pin 12 connect to ground?

How about it?
Title: Re: Guitar-to-MIDI project article
Post by: potul on December 28, 2013, 02:38:49 AM
This midi merger will not work. Midi is a stream of serial data, you can't simply connect the outputs because the messages will be scambled. You need some sort of intelligence here (pic or similar) to read the messages, and then send them into a single output.

This is one of the reasons I told you I think it's much better to do this with a sinbgle unit. This way you don't have to merge because all messages are genetared by a single PIC.
Title: Re: Guitar-to-MIDI project article
Post by: Diodac on December 28, 2013, 04:01:53 AM
The idea of using the AND gate someone suggested to connect a MIDI (found on the internet) but seems to me that it will not work.

Using single PIC is the best idea.
I thought about 16F886 because it has more ADC.
16F88 is 7 ADC it would be enough, but the project B2M, the PIC has already occupied 4 ADC:

AN2 AN3 - enter of voltage. (It seems necessary, might be able to move to other pins?)
AN1 - designed for GLIDE
AN4 - audio input

Remains of 3 ADCs, bass 4 strings can be done. I still have a 6 string bass and guitar.
I would like to make these instruments polyphonic MIDI.
Here I have a problem because they lack the ADC.
Potul see any way out other than the use of a PIC with more ADC?
Title: Re: Guitar-to-MIDI project article
Post by: Diodac on December 31, 2013, 02:16:38 AM
I would try first MIDI Merger 6IN to 1OUT.
Processing of the code so that single PIC controlled and sent is to do, but it seems to me difficult.
Besides the option to 6 controllers has one serious advantage for each string, you can customize the code. Perhaps ..

I found a cool project MIDI Merger, 2IN 1 OUT is also on the PIC16F88. This can be extended to 6 IN.
; $Id: main.asm 224 2008-03-27 19:53:03Z tk $
;
; Source Code of MIDI Merger

; ==========================================================================
;
;  Copyright 2003-2008 Thorsten Klose (tk@midibox.org)
;  Licensed for personal non-commercial use only.
;  All other rights reserved.
;
; ==========================================================================

#include "midibox.h"
#include "macros.inc"

; ==========================================================================
; Explanations of the include files
;
;  CODE PAGE #0
;    midibox.h:    A lot of flags, defines, register locations
;    macros.h:     my private macros
;    reset.inc:    reset handler
;    irq.inc:      interrupt handler, the MIDI IN part
;    init.inc:    various initialization routines
;    midi.inc:    Send and Learn MIDI
;    mainloop.inc: The MIDI Receive Handler
; ==========================================================================

;; org in include file
#include "reset.inc"
#include "irq.inc"
#include "init.inc"
#include "midi.inc"

Start
call Init
#include "mainloop.inc"

org 0x0700
#include "contab.inc"

;; ==========================================================================

END



I add a diagram where I plan another entry, is also a code that supports 2 IN.

(http://obrazki.elektroda.pl/6168690200_1388472948.png)

Colleagues, as you do on 6 IN? I have no idea..
Title: Re: Guitar-to-MIDI project article
Post by: potul on January 03, 2014, 09:33:58 AM
Hi

Can you give us the link of this midi merger project? I need to check if it is using the internal USART or bit banging... And I need to review the full code.

Mat
Title: Re: Guitar-to-MIDI project article
Post by: potul on January 03, 2014, 09:45:44 AM
Quote from: Diodac on December 28, 2013, 04:01:53 AM
The idea of using the AND gate someone suggested to connect a MIDI (found on the internet) but seems to me that it will not work.

Using single PIC is the best idea.
I thought about 16F886 because it has more ADC.
16F88 is 7 ADC it would be enough, but the project B2M, the PIC has already occupied 4 ADC:

AN2 AN3 - enter of voltage. (It seems necessary, might be able to move to other pins?)
AN1 - designed for GLIDE
AN4 - audio input


Oh... you are right... I forgot agbout the reference voltages in AN2 and AN3.... I'm not completely sure they are needed indeed... maybe we could do it without them. We might lose some ADC resolution, but at the end we are more interested in the frequency than in amplitude...
Title: Re: Guitar-to-MIDI project article
Post by: Diodac on January 04, 2014, 02:30:31 AM


a link to the draft merger: http://www.ucapps.de/midimerger.html

Well, there are reference voltage must remain there.

It remains to migrate to larger PIC or merger.

For me the merger is a better option because it will allow each PIC and code set individually for strings. In one MCU is difficult to achieve. It requires a lot of new code.




Title: Re: Guitar-to-MIDI project article
Post by: Freppo on June 12, 2014, 04:13:39 AM
Hi there folks

I built this one yesterday (the original projects with a mods suggested here). Works wonderfully. :)

Here is a verified vero layout that I made
(http://parasitstudio.weebly.com/uploads/2/4/4/9/2449159/guitar_to_midi.gif)

cheers
/ Freppo
Title: Re: Guitar-to-MIDI project article
Post by: potul on June 12, 2014, 04:45:56 AM
Nice!

Thanks for sharing

Title: Re: Guitar-to-MIDI project article
Post by: jishnudg on July 24, 2014, 03:30:44 AM
Quote from: Freppo on June 12, 2014, 04:13:39 AM
Hi there folks

I built this one yesterday (the original projects with a mods suggested here). Works wonderfully. :)

Here is a verified vero layout that I made
(http://parasitstudio.weebly.com/uploads/2/4/4/9/2449159/guitar_to_midi.gif)

cheers
/ Freppo



Thanks Freppo!  could you also put up a link to the files and schematics you have been used for this build? I'd like to make a few different folders on my PC for all the verified builds for this project, just to compare.
Title: Re: Guitar-to-MIDI project article
Post by: jishnudg on July 24, 2014, 03:33:36 AM
Quote from: Diodac on December 27, 2013, 08:18:38 AM
So far the best working version of B2M or G2M

https://drive.google.com/file/d/0B54jdI_xntNTT1JPSDZQOHBUSms/edit?usp=sharing

As can be seen above I made major changes. I invite colleagues to test the system.

I test yet 3 other projects and I finish testing I'll report.

I think that when Potul will optimize the code by which we discussed will be full of happiness.

Regarding the polyphonic
Potul advised to do it at a faster processor. I do not really feel up to do it. I have no such knowledge.

At the beginning I thought  do six parallel systems and combine them into one MIDI output. I see how this will work as a polyphonic system.

I wonder how to connect the 6 inputs to one output, all on channel 1
I use the gate AND - CD4073B in a way as in the attached diagram.

https://drive.google.com/file/d/0B54jdI_xntNTR3M5cERjSm14NEU/edit?usp=sharing

Does it have a chance to work properly? Is the unused pin 12 connect to ground?

How about it?



Diodac, regarding your link,  https://drive.google.com/file/d/0B54jdI_xntNTT1JPSDZQOHBUSms/edit?usp=sharing

Is this verified? Are there significant changes to the HEX files as well?
Title: Re: Guitar-to-MIDI project article
Post by: markeprice on October 13, 2015, 04:45:30 PM
Did the Vero/strip board version work well?  Is it polyphonic?
Title: Re: Guitar-to-MIDI project article
Post by: potul on October 14, 2015, 01:55:11 AM
It is NOT polyphonic.
Accordig to Freppo the stripboard layout is verified..
Mine is built with stripboard but with another layout, so I can't tell personally.

Mat