2
\$\begingroup\$

Background

Similarly to what Jeri Ellsworth did in her C64 Bass Guitar hack I am working on an audio-to-midi converter for my bass guitar.

I am also planning to use piezo discs as sensors placed under each string, connected to a Papilio One, using the ADC of the Logic Start MegaWing (an ADC128S102). The ADC reference voltage is hardwired to 3.3. volts.

My problem is that my analog electronics knowledge is pretty bad and I don't have any practical experience (I have given a try to the relevant chapter of the The Data Conversion Handbook but it's a bit too advanced for me).

Question

What circuit should I use to drive the ADC? The circuit should

  1. Implement an anti-aliasing filter. The frequency ranges (excluding harmonics) typically found in each string of a 4-string bass are:

    • E string: E1 (41.20 Hz) to E3 (164.81 Hz)
    • A string: A1 (55.00 Hz) to A3 (220.00 Hz)
    • D string: D2 (73.42 Hz) to D4 (293.66 Hz)
    • G string: G2 (98.00 Hz) to G4 (392.00 Hz)
  2. Ensure that the input signal voltage matches the expected range of the ADC (0V to 3.3V as I understand it).

I would appreciate as much practical information as possible (e.g. specific circuits and specific op amp parts to use) since, as I have said, I am pretty unexperienced on this. Pointers to books/articles suitable for a newbie like me would also be appreciated.

\$\endgroup\$
  • 1
    \$\begingroup\$ Don't you want to capture the harmonics? Pure sine waves will not sound like a bass guitar. The harmonics are what differentiate instruments playing the same note. What is the sample rate of your ADC? \$\endgroup\$ – mkeith Dec 18 '14 at 18:15
  • 1
    \$\begingroup\$ @mkeith I only care about the fundamental frequency (and not the harmonics) since I am working on an audio to midi interface (The bass input will only be used for analysis and not as an output). The sample rate of the ADC goes from 500ks/s to 1Ms/s (shared for all inputs) \$\endgroup\$ – fons Dec 18 '14 at 19:17
  • 1
    \$\begingroup\$ I think I understand. Can we assume then that G4 is the highest note we need to capture? So you don't care about anything over 392 Hz? \$\endgroup\$ – mkeith Dec 18 '14 at 20:21
  • 1
    \$\begingroup\$ @mkeith essentially yes (it may be a good idea to leave some headroom to detect string bendings though). Note however that there will be one input per string allowing for a different "maximum frequency" per input (we may not want to enforce this though) \$\endgroup\$ – fons Dec 18 '14 at 23:07
  • \$\begingroup\$ I looked over the Jeri Ellsworth video. She does not have an ADC. She is going amp/comparator, digital, and then to a sound chip. I guess you are going amp/ADC DSP or whatever? She doesn't give details about amp gain. So we don't know how much gain we need to apply to the signal coming out from those piezos. Do you have any idea about that? I did find this: stompville.co.uk/?p=176 Copying that circuit could be a start. \$\endgroup\$ – mkeith Dec 19 '14 at 5:58
2
\$\begingroup\$

I wouldn't recommend piezo pickups. On my old Antoria (pre Ibanez) 6 string I used 6 small inductive sensors (lots of coils of wire around a magnet aka 6 individual guitar picks) and they worked fine in the bridge pickup position - I didn't get any interference between one string and the next - you will using acoustic pick-ups and I bet you get cross talk and this will likely annoy you - it would me. I built mine back in 1982 and fed each string signal through a simple op-amp distortion circuit then mixed the signals. It sounded like an organ and I ought to dig it out one day but anyway, if you are converting to midi you probably really want a sq wave signal rather than trying to do the zero crossing in software based on the numbers thrown out by the ADC. Just a recommendation from someone who built something that totally makes Jeri's look like a piece of crap. I heard her say it didn't work that well too!!!


Latest recommendations

I play bass guitar pretty good and I'm very familiar with the waveforms they produce and how most bass tracks are recorded. The 99% rule is that only one note is ever played at once i.e. the bass guitar is nearly always played a single note at a time (even though it has four strings). There is a very good reason why bass guitarists don't play multiple notes - at such a low frequency, multiple notes will nearly always sound like a mess. This is unlike a 6 string guitar - this is tuned at least one octave higher (comparing the fat E strings) and at this pitch chord notes sound naturally very good. So my 1st recommendation to you is: -

Stick with the in-built conventional electromagnetic pickup on your bass guitar and don't even think about modifying this until you have mastered the algorithms to convert the bass guitar waveform to midi. This gives you a perfectly good signal to try whatever DSP you want.

In fact, I'd go a stage further - make a few choice recordings of your bass guitar and use these recordings as inputs to your DSP system. This leaves you two hands free to tweak your code as much as you need to. So, my 2nd recommendation is: -

Record a few choice bass riffs into the sound card on your PC and put the bass down and forget about it until you have your algorithms sorted out. You can use your PC for outputting the riffs and if you use a wave editor you can copy and paste, step/repeat, merge or do virtually anything with the recorded bass sounds. Output these thru your soundcard and do the really difficult job first.

The really difficult job is converting the bass sounds outputted from your PC to midi format - any job that needs to be done in life or electronics - tackle the hard bit first and if you can't do the hard bit then abandon the idea.

If you get the hard bit done then try playing your bass guitar "live" into your DSP system and see if it still works without issue. It won't of course because little bumps and erroneuous string noise will cause your algorithm problems you haven't considered so my third recommendation is this: -

Try recording what gives the DSP a problem and use this new recording to fix-up your algorithm. Repeat/loop several times until your are happy with your code-based midi converter.

Then, and only then, should you start considering any modifications you might choose to make to your bass guitar. In my honest opinion I don't think modifications are needed because of the 99% rule.

As a free xmas gift, if you want some bass guitar samples, email me (see my profile) and I'll send you some.

Also, using the PC as the sound source for the bass guitar audio gives you the opportunity of perfecting the algorithm all on one platform.

\$\endgroup\$
  • \$\begingroup\$ Thanks, I will start with the piezo disks for now since I don't care about too much about sound quality (I just need the signal to be clear enough to do some DSP). About the question itself, do you have any suggestions about what circuit/parts to use? \$\endgroup\$ – fons Dec 20 '14 at 11:53
  • \$\begingroup\$ I used LF347 op-amps back in 1982 but I wouldn't use an ADC for your midi interface - use a comparator to convert to a logic level and decode the frequency on the digital signal. \$\endgroup\$ – Andy aka Dec 20 '14 at 11:55
  • 1
    \$\begingroup\$ Once you have a square wave, assuming it is of the fundamental, you can determine frequency by timing the interval between edges. You can also implement a phase tracker. The phase of a sinusoid advances linearly. When you get a rising edge, the phase is 0. At the next falling edge, the phase is 180 degrees. At the next rising edge it is 360, etc. So a phase tracker simply increments the phase at regular intervals. From phase, you can generate a digital sample stream representing a sine wave. You can fine-tune phase increment to stay in sync. Read about direct digital synthesis (DDS). \$\endgroup\$ – mkeith Dec 20 '14 at 18:35
  • 1
    \$\begingroup\$ @fons use a 16 bit ADC, sampling as fast as you can (10k+ per second) and you won't need anti aliasing filters. Choose an ADC that has a bipolar input i.e. extends equally above and below 0V i.e. centre code = 0.000V - this saves on using an op-amp. Feed the bass signal directly from the pickup into the bipolar ADC. The bass signal should be plenty big enough to register a decent peak_to_peak number range on the ADC - adding an op-amp for gain might help a bit but that is dead easy to remedy but my advise is try it straight in from the pup. \$\endgroup\$ – Andy aka Dec 20 '14 at 23:01
  • 1
    \$\begingroup\$ @fons, if done correctly, with a phase tracker and some method of improving the frequency estimate over time, it is a super way to track frequency (and phase) in real time. You can use a PID algorithm to generate a new delta phase estimate at every zero crossing. Tune the PID to get the response you want. The delta phase term is a very precise estimate of the instantaneous frequency. You can use 32 bits if you like, or even more if the hardware can handle it. Read about DDS before you abandon the idea. \$\endgroup\$ – mkeith Dec 20 '14 at 23:40
1
\$\begingroup\$

I hesitate to answer because I am really not an expert on this sort of thing. But nobody else is answering. I suggest that you build the circuit found here: http://stompville.co.uk/wp-content/uploads/2012/03/115SV.png

I would suggest to put the piezo's in the bass, and then build the first part of the circuit, with the JFET's and associated circuitry, and then see what kind of amplitude you get using the oscilloscope. After you see that, you will have a better idea of how much gain you need to get your 3.3V swing. At the end, I think we will AC couple the signal into the ADC, so you should just measure peak to peak for now. Once you have that, we can revisit the rest of the circuit.

By the way, are you going to put all 4 piezos in parallel, then use one amp, or are you going to make 4 amps?

\$\endgroup\$
  • 1
    \$\begingroup\$ He should be processing 4 channels; one for each string. \$\endgroup\$ – Andy aka Dec 19 '14 at 22:50
  • 1
    \$\begingroup\$ @Andyaka, thanks! Any additional comments you have would be most appreciated, especially if you think I am leading the OP down a wrong path. \$\endgroup\$ – mkeith Dec 19 '14 at 22:57
  • 2
    \$\begingroup\$ I left an answer and for once I'm excited to say I built something similar!!! \$\endgroup\$ – Andy aka Dec 19 '14 at 23:05
  • \$\begingroup\$ @Andyaka you left an answer commenting on the sensors/approach, I do appreciate it but it doesn't really answer the question. \$\endgroup\$ – fons Dec 20 '14 at 18:16
0
\$\begingroup\$

Since none of the answers really address (1) or (2) nor provide specific components/circuits, I will answer myself after some days of research and consulting an acquaintance with an electronic engineering background.

With the help of a multimeter, I measured the output impedance of the Piezo disc which is the order of mega Ohms (~1.5 MOhm), which matches Wikipedia's description.

This tells us that, due to its high output impedance, we need buffering immediately after the piezo which, can be be easily done with an op amp

Then, with a scope, I measured the peak to peak voltage of the Piezo discs, which is approximately -3.6V to +3V, when plunking the strings as hard as I could.

enter image description here

Since the accepted range of the ADC is 0 to 5 V (the Va pin of the ADC is connected to 5V in the Papilio) we need to:

  1. Adapt the 6.6V output range to the 5V range of the ADC. This can be done with an omp amp-based non-inverting amplifier with a gain of 5/6.6 = 0.75. This can be achieved setting R1 to 1K and R2 to 1.3K (1K Ohm and 300 Ohm in series)
  2. Transform the Bipolar output of the piezo into the unipolar input of the ADC. This can be done with an op amp adder of 2.5V immediately after the non-inverting amplifier in (1), setting Rf to 2.5K and R1 to 1K should do the job. Note that this circuit inverts the input, but this doesn't matter for this application.

Up until this point we have taken care of adapting the voltage to the ADC, now, we need to take care of anti-aliasing with a low pass filter. A two-pole active filter as described in this tutorial should do the job. We could go much further.

The last pieces of the puzzle are:

  1. Choosing the op amp. I have decided to go for the OPA2134, it's low noise and cheap and accepts a low voltage supply.
  2. How to power the op amps. I can hookup a 5V and ground connections to the two pins going from the Papilio to the Logicstart Megawing. However, the op amps, need negative voltage too, this can be easily done using a a virtual ground with the TLE2426 as described here.
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.