Propeller Based - Guitar - Pitch to MIDI detector and sound module
Bob Lawrence (VE1RLL)
Posts: 1,720
There have been a few threads in the past that mentioned guitar pitch detection but not much follow up. I'm just putting all the discussions I can find in a single thread for continued discussion.
I will dig up the past links and list them here for discussion.
1 Open Stomp : I remember one from the Open Stomp thread and Eric had a few different ideas with a FFT based solution and this statement: "A tuner is in the cards. Pitch detection will be done in software."
I haven't heard a update on this.
2. Place holder : There was a project from Europe that I'll dig up and put the link here
I'll have to search for that thread.
3. shaunxcode: " I am looking to use a propeller chip to do guitar to midi conversion" http://forums.parallax.com/showthread.php?p=719141
No follow up
3. Brads' guitar tuner can detect pitch : http://forums.parallax.com/showthread.php?p=838268
It's looking great and still in progress.
We also have several MIDI objects that can be used:
FFT: Phil's Goertzel object http://forums.parallax.com/showthread.php?p=838268
MIDI :
MIDI in :The MidiIn object supports receiving and parsing a standard MIDI stream, making the MIDI events available to the user in a very easy to use form. Complete documentation is included.
MIDI Sound module:
Propeller music synthesizer by Andy Schenk
This "General Midi" synthesizer with playback mode-0 midi files from SD. Various related tools in the thread include instrument experimentation, and the ability to play midi files directly from the PC using the Propeller's programming connection.
http://forums.parallax.com/showthread.php?p=797590
Rainbow Synthesizer by MPark: I will add this later
I have a commercial pitch to midi converter for a 10 string pedal steel guitar that works quite well. The basic design consists of the following :
- A special pickup with a set of magnets(10) and a coil (10) of wire per string .
==============================================================
Path for a Channel (controls two strings)
- A low pass filter with a frequency cutoff for a specific set of strings.
- A 0831 ADC (analog to digital converter)
- A gain control amp
- A 8 bit Intel microcontroller - Slave
- EPROM : program storage for the slave code.
=============================================================
- A 8 bit Intel microcontroller - Master
- A EPROM : Program storage for master code.
Using a Delta sigma AD conversion may be too noisy for this application. . Pure FFT on a prop is interesting but may not be fast enough for a real time pitch detector. Brad is already doing real time pitch detection with his guitar tuner but I'n not sure what code he's using.
Pitch detection without FFT DFT etc :
At a minimum I would use a LPF and a ADC chip
- Establish a signal threshold level.
- Detect the peak amplitude
- Start a timer and Sample waveform over time and look for slopes(between the rising and falling edges. The slopes for fundamental frequencies are consistent. .Sample T1, Sample T2, Sample T3 Sample T4, Sample T5 etc..
MIDI out:
Once the pitch is detected : Get the MIDI note value from a look up table, add the octave value , send the note on command from the MIDI object etc ...
@Brad; Ok let me know when your done the code.
OK it's after 2am and a work day tomorrow. I'll add more and edit later
Post Edited (Bob Lawrence (VE1RLL)) : 9/16/2009 4:59:43 AM GMT
I will dig up the past links and list them here for discussion.
1 Open Stomp : I remember one from the Open Stomp thread and Eric had a few different ideas with a FFT based solution and this statement: "A tuner is in the cards. Pitch detection will be done in software."
I haven't heard a update on this.
2. Place holder : There was a project from Europe that I'll dig up and put the link here
I'll have to search for that thread.
3. shaunxcode: " I am looking to use a propeller chip to do guitar to midi conversion" http://forums.parallax.com/showthread.php?p=719141
No follow up
3. Brads' guitar tuner can detect pitch : http://forums.parallax.com/showthread.php?p=838268
It's looking great and still in progress.
We also have several MIDI objects that can be used:
FFT: Phil's Goertzel object http://forums.parallax.com/showthread.php?p=838268
MIDI :
MIDI in :The MidiIn object supports receiving and parsing a standard MIDI stream, making the MIDI events available to the user in a very easy to use form. Complete documentation is included.
MIDI Sound module:
Propeller music synthesizer by Andy Schenk
This "General Midi" synthesizer with playback mode-0 midi files from SD. Various related tools in the thread include instrument experimentation, and the ability to play midi files directly from the PC using the Propeller's programming connection.
http://forums.parallax.com/showthread.php?p=797590
Rainbow Synthesizer by MPark: I will add this later
I have a commercial pitch to midi converter for a 10 string pedal steel guitar that works quite well. The basic design consists of the following :
- A special pickup with a set of magnets(10) and a coil (10) of wire per string .
==============================================================
Path for a Channel (controls two strings)
- A low pass filter with a frequency cutoff for a specific set of strings.
- A 0831 ADC (analog to digital converter)
- A gain control amp
- A 8 bit Intel microcontroller - Slave
- EPROM : program storage for the slave code.
=============================================================
- A 8 bit Intel microcontroller - Master
- A EPROM : Program storage for master code.
Using a Delta sigma AD conversion may be too noisy for this application. . Pure FFT on a prop is interesting but may not be fast enough for a real time pitch detector. Brad is already doing real time pitch detection with his guitar tuner but I'n not sure what code he's using.
Pitch detection without FFT DFT etc :
At a minimum I would use a LPF and a ADC chip
- Establish a signal threshold level.
- Detect the peak amplitude
- Start a timer and Sample waveform over time and look for slopes(between the rising and falling edges. The slopes for fundamental frequencies are consistent. .Sample T1, Sample T2, Sample T3 Sample T4, Sample T5 etc..
MIDI out:
Once the pitch is detected : Get the MIDI note value from a look up table, add the octave value , send the note on command from the MIDI object etc ...
@Brad; Ok let me know when your done the code.
OK it's after 2am and a work day tomorrow. I'll add more and edit later
Post Edited (Bob Lawrence (VE1RLL)) : 9/16/2009 4:59:43 AM GMT
Comments
What are the minimum and maximum frequencies you need to detect? I assume you want full chromatic coverage in between, right? Given that most instruments are rich in harmonics, how important is it to know which octave the fundamental is in?
-Phil
For a 6 string guitar:
E string (Big E) 82.4068892282 Hz
A String 110.0000000000 Hz
D String 146.8323839587 Hz
G String 195.9977179909 Hz
B String 246.9416506281 Hz
E String (little E) 329.6275569129 Hz
For Brad chromatic tuner: It does full 7 octave chromatic from A0->G6. = MIDI 21( 27.5000000000) to 93 (1760.0000000000)
For my Pedal steel the overall range is: My open string tuning starts at F#4 - B2 but I also have 5 knee levers and 4 floor pedals that can raise or lower the pitch of a string. The overall range is
If I use a special pickup for MIDI I can design a pitch detector that has a range per string.
If I use a FFT based approach the the range would be : A2 - A6. (within Brad's tuner range)
MIDI note Freq Chart:
tomscarff.110mb.com/midi_analyser/midi_note_frequency.htm
re: how important is it to know which octave the fundamental is in?
The harmonics are not important for this application. We can strip out the harmonics when possible. If there was a easy way to make bandpass filters in the prop we could make one per midi note/freq and that would make the rest of the detection easy. For example In a commercial 6 string guitar unit they use a LPF to cut off everything above 6.25 Khz .
=================================================================================================================================================
Example LPF that's used with a 6 string string pitch to MIDi converter
1. Audio input goes to the LPF and the LPF serves several functions:
A. It removes the high freq harmonics that are associated with the fundamental frequency of the input signal, which simplifies the signal that needs to be analyzed. Without a LPF to cutoff the frequency it's hard to determine the correct sampling rate.
B. It also reduces the aliasing effect on the period determination
3. The sampling rate must be twice that of the highest frequency component of the audio input signal.
4. The LPF will attenuate any signals that exceed the selected frequency
5. 12.5 kHz sampling rate is acceptable for frequencies at 6.25 Khz or less
6. uses a 3 pole low pass filter
7.The LPF provides 40 db attenuation of the signal
I am, but it's not suitable for this sort of task.
I have a table of all frequencies from A0 to G7 (I upped it an octave!).
The A/D is sampled 12 bit (19.6Khz). I have a very long time constant average to detect zero, a reasonably fast decay peak detector and a zero crossing detector.
I use anything over 7/8ths of the peak as a peak strobe. I use anything positive of zero for the LED strobe.
The LED strobe is connected directly to an output pin and drives the common of all 32 tuner leds via a 2N7000.
The peak detector output is fed to another cog via a pin (so I can monitor it on the cro mainly, but it makes it easy to pass inter-cog also).
This cog times 4 complete peak cycles (In theory this should give me 4 cycles of waveform).
Once 4 cycles are complete we use the period to do a binary search of the frequency table to get a note. Intermediate frequencies are interpolated linearly to the closest matching note.
We need to see 5 cycles of identical note detection (so 20 string oscillations) before we pass the note onto the strobe cog to get it to change strobe frequencies.
The strobe cog simply cycles one led at the desired frequency x 32 (with dither to ensure accuracy) and continues this until a different note is accurately detected.
I've used it at 2 gigs now and found it simply incredible. I use a wireless, and I generally run the PA so I have to walk all over the venues to check the Mix. With this I *know* it gets the right note and the display comprised of 5mm leds is big enough I can tune from across the room and *know* it's spot on.
Having said that, it's quite a slow detection and with the noise I'm getting through the on-board A/D it's inaccurate enough to take up to 300ms to lock on to the right note. Once it's locked its solid (but that is because the tuning does not rely on accurate frequency detection, only zero crossing) due to the requirement for 5 accurate consecutive detection periods before it will change notes.
The problem with trying to do anything complex with the way I analyse the string is the funky waveshapes caused by interesting harmonics on the lower strings. Also, given the strat is prone to all sorts of interesting fret buzz it introduces even more interesting wave shapes.
From the D string and up it's all pretty simple, but getting accurate detection on the low E and A (and even worse, on my Bass) meant some pretty rough averaging, low pass filtering and lot's of retries to get an accurate detection.
You should watch the Low E on a cro and observe the waveform change from the time it's picked as it decays. The Harmonics are mad!
I used to have a little guitar synth with 6 individual pickup coils and a fat little cable to the controller, but it was Smile. Given individual pickups, low impedance coils and dedicated input circuitry I'm positive you could do a much better job, but getting the latency down below about 6 string oscillations is going to be somewhat of a challenge.
It's certainly something I'd be interested in participating in though. I have a couple of guitars I'm not shy to bolt extra bits on to [noparse]:)[/noparse]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
lt's not particularly silly, is it?
You really need a hex pickup for the guitar so you can get a sample from each string independently - things quickly become much more complex once you start dealing with inter-string frequency modulation.· Roland is pretty much the main player in this field; the older GK-2A models can be found on ebay for < $100, or the better cureent model GK-3's for ~$150.· I have seen some folks wind their own pickups, but the money spent on one of the commercial units is probably a good investment.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
In theory you get the same effect by just detecting which size of the zero cross you are on, but some of the funky harmonics on the low strings actually zero cross, so the square wave ends up with odd periods and edges. I tried that first [noparse]:)[/noparse] Peak detection has proved to be more reliable as if you use a slim enough threshold none of the harmonics trigger it.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
lt's not particularly silly, is it?
Eric was able to take a propellor and build a neat effects setup.
I got one of his pedals and had some fun with it....then we had a baby and I haven't touch any of my hobby gear in about 8months!!
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<FONT>Steve
What's the best thing to do in a lightning storm? "take a one iron out the bag and hold it straight up above your head, even God cant hit a one iron!"
Lee Travino after the second time being hit by lightning!
edit - this project uses the signal produced by std pickups, which obviously combines all strings.· While this will work for single string stuff, I'd think the best solution is·to use a hex pickup and use multiple copies of the analog front end for each.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Post Edited (Agent420) : 9/22/2009 1:18:44 PM GMT
Thanks for the info. It's an interesting design. On the cover what is the text just below " Guitar to MIDI system?
Is it " A Monophonic System that works with any guitar" ?
Therefore, its a single note system.
Ref: Monophonic (synthesizers), a synthesizer capable of sounding only one voice, or note, at a time
I did up a block diagram (below) last night of the commercial IVL Steel Rider system I use.
Yes.·
I've used similar software based realtime midi converters, they can work well for certain applications.· The primary benefit is that you can apply that type of converter to any guitar because you don't require special pickups.· As I alluded above, I think you could expand this idea using a hex pickup for a true polyphonic setup.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
The code for the article is available here: (Go to Oct download)
www.epemag3.com/index.php?option=com_docman&task=cat_view&gid=52&Itemid=38