Author Topic: digital pluck detector  (Read 9982 times)

ignsk

digital pluck detector
« on: July 03, 2007, 07:24:42 PM »
Hi there,
I was thinking of an anlog project I'm workin on wihich involves a "pluck destector". For this "pluck detection", I globally inspired from the AMS-100 module.  I am actually breadbording some stuff and and it starts going the I want.
But, and that's why I post in this thread, I was wondering wether the "pluck detection" could be much more easier the digital way and globally much more precise. The main aim of the pluck detector is to output gate and triggers signal (easy for a PIC) each time a note is plucked on the guitar. In the analog way, sound goes through several processing and tricks to try to estimate what is actually a pluck and what is fact envelop ripple.
The AMS-100 module is doing a great job but I wanted to have your opinion on the digital way to achieve this job (diffculity, accuracy of the detection, maybe speed issues,...). I was thinking maybe of some kind of "variable threshold pick detector" which keeps on evaluating the differece between the current amplitude of the input and the amplitude Xmillisec before. If this difference is higher than a certain value, let's say T (like threshhold), then a new note must have been stoke. If T could be made a function of the input amplitude then we could tweak the threshold on the picking strength and thus get a more precise detection than with the analog "simple" compression of the signal/

I'm not a total noob in PIC and C (I did all the LED stuff at school but it's a little far now) and if a PIC can make a better job I would happily blink again some LEDs

thanks
Max

The Tone God

Re: digital pluck detector
« Reply #1 on: July 04, 2007, 12:10:31 AM »
What type of output are looking for ? Just a pulse when it detects a pluck ?

Andrew

ignsk

Re: digital pluck detector
« Reply #2 on: July 04, 2007, 03:39:42 AM »
What type of output are looking for ? Just a pulse when it detects a pluck ?
Yes almost, in fact I need two signals ;
- a positive pulse on each pluck [
- a gate signal to track the note length (signal 0V when there is no note and V+ when the input is higher than a certain value, maybe with some hysteresis).
If only one of each signal is manageable on one PIC at a time, I can go for two of them. But the main issue is the pluck detection and the pulse generation. That's where analog goes weak . The gate generation is quite accurate in analog. In fact, the goal could be to replace the whole "pluck detection" module of the AMS-100 by a digital circuit.

Max

The Tone God

Re: digital pluck detector
« Reply #3 on: July 04, 2007, 02:53:38 PM »
Neither is that hard. You pick a threshold level for the A/D, when it passes that level it triggers the pulse, then when it drops below a set level resets. Not really hard to do. You could even put a few pots in to external set the trigger points. Pretty easy.

What output voltages do you need ?

Andrew

Jaicen_solo

Re: digital pluck detector
« Reply #4 on: July 04, 2007, 06:41:47 PM »
Can I jump right in here? If you were thinking of designing one using those big-ass PIC's (PIC18F452  or whatever), would it be possible to design something that will read a hex pickup and ouput 6 gate pulses and 6 levels, as described above? For my purposes, voltages between 0 and 5v would be just fine, so it's compatible with standard analogue synth modules. Also, would a PIC be able to read a guitar input and ouput a pulse wave the other side? My guess is that it would need serious filtering, but it could work.

The Tone God

Re: digital pluck detector
« Reply #5 on: July 04, 2007, 06:59:06 PM »
Can I jump right in here? If you were thinking of designing one using those big-ass PIC's (PIC18F452  or whatever), would it be possible to design something that will read a hex pickup and ouput 6 gate pulses and 6 levels, as described above? For my purposes, voltages between 0 and 5v would be just fine, so it's compatible with standard analogue synth modules. Also, would a PIC be able to read a guitar input and ouput a pulse wave the other side? My guess is that it would need serious filtering, but it could work.

In theory yes but I am not familiar with the signal properties of a hex pickup. Any reference docs ?

Andrew

ignsk

Re: digital pluck detector
« Reply #6 on: July 04, 2007, 07:04:41 PM »
For my purposes, voltages between 0 and 5v would be just fine, so it's compatible with standard analogue synth modules.
You read my mind  ;)

If you were thinking of designing one using those big-ass PIC's (PIC18F452  or whatever), would it be possible to design something that will read a hex pickup and ouput 6 gate pulses and 6 levels, as described above?
If the big-*** PIC has enough inputs/outputs and the thing we're thinking about can actually be done, then some kind of copy-paste-arrangement of code would do your job.

Neither is that hard. You pick a threshold level for the A/D, when it passes that level it triggers the pulse, then when it drops below a set level resets. Not really hard to do. You could even put a few pots in to external set the trigger points. Pretty easy.
I'm sorry but can you be a little more precise. In your explanation, does the C converts the guitar signal to some "digital amplitude value" and then compares this value to a threshold value (which is set externally with some pots)? Or do you mean that first, I have to convert the signal to an amplitude signal and then comes the C to do his comparaison job?
I would prefer the first way because the problems I encounter comes in the "guitar signal to amplitude signal conversion". I may be repeting myself but I my idea was to replace the whole "pluck detection" module of the AMS-100 by a digital circuit.

EDIT : With 2 secs of reflection (Yes sometimes it happens) the thing I need seems to be some kind of digital envelop follower followed by a comparator with hysteresis don't you think? do you think that's possible? Andrew, maybe I didn't understand at all what you explained  :icon_redface:
« Last Edit: July 04, 2007, 07:19:48 PM by ignsk »

toneman

Re: digital pluck detector
« Reply #7 on: July 04, 2007, 10:10:57 PM »
Max, there was a loooong recent thread about the AMS100 pluck detector.

MarkusW got some pretty good results with a LOT of tweeking    :P

Remember, "threshold" is an analog value.
Getting this value is indeed the trick!!   ;)

In the GR300 forum, there was a StringPluckPriority circuit which was being considered by MarkusW.
But this would have required a hexaphonic pickup.   :(

I'd say, build it in analog, THEN "adapt" it to digital    :icon_cool:

staypluckin'
afn
T

The Tone God

Re: digital pluck detector
« Reply #8 on: July 04, 2007, 11:36:06 PM »
I'm sorry but can you be a little more precise. In your explanation, does the C converts the guitar signal to some "digital amplitude value" and then compares this value to a threshold value (which is set externally with some pots)? Or do you mean that first, I have to convert the signal to an amplitude signal and then comes the C to do his comparaison job?
I would prefer the first way because the problems I encounter comes in the "guitar signal to amplitude signal conversion". I may be repeting myself but I my idea was to replace the whole "pluck detection" module of the AMS-100 by a digital circuit.

EDIT : With 2 secs of reflection (Yes sometimes it happens) the thing I need seems to be some kind of digital envelop follower followed by a comparator with hysteresis don't you think? do you think that's possible? Andrew, maybe I didn't understand at all what you explained  :icon_redface:

Let me see if I can break this down alittle clearer.

After you properly condition the guitar signal you feed it into one of the pins of the uC that has A/D on it. You setup the uC to read the A/D value. When the value goes above a level you decided on you can generate the outputs you wish on other pins. Once there is a output trigger the uC can wait until the value goes below a level you decided to reset.

The idea with the pots is that you can use a pair of pots that feed other A/D pins. These pin levels can be read and used as the trigger levels so you can tweak the settings without having to rewrite the software ever time you need a change.

This can be done pretty easily with a 8 pin uC per input or a larger uC depending on the input and outputs needed. The software is fairly trivial. It could probably be written in about an hour.

I am not familiar with the AMS100 so I am only going by what you are describing. Is it just me or is there some kind of hard on for a AMS100 module ? Sorry I'm out of the loop about these things.

Andrew

ignsk

Re: digital pluck detector
« Reply #9 on: July 05, 2007, 04:35:22 AM »
Max, there was a loooong recent thread about the AMS100 pluck detector.

MarkusW got some pretty good results with a LOT of tweeking    :P

Remember, "threshold" is an analog value.
Getting this value is indeed the trick!!   ;)

In the GR300 forum, there was a StringPluckPriority circuit which was being considered by MarkusW.
But this would have required a hexaphonic pickup.   :(

I'd say, build it in analog, THEN "adapt" it to digital    :icon_cool:

staypluckin'
afn
T
I know about the looOOOOong thread (on this day, the last entry of this thread is my noob intervention ;) ) Very interesting. I'm nowadays also tweaking an analog one. Due to the massive analog tweaking I'm doing, I'm just wondering about a digital way of achieving my purpose. I'm curious guy.
Trying to "adapt to digital" is exactly my point.
thanks.

Let me see if I can break this down alittle clearer.

After you properly condition the guitar signal you feed it into one of the pins of the uC that has A/D on it. You setup the uC to read the A/D value. When the value goes above a level you decided on you can generate the outputs you wish on other pins. Once there is a output trigger the uC can wait until the value goes below a level you decided to reset.

The idea with the pots is that you can use a pair of pots that feed other A/D pins. These pin levels can be read and used as the trigger levels so you can tweak the settings without having to rewrite the software ever time you need a change.

This can be done pretty easily with a 8 pin uC per input or a larger uC depending on the input and outputs needed. The software is fairly trivial. It could probably be written in about an hour.

I am not familiar with the AMS100 so I am only going by what you are describing. Is it just me or is there some kind of hard on for a AMS100 module ? Sorry I'm out of the loop about these things.

Andrew
Ok I understand :
- interest of the pots for the threshold tweaking
- once you know how to read the A/D, triviality of the soft : read input/compare/output signal/loop (I'm a software engineer did I mention that)
- size of the C
But there is still a little dark point. What do you mean by  "After you properly condition the guitar signal"  ???. The idea is to minimize the analog part in "pluck detection". It would be great if I could feed the C with the AC signal of the guitar, of course with some decoupling and maybe little filtering. Is it what you're talking about?

Just in case you're wondering, the AMS 100 is described in Craig Anderton "Device" newsletter. The pluck detector module is described in the issue n1 which you can find here :http://hammer.ampage.org/?cmd=lt&xid=&fid=&ex=&pg=11

thanks for your help

Max

The Tone God

Re: digital pluck detector
« Reply #10 on: July 05, 2007, 02:27:56 PM »
But there is still a little dark point. What do you mean by  "After you properly condition the guitar signal"  ???. The idea is to minimize the analog part in "pluck detection". It would be great if I could feed the C with the AC signal of the guitar, of course with some decoupling and maybe little filtering. Is it what you're talking about?

What I mean is I don't know what the input signal conditions are as you guys were talking about using a hex pickup which I have no experience with so you may need to do alittle work to get the signal into a healthy range for uC to read. Often people use the uC supply voltage as top A/D value so assuming the uC will be running at 5v the uC will read signals between 0 and 5 volts. The input signal should be conditioned either by amplifying the signal if it is too low or attenuating the signal if is too high so that the falls with in the 5v range.

I would see that as being the most difficult and part consuming portion of the circuit. A simple opamp stage should be all you need. Once you get things into the uC it should be easy sailing.

Andrew

ignsk

Re: digital pluck detector
« Reply #11 on: July 06, 2007, 03:56:18 AM »
What I mean is I don't know what the input signal conditions are as you guys were talking about using a hex pickup which I have no experience with so you may need to do alittle work to get the signal into a healthy range for uC to read. Often people use the uC supply voltage as top A/D value so assuming the uC will be running at 5v the uC will read signals between 0 and 5 volts. The input signal should be conditioned either by amplifying the signal if it is too low or attenuating the signal if is too high so that the falls with in the 5v range.

I would see that as being the most difficult and part consuming portion of the circuit. A simple opamp stage should be all you need. Once you get things into the uC it should be easy sailing.

Andrew

Ok thanks a lot.
So for my good old humbuckers, no special treatment would be needed, well nothing more special than amplification. That's a good news for me :) It seems to come out the way I was thinking
Thank you for theses explanations.

May I ask you one more question : What kind of C would you use for this job:
- It must read one input from a classic pickup
- output two signals "logic" :
      * one gate on signal presence on input
      * one positive pulse on pluck
- If myabe it could manage some more output signals (still no D/A convertion of the guitar) for some mods I haven't though about yet, it would be perfect.

Thanks again

Max

Jaicen_solo

Re: digital pluck detector
« Reply #12 on: July 06, 2007, 06:45:02 AM »
Seems to me that Tom's already done a fair bit of the work required for this; http://tomscarff.tripod.com/pitch_midi/pitch_to_midi2.htm .

I mailed him asking about this project a while back, before I got my GR-20. Apparently it doesn't track all that well, which is a shame, but I might still build one for giggles.

ignsk

Re: digital pluck detector
« Reply #13 on: July 06, 2007, 07:45:36 AM »
Seems to me that Tom's already done a fair bit of the work required for this; http://tomscarff.tripod.com/pitch_midi/pitch_to_midi2.htm .

I mailed him asking about this project a while back, before I got my GR-20. Apparently it doesn't track all that well, which is a shame, but I might still build one for giggles.
Interesting. My project is much simpler as long as I don't want to track the pitch. I just need note presence and note start. But still, could be fun playing with that kind of stuff.
Anyway, I know now that PICs are just ok for my purpose, I still need to find the good one.
Thanks for the link
Max

The Tone God

Re: digital pluck detector
« Reply #14 on: July 06, 2007, 03:01:51 PM »
May I ask you one more question : What kind of C would you use for this job:
- It must read one input from a classic pickup
- output two signals "logic" :
      * one gate on signal presence on input
      * one positive pulse on pluck
- If myabe it could manage some more output signals (still no D/A convertion of the guitar) for some mods I haven't though about yet, it would be perfect.

Ok so one input, two outputs, thats three pins, if you want to have the two pot adjustments thats two more pins so you are at five. That would fit in a 8pin uC which has six I/O pins. I'm an AVR guy instead of PIC so I would say that a good 8 pin with A/D choice would be the Tiny13.

Was this going to be expanded up to all six strings or just the one complete signal ?

Andrew

Jaicen_solo

Re: digital pluck detector
« Reply #15 on: July 06, 2007, 07:04:33 PM »
It was me that was after the 6x Gate & Trigger outputs, I was planning ahead for my analogue guitar synth project. Feel free to ignore me, since this isn't my thread!

ignsk

Re: digital pluck detector
« Reply #16 on: July 08, 2007, 02:11:01 PM »
It was me that was after the 6x Gate & Trigger outputs, I was planning ahead for my analogue guitar synth project. Feel free to ignore me, since this isn't my thread!
You're welcome, don't worry. Feel free to add your "hexaphonic digital pluck detection experience" here!! (Or at least a link to the thread you will certainly start ;) )
Ok so one input, two outputs, thats three pins, if you want to have the two pot adjustments thats two more pins so you are at five. That would fit in a 8pin uC which has six I/O pins. I'm an AVR guy instead of PIC so I would say that a good 8 pin with A/D choice would be the Tiny13.

Was this going to be expanded up to all six strings or just the one complete signal ?

Andrew
Thanks Andrew I think I'm now going to explore the abyss of C programmer kit . Wish me luck :D
And for the moment, I will try with the "classic" microphone signal.
Thanks for you're help.

Max

igor12

Re: digital pluck detector
« Reply #17 on: July 06, 2009, 12:41:07 PM »
I have breadboarded both. The PIC doesn't seem to track that great. But I am not done yet.   My feeling is the PIC will need some more conditioning on the input signal, like a low pass filter or companding, but now my parts count is getting close to th AMS100.  The AMS100 does take a lot of parts (10 opamps plus 1 max1044 for dual polarity operation) but it does work and seems to track well.  I am currently trying to squeeze the parts count down and convert to single supply operation and see how that works.

ElectricDruid

Re: digital pluck detector
« Reply #18 on: July 06, 2009, 04:34:14 PM »
It seems to me that a good amount of complicated detail is getting glossed over here in the "digital amplitude detection" step. Since the guitar's input signal is a varying AC signal, the "amplitude" is a fairly abstracted quality which is impossible to determine instantaneously, and difficult to detect even if given some time. Impossible instantaneously because the signal could be at a zero crossing, and difficult even given time because without knowing what the frequency is, you don't know how long you need to wait to see the peak value.
However, you could take regular samples and keep track of the change from one sample to the next (the first derivative, representing the slope of the waveform). If this derivative signal changes sign, then you've (probably) passed some kind of peak. Even that is only a start, since the guitar's signal is definitely not a perfect sine wave, and is likely to sometimes include more than one zero-crossing per cycle, and other similar complications.
Still, I think the approach is good, and these problems are probably more easily dealt with in software, rather than keep adding another quad op-amp to the ever-growing analog solution...

T.
  • SUPPORTER