close-circle
Close
0%
0%

The ultimate vlogging mic

Recording single channel 24 bit 96khz from a headset on a raspberry pi

Similar projects worth following
close
161 views
0 comments
0 followers
likes

Experiments in vlogging with a headset & robot cam showed it's worth the investment in a more portable solution for recording audio.  The need for VU meters, transport controls, & counters requires a wireless connection to a phone.  Phone recordings were horrible.  The AGC brought up the background noise & clipped the voice.  The phone & extra circuitry for monitoring was bulky.

The lion kingdom long dreamed of a wireless headset just to capture audio & monitor it.  A small FM transmitter would be able to record the microphone but not send audio from the phone back to the headset. Despite every effort, there is no easy way to record from a bluetooth headset. The Goog has blocked recording from a protocol designed to make phone calls because of wiretapping laws.  Commercially available, wireless headsets with full duplex audio are obscenely expensive, bulky, & have lousy sound quality.  The only easily accessible ones have 1 speaker.

The most compact solution is a raspberry pi zero W reading from an ADC & writing data to an SD card.  The same board sends monitoring output back to the headset.  It's really hard to justify anything besides a raspberry pi zero W for every single project, nowadays.  That board only uses 200mA & is the cheapest solution for everything.

A microcontroller is only necessary for converting the ADC's output to an SPI slave. An analog pot is the easiest way to adjust microphone gain. The ADC/microcontroller board would be dedicated just to the headset & interchangeable with a 4 channel version for less portable use. The 4 channel version would have digital pots for line level inputs, another section for monitoring, maybe mic preamps for 2 channels, lots of transistors for a patchbay.

It's important to use a CODEC or ADC specifically designed for recording audio rather than a bare ADC.  Audio codecs have the lowpass filtering & DC offset correction you need to avoid aliases.  What is the point, when a tiny soundcard for a raspberry pi is virtually free? It's about getting the best possible sound quality from the headset microphone.  Past experiences with microphone inputs on computer soundcards were horrible.

The recording system could be implemented entirely in the headset if money was unlimited, but we're financially limited to an external board.  This also allows the highest sound quality.

  • I2S framing errors on the STM32

    lion mclionhead20 hours ago 0 comments

    After 5 years of living in fear of hearing loss, a solution to I2S slave mode framing errors on the STM32 was finally found.  The trick is the STM32 doesn't automatically align samples on the WS transitions.  It just spits out 32 bit samples as the CLK pin oscillates. It does throw a bone in the form of the SPI_I2S_FLAG_TIFRFE flag.  You need to check this flag to find out if the samples are not aligned with the WS pin.  Reading the flag resets it.  When it inevitably hits true, you need to stop the I2S, stop your ADC, restart the I2S, restart the ADC after I2S is running, & hope it's in sync.  With this nugget in place, you can tap the AK4524's crystal to make it glitch & it recovers without blowing your ears up.

    As for the power supply filtering, it's a strange beast.  The easiest hack was a 4.2V 240mAh battery dedicated to the analog section.  This was dropped through a 17R & 10uF which dropped it by 0.5V.  It was incredibly noisy.  In fact, powering it off the W & the W off 5V got quieter results because it had enough voltage to drop through 70R.  The W still made an ever present 1mV pulse on this 32x averaged plot.

    It's not nearly utilizing the 24 bit ADC, but it's probably better than the CM109.  

  • Power supply filtering

    lion mclionhead2 days ago 0 comments

    The tiny el cheapo ADC for the W is 

    https://www.adafruit.com/product/1475

    based on the mighty CM109 from Taiwan

    http://www.hardwaresecrets.com/datasheets/CM109.pdf

    It's rated for an 83dB SNR.   It wasn't a warm & fuzzy way to close this chapter, so took some more notes on the AK4524.

    The AK4524 works at 3.3V, despite being rated for 5V.  The W causes a 2ms, 40mV drop every 100ms in the power supply.  The W runs on 4.2V.

    The AK4524 + AD8604 preamp suck 25mA when converting.  With the AK4524 off, the analog section only uses 3.5mA.  A simple RC filter with 75R & 2000uF knocks the noise to a reasonable level while knocking the voltage from 5V to 3.2V.  A 35R + 2000F .  Being the junk circuit it is, it could just use a separate 4.2V battery for the analog section & a 4.2V battery for the W.  The W runs on 3.5V if nothing needs its USB power.

    The 70R + 1470uF filter.  LTSpice says the output ripple is 5uV.

    The 35R + 1470uF filter.  LTSpice says the output ripple is 1.1mV.  There were some notes about cascading filters & inductors on the goog, but this topic is where driving LCDs was 7 years ago, completely obscure.

  • BUSTED

    lion mclionhead4 days ago 0 comments

    After much building up of the vlogging mic, the zero W finally shared power with the AK4524 & it was busted. There was too much power supply noise from the W. Those problems are impossible without some kind of differential inputs which the AK4524 doesn't have, or large RC networks. There would be no way to take advantage of the 24 bits in a portable form factor.

    Given more room for power supply isolation, the zero W might succeed in a larger 4 channel system with differential microphone inputs. The vlogging mic would be better served by a $5 USB soundcard. Not only is it good enough for a headset, it can run directly on a 4.2V battery instead of requiring a boost to 5V.

    The AK4524 is so ancient, it was introduced when Bill Clinton was president. There are lots of people still using LM324's & LF353's, but using something as sophisticated as an audio codec from that long ago to achieve maximum quality is almost ludicrous.

  • Commodity USB to I2S chips

    lion mclionhead6 days ago 0 comments

    The STM32 is converting I2S to SPI because it's a spare part & its USB interface is too slow to go up to the future plan of 4 channels, 96khz, 24 bits, but there already are chips which bridge USB to I2S.  If those were spare parts, they would be used.  The internet shows items which only go to 2 channels, 48khz, 16 bits.  Going higher would require a microcontroller with a higher speed USB chip.

    Otherwise, the raspberry pi zero W showed its true colors with the failure of its BCM4343 chip.  The internet says many others have experienced sudden failures of the BRCM 4343.  The fragileness of it makes it less appealing.

    The very latest method for getting the zero W to be an access point:

    https://albeec13.github.io/2017/09/26/raspberry-pi-zero-w-simultaneous-ap-and-managed-mode-wifi/

    Mercifully, this has gone from completely obscure 5 years ago to something everyone is doing, nowadays.

  • Self monitoring success

    lion mclionhead12/08/2017 at 00:08 0 comments

    The STM32 found itself driving headphones by ganged PWM outputs. Ganged because it allowed more current. This worked much better than the DAC while consuming a lot more power. It was acceptable. Because the PWM updated at 40khz, there was a lot of aliasing. It required a 3rd order FIR filter which knocked out all the high frequencies. It sounded horrible but better than aliasing & could be done for each sample. Also, be sure to tie your unused opamp inputs to the power rails.





  • Crystal mounting

    lion mclionhead12/08/2017 at 00:07 0 comments

    Tried installing the crystal on top, but realized it would be so fragile, it would require just as much padding as when it's mounted on the bottom. Meanwhile, I2S had the same problem it did 5 years ago with the Yamaha hack. It's not aligning on the word boundaries, yet disabling the word select pin causes it to stop.

    The solution for the Yamaha was bit banging the data. Since the AK4524 spits out data twice as fast, that's not an option. No-one else ever used the I2S as a slave.









    As was probably noted 5 years ago, the I2S doesn't work because it overflows when started after the ADC is already running.  When starting the I2S first, it works perfectly, with very rare failures.  This wasn't possible 5 years ago because the Yamaha always started before the I2S.  It would have taken a MOSFET to keep the Yamaha powered down until the I2S was started.


    The next problem was the DACs weren't powerful enough to drive 36ohm headphones.  An attempt to use the op-amp failed because of feedback into the microphone amplifier.  It was the delay from digitization to synthesis.  Passing the op-amp stages directly to the headphones worked.








    Another attempt used the old Zoom to amplify the DACs.  The DACs had to be divided by 10 to reach zoom level.  This worked & revealed the 12 bit DACs had horrible quantization noise for monitoring.  The next step would be PWM.  The GPIOs in digital mode might also have enough power to drive the headphones.  At least, it was impressive that it was successfully sampling 96khz 24 bits & playing it back without any glitches.



  • The defect riddled 1st board

    lion mclionhead12/08/2017 at 00:05 0 comments

    Yet another board begins with discontinued but extremely overspeced components. The AK4524 came from a 17 year old Terratec EWS 88, a $600 sound card which no longer works on any modern computer. The lion kingdom used 6 of its 8 channels exactly once, to watch Gladiator in 6 channel sound. It was later used as a 48khz oscilloscope.

    The AK4524 is no longer sold, but the I/O is similar to any replacement. The AD8604 is the 8Mhz rail to rail op amp from the day job. All the STM32 does is convert I2S to SPI.

    It has a temporary power supply, with plans for mounting directly on a raspberry pi.  The mane problem is the through hole crystal keeping it from laying flat.  

    What is the point, when a tiny soundcard for a raspberry pi is virtually free? It's about getting better sound quality from the headset microphone.

    The very best ADC is the PCM4222: 124dB, 2 channel, 216khz, 24 bits with differential inputs. The very best DAC is the PCM5242: 114dB, 2 channel, 32 bit, 384khz. They're equivalent to the very best analog tape decks ever made. It might not not worth reusing the remaneing AK4524's for anything beyond recording a headset.

View all 7 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates