Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 5 1 2 3 ... LastLast
Results 1 to 25 of 108

Thread: Teeny Guitar Audio Board

  1. #1

    Teeny Guitar Audio Board

    My Teensy 3.6 just arrived and I've already passed some audio through it. Looks like it might be powerful enough for some guitar effects modelling fun.

    My plans are create an audio board specifically for guitar. There are couple issues with most audio boards designed for microcontrollers when you try to use them for guitar.

    1) They have 3.5mm jacks instead of the usual 1/4" for guitar gear.

    2) most boards use line-level in and out. The voltage level isn't that big a deal as much as the impedance is. Guitars with passive pickups need to drive input impedances in the 500K to 1M range. Line inputs are about 10K.

    3) Line-level has pretty predictable voltages. It never exceeds 1 Vrms. Guitars are all over the place. Weak single coil pickups are typically around 100 millivolts. Active pickups can put out several volts. This means you might need gain, or attenuation to get it to the right level for the ADC.

    SOLUTION: I'm gonna try out a board based around a WM8731. It has a nice gain/attenuation stage before the ADC that can gain up to +12db and attenuate over 30db.

    The guitar signal will drive a low-noise high-impedance JFET op-amp (currently as unity gain but I may up that), which then will go to the ADC.

    The JFET op amp basically needs at least a 9V supply in order to guarantee a hot signal from active pickups or hot pedal doesn't cause latch up. This means I need a boost converter to get the 3.3V digital suppl up to > +9V, then feed it through an LDO in order to get a clean regulated +9V analog.

    Also, it wouldn't be much fun without MIDI!!!!

    So connectivity will be 2 channel in, 2 channel dry out, 2 channel processed out, MIDI IN and MIDI OUT DINs.

    Note: the crystal won't be populated, I generally expect to run the codec in slave mode.

    *** UPDATE *** REV2 SCHEMATIC ***


    Any feedback?
    Attached Files Attached Files
    Last edited by Blackaddr; 06-02-2017 at 12:38 PM. Reason: Updated schematic

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    15,720
    Quote Originally Posted by Blackaddr View Post
    I'm gonna try out a board based around a WM8731. It has a nice gain/attenuation stage before the ADC that can gain up to +12db and attenuate over 30db.
    The SGTL5000 has similar features. Look at the right side documentation panel in the design tool, and then scroll down to "Signal Levels".

  3. #3
    Quote Originally Posted by PaulStoffregen View Post
    The SGTL5000 has similar features. Look at the right side documentation panel in the design tool, and then scroll down to "Signal Levels".
    I looked at the SGTL5000 but unfortunately it didn't meet some of my criteria. The audio performance metrics were less than I was looking for, and the actual gain circuit in front of the ADC is 0 to +22.5db according to the datasheet, suggesting it doesn't have real analog pre-adc attenuation.

    The WM8731 provides both (with a proper inverting preamp structure to provide active gain and attenuation), and has better performance numbers for about $2 USD more. (admittedly this is nearly double the cost of a SGTL5000) but I think $2 here is worth the upgrade.

  4. #4
    Member
    Join Date
    Nov 2015
    Location
    Norway
    Posts
    64
    Don't you want any potmeters or other inputs for controlling parameters of the effects? Or do you plan to put that on another board?
    Regarding the input levels, I know that there are some active pickups that operate in the 2V+p-p range, but I think the input range of the SGTL5000 should cover most needs. 3V p-p.
    Anyway, always good to have the option to attenuate the signal by SW if possible=)

  5. #5
    Quote Originally Posted by omjanger View Post
    Don't you want any knobs or other inputs for controlling parameters of the effects? Or do you plan to put that on another board?
    Regarding the input levels, I know that there are some active pickups that operate in the 2V+p-p range, but I think the input range of the SGTL5000 should cover most needs. 3V p-p.
    Anyway, always good to have the option to attenuate the signal by SW if possible=)
    Of course I need pots and switches! Gotta have those! But I think it's best to have the MIDI jacks and use an external MIDI foot controller. If I put knobs and switches on it, it will increase board size dramatically (and thus cost) and you'll never have the right number for each person.

    I think the best solution is to use a MIDI foot controller with the jacks so you get exactly the right number of physical controls you need. If you want the free solution,you can also use the excellent Teensyduino USB-MIDI to control it from the PC/laptop.

    Personally I'll be using this MIDI Foot Controller to control the effects via the MIDI jacks:

    Blackaddr microMIDI
    Click image for larger version. 

Name:	microMIDI_forum.jpg 
Views:	241 
Size:	110.7 KB 
ID:	9990

    Regarding attenuation, the active pickups in my bass put out 4V+ on the low B string. if you put a real guitar pedal in front of the ADC you can easily get 7 Vpp from a 9V battery supplied pedal! A decent amount of software controlled analog attenuation is really important.

    The SGTL5000 is definitely a great low-budget codec for experiments. It's Pros are more PGA gain, and I guess the Audio LIbrary control is more up to date, and it's $2 cheaper in small quantities.

    The Pros for the WM8731 is lots of PGA attenuation should it be needed, moderate gain, and much better ADC/DAC performance numbers. While it's not as common as the SGTL5000 it's still a codec in the Audio Library. For an extra $2, I think it's a better match for a guitar application.
    Last edited by Blackaddr; 03-16-2017 at 01:17 PM.

  6. #6
    Member
    Join Date
    Nov 2015
    Location
    Norway
    Posts
    64
    Nice! Like the microMIDI box!
    You are absolutely right in that the signals can get very high on many stompboxes. But it seems like some of the major players out there stick to the industry standards.
    Taken from a TC electronics manual:
    Click image for larger version. 

Name:	Capture.JPG 
Views:	159 
Size:	39.2 KB 
ID:	9991
    That is around 3.5vp-p. But a active/passive pickup switch is a good idea.. think I will include that in my next design=) or change to the codec you use

  7. #7
    Quote Originally Posted by omjanger View Post
    Nice! Like the microMIDI box!
    You are absolutely right in that the signals can get very high on many stompboxes. But it seems like some of the major players out there stick to the industry standards.
    Taken from a TC electronics manual:
    Click image for larger version. 

Name:	Capture.JPG 
Views:	159 
Size:	39.2 KB 
ID:	9991
    That is around 3.5vp-p. But a active/passive pickup switch is a good idea.. think I will include that in my next design=) or change to the codec you use
    I've been spending a lot of time thinking about this issue. Given the common 9V circuits in guitar-land, you can probably get away with assuming 7vpp max, and assume we want to ensure we can get it back down to 1vpp to ensure the ADC doesn't clip. This is -17db of gain, and -20db would bring 10vpp downto 1vpp. So let's set a requirement here:

    1) The circuit must provide at least -17db of gain before hitting the ADC input.

    Next, we have to handle those pesky weak signals. We want somebody playing super light strings, with moderate picking on vintage single coils to get up to the 0.5vpp to 1vpp for good performance in the adc. Since that could mean as low as 10 mV input, we need about +30db of gain. That might be overkill (underkill?) and say we instead design for 100mv and ease up to +20db of gain.

    2) We'd like the circuit to provide at least +20db of gain to ensure the weakest signals can still be quantized well by the ADC.

    Ideally now, if I use a Unity buffer on the front end to handle the high impedance requirement, if I could find a codec that provides analog-front end PGA of -17db to +20db, we'd be set. Unfortunately, I can not find such a codec. The best I've found so far (for a reasonable price of < $5 USD) is the WM8371, but it only provides -30db to +12db approximately.

    So, it's got 1) covered, but it's seriously lacking on 2).


    At the moment the schematic shows 0db of gain at the front-end buffer. I'm really thinking I need to have some gain here. We could make up the difference by putting about +8db of gain on the front end buffer. The problem is you can't leave it fixed like that because if a hot 7vpp signal comes in and if you apply ANY gain at the front end buffer, it will clip the buffer itself.

    So obviously it can't be a fixed positive gain.

    OPTION 1) Provide a pot that continuous varies the buffer gain from 0db to +8 db. Probably just make this +10db for a nice round number.

    OPTION 2) Provide a switch (as per your suggestion) that changes the gain. Between say 0db and +8db. (or 0 to +10 db, etc.) This switch could potentially be a digitally controlled analog SPDT switch which would provide software control of the '+10db coarse gain'.

    A VERY general rule of thumb is to get various things up to proper pro line-level
    - consumer line level to real line level = +10db
    - guitar to line-level = +20db
    - mic to line-level = +30db

    Thanks for you feedback so far omjanger, any more thoughts?
    Last edited by Blackaddr; 03-16-2017 at 05:00 PM.

  8. #8
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Vancouver Canada
    Posts
    583
    Is the issue that you don't want the input gain set by a manual pot?

    Why not use a digi-pot for a voltage divider on a variable gain op-amp circuit...

  9. #9
    Quote Originally Posted by oddson View Post
    Is the issue that you don't want the input gain set by a manual pot?

    Why not use a digi-pot for a voltage divider on a variable gain op-amp circuit...
    The problem with manual pots id it's difficult to truly get the same setting twice. I actually use MIDI and digital modelling for gigs, so I strongly prefer a digital chain that can be totally software recalled. You also need really good quality pots for anything in an audio signal path. Probably a couple $$$ for decent audio quality pot.

    I'm guessing a digital pot is pretty expensive compared to switching feedback resistors with a SPDT switch.

    A mechanical switch between 0 and +10db gain is my personal preference over a manual pot (smaller footprint on the board and cheaper too). However, an analog SPDT switch ICs can probably be had for the same price as a mechanical SPDT switch, if not cheaper. This allows you to boost the signal and use the ample attenuation in the CODEC PGA to get the signal level just right.

    This is how I've seen it done with most digital pedals. They will have a "-10db" pad switch to press if the input is clipping, which is really the same as calling +10db 'normal' and '-10db' the pad setting (actually 0 db).

    Any strong benefits of a mechanical pot that you guys really like?

  10. #10
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Vancouver Canada
    Posts
    583
    edit- oops... forgot you need the high-voltage option in this use (>5volts) so that would add cost... $2-$3 range at low volume.

    MicroChip seems to have the cheapest solutions via their 'direct' online store:
    http://www.microchipdirect.com/Produ...41HV51-103E/ST


    ...but I'm starting to come round to a PAD switch as the best option given the software gain will give you sufficient control if you have a signal at the correct order of magnitude.





    Since you're not looking for a lot of steps a 7-bit digi-pot isn't very expensive (~$0.50 at quantity)... but they are not as easy to locate as an analog switch.
    My local bricks-and-mortar electronics store has a DIP rheostat part that would work as half a voltage divider for CND$3 (US$2) each so online I'm sure you would be <$1 even at low quantity.

    Technically it's almost the same solution ...a uC controlled switch selecting resistor-network output...
    Last edited by oddson; 03-16-2017 at 08:00 PM.

  11. #11
    @oddson

    Yeah, I started looking at digipots at Digikey (MCP4017T is $0.80 CAD) in single quantities but the 5V limit on the resistor network pins is an issue. Any higher voltage rating is going to be a couple bucks which is too much.
    - I could get an SMD slide switch for about $1
    - I could get an SMD digitally controlled analog SPDT switch for the same, about $1.
    - I could get a full blown +30db PGA four about $1.50, about which might be cheaper than an "op-amp plus feedback switch". I know the TL072 opamps well, I'm not too sure about the PGAs quality for audio at that price range.

    The mech slide switch seems to be the best if I want to follow the KISS principle.

  12. #12
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    15,720
    Just wondering, are you prototyping any of this with a solderless breadboard & breakout/eval boards? Or will the PCB with everything be your first attempt with the actual circuitry?

  13. #13
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Vancouver Canada
    Posts
    583
    I could get a full blown +30db PGA for about $1.50...
    Really??... I didn't really know about Programmable Gain Amplifier ICs until recently and the ones I've seen so far have been pricey.

    You could make one too with a standard (low voltage) digi-pot and an LM13700 (plus a few passives)... but not for $1.50.

    For two-gain switch...
    I wonder... could a JFET switch off a unity feedback path on an op-amp leaving a voltage divided (non-unity-gain) feedback path? - then it's a few pennies and one digital pin from the Teensy.
    Last edited by oddson; 03-16-2017 at 10:38 PM.

  14. #14
    Dammit, double checked the high impedance PGA I was looking at. It's get better performance than the TL072 which is great but can't handle VDD greater than 5V. Same as the digital pots. As soon as you look for higher analog voltages you start adding dollars real quick.

    As for the JFET that's quite possible...Hmmm.....(while it's more than pennies it's less than $1). I don't have a good sense for how much noise the JFET will inject into the feedback path. You already need decent audio quality resistors there (thin film). It really comes down to the noise impact that JFET has on the circuit.

    One advantage of a mech switch is low noise if the switch not picking up much RF.
    Last edited by Blackaddr; 03-16-2017 at 10:48 PM.

  15. #15
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    15,720
    Now that I have a little more time, I'm comparing specs, trying to understand why the WM8731 is considered better. It does have an input attenuator, so that feature alone may be the deciding factor. Personal preference or brand loyalty are also perfectly valid reasons.

    But in terms of specs, both claim the same 90 dB SNR for 1Vp-p input and 100 dB SNR for output, when running from 3.3V. They both have very similar specs with 1.8V power too. WM8731 does claim better THD, but the specs look very, very similar (unless you compare one's 1.8V specs against the other's 3.3V specs).

    WM8731 has a crystal oscillator built in, which makes it the popular choice for non-Teensy boards which can only use codecs running in master mode, but that's a non-issue where Teensy provides all the clocks and you run the codec in slave mode.

    If you're looking for excellent signal quality, wouldn't it make sense to step up to something with 90 to 96 dB THD+N. Not SNR, but THD+N (which is rarely even specified on low power parts like WM8731 & SGTL5000), meaning 15 or 16 bits free of all noise + distortion? Perhaps WM8778?

  16. #16
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    15,720
    Or CS4265? If I were to make another audio shield for higher quality applications, that one looks like a really tempting choice...

  17. #17
    @Paul - I took another look. I was reading the SGTL5000 as 85db and the WM8371 as 90db SNR. I just realized the 85db on the SGTL5000 is at 1.8V and I'll be running the analog supply at 3.3V. At that point they do have the same ADC SNR figure.

    You are definitely correct there sir, and yes the THD is better on the WM but I'll agree they are very comparable now that I realize my mistake regarding the ADC SNR.

    I'd say I'm looking for GOOD signal quality. The purpose is to have fun with the Teensy, but also consider that most guitar pedals and amps aren't made of audiophile parts, so I think it's wise to balance it here in comparison to decent quality guitar pedals.

    However, as you can tell from this thread, the attenuator is a HUGE deal for a guitar input. The WM8778 does look to be a little too pricey for me. I have buy things in Canadian rupels, so I'm looking at $6.62 for the WM8731, and $14.30 for the WM8778 from DigiKey. I think when you get into a high end codec like that, you can't just throw a ferrite down and call your analog 'clean'. You really need a proper LDO there which increases the cost further of the power supply circuits since I'm trying to avoid adding another power source, and get everything from the 3.3 coming from the Teensy. You also shouldn't run the signal path tracks on the surface for high end audio. They need to be on buried layers with ground stitching vias alongside. So the overall PCB cost goes up to justify the higher end codec.

    I'm also trying to fit everything including all the connectors on a 10cm by 5cm board (to fit in standard 1590B stompbox enclosure), while keeping analog and digital areas separate with only 2 PCB layers.

    Another issue is the SGTL5000 appears to only be available in QFN??? I cannot solder QFN by hand. I can do 0.65 BSC SOP packages no problem under a stereo microscope, even QFP's are no problem, but I can not do QFN with a proper reflow station.

    This wouldn't be an issue obviously if I was having these assembled by a board house but I doubt I'm going to have hundreds of people clamoring for these so I do avoid QFNs and BGAs.
    Last edited by Blackaddr; 03-16-2017 at 11:39 PM.

  18. #18
    Quote Originally Posted by PaulStoffregen View Post
    Or CS4265? If I were to make another audio shield for higher quality applications, that one looks like a really tempting choice...
    A nice part, and a reasonabe price, a little weak on the PGA only being +/- 12db, but also QFN which means I can't hand-assemble. :-(

  19. #19
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Vancouver Canada
    Posts
    583
    It's for electric guitar, right... I can't help thinking the high-fi parts are mostly overkill given the noisy, low-bandwidth signal that you will likely load with piles of harmonic distortion anyway (even on a so-called 'clean' sound there tends to be buckets of harmonic distortion added to make up for the thin signal).

    If you do use high-quality parts then you should upgrade the op amp. TL072 isn't an audiophile component as I understand it. (I think Omjanger's board has it in the original schematic but has since upgraded to NE5532.)

    Personally I'm tempted to try the built-in ADC with an op-amp buffer as I suspect the signal subtitles will be lost anyway. But I never seem to get around to trying it.

  20. #20
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    15,720
    Yes, indeed when you go for the really high end, cost of everything else makes the codec chip look pretty cheap. William Hollender's awesome but expensive board is probably the best example:

    https://hackaday.io/project/5912-tee...er-audio-board

  21. #21
    Quote Originally Posted by oddson View Post
    (I think Omjanger's board has it in the original schematic but has since upgraded to NE5532.)

    Personally I'm tempted to try the built-in ADC with an op-amp buffer as I suspect the signal subtitles will be lost anyway. But I never seem to get around to trying it.
    An NE5532 is a BJT op-amp, it doesn't have high enough input impedance for a guitar buffer. It has to be a JFET op-amp to get the impedance. The TL072 is definitely not audiophile, but is VERY common in guitar pedals as a preamp is very usable. The next best upgrade tends to be OPA parts which are 4x to 10x the price. Burr-brown must make their chips out of Unobtainium.

    If you unity buffer into the ADC (like I show in my OP schematic) you run the risk of the signal being too low. Hot humbuckers will likely be fine but a piezo pickup on an acoustic requires far more gain than then the +12db the WM8731 has built in.

  22. #22
    Member
    Join Date
    Nov 2015
    Location
    Norway
    Posts
    64
    or this codec from ti:
    http://www.ti.com/lit/ds/symlink/lm49352.pdf

    1.27USD if you buy 1k..
    And -46dB to +18=)

  23. #23
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    15,720
    Quote Originally Posted by omjanger View Post
    or this codec from ti:
    That's a nice little part. Too bad it only comes in BGA package. And not just any BGA, but 0.5 mm fine pitch BGA which requires a very advanced PCB process.

  24. #24
    Member
    Join Date
    Nov 2015
    Location
    Norway
    Posts
    64
    whats the pitch on the teensy 3.6?

  25. #25
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    15,720
    The BGA on Teensy 3.6 is 1.0 mm pitch.

    The PCB uses 5 mil traces & spacing and 10 mil drill for vias in the BGA area. It's a 6 layer board.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •