View Full Version : recording from headphones

04-14-2016, 05:52 PM
For my project I need a very acurate microphone . I thought to do that by connecting a phone calls headphones and record diractly from the same microphone we use to comunicate . I have just started to use the teensy have not expeirenced enough . I have a teensy 3.2 and a single audio board .

I know that for recording from the headphones microphone I need to record from the channel 3 and the channel 4 of the headphones jack .
How do I do that ?

For my project I also need to be able to save data that was recorded to the SD card .
How do I do that ? What format will it be saved ? right now I have expirienced WAV files only .

Do I need to amplify the microphone before entering the audio shield ?

04-14-2016, 06:49 PM
Have a look here (https://www.tindie.com/products/onehorse/inmp441-i2s-digital-microphone/?pt=ac_prod_search).

04-15-2016, 05:12 AM
How do I connect it to the teensy?

04-16-2016, 07:07 AM
Onehorses solution will give you high quality audio data, wired as per his page. If you can accept a much lower audio quality you can use the mobile phone headset option. The easy way to do that would be to buy a Teensy audio board, and either cut the cable apart to get the ear audio and microphone lines apart, or buy a 4 way jack and solder flying leads to it so the common + left + right audio goes the audio board headset jack and the common + mic connects the to solder point.

Working directly with the Teensy is also possible, but will need some audio design skills to get right and a fair number of extra parts.

There isn't a solution you can just plug the phone headset into without doing any more work.

04-16-2016, 11:06 PM
For my project I need a very acurate microphone .

You're probably not going to achieve great results by using a headphone or speaker. Yeah, it's possible to use these "in reverse", but they're simply not mechanically designed to work well that way. Sensitivity will be poor and they're almost certain to have non-uniform response over different frequency ranges. Distortion might also be an issue.

Regular microphones have developed and refined very well over the last 50+ years. For good results, you really should use a real designed-for-recording microphone!

Do I need to amplify the microphone before entering the audio shield ?

The audio shield as 2 different inputs, stereo line-in, and mono mic. The mic input includes an adjustable amplifier inside the SGTL5000 chip. For the line-in, you need a preamp to bring the mic up to the regular signal level that input expects.

If you haven't watched the tutorial video, I'd suggest you look at the sections starting at 15:54 where the mic input is demonstrated.


The microphone demonstrated in the video is available here:


As you can hear in the video, the mic sounds ok. It's decent for telephone quality talking, but far below what you'd want for a musical performance. Pretty much the long-time standard live musician performance is the Shure SM58 microphone.


There are a lot of SM58 clones in the $20 to $30 range. This type of microphone needs a preamp to amplify the signal to line-level. These are readily available, since pretty much every musician needs one.

For top quality recording in studios, usually large diaphragm condenser microphones are used. These range in price from $100 to $1000. For example:


These also produce a tiny signal, so you need a preamp. Unlike the dynamic mics, these need power, which is usually send on the same cable by the preamp (called "phantom power", usually 48 volts). Many preamps exist on the market, sometimes built into a mixer. Look for ones that say they provide the phantom power. Large diaphragm condenser mics are also not nearly as rugged as the dynamic mics and can be easily damaged it dropped.

If you need a "very accurate microphone", these are certainly the very best. Virtually all music studios use these for recording.

04-16-2016, 11:37 PM
The one other really high quality microphone type you may find is called a "shotgun" mic. Most of them are really just large diaphragm condenser types, but with a specially constructed tube that tries to make the mic more directional. Most are meant to be used by the movie industry, where a boom operator holds it on the end of a long pole, pointed right at the actors but just outside of the camera's frame of view. When you can't put a mic actually on the actor, this is pretty much the way you record dialog for movies.

In terms of sound quality, these shotgun mics are something of a complex compromise. It's very difficult to add directionality and keep the microphone equally sensitive to all audio frequencies. Most of them have to be made with extremely lightweight materials, since they're used on the end of a long boom pole that's held by a human. Good ones tend to be insanely expensive. Even the very best probably isn't on par with a regular condenser mic with a musician singing directly into it, but if you have to locate the mic a couple feet above the sound source, the loss of accuracy from directional feature is a good trade off to get some attenuation of unwanted sounds from other directions.

This may be overly obvious, but with *all* types of microphones, closeness to the sound source is by far the most important factor. Even a mediocre mic located very close to the sound source will work much better than the world's very best mic positioned far away. Especially with shotgun mics, there's a lot of pretty terrible marketing claims, about the "reach" of a mic. Don't believe it. With all microphones, getting the mic closer to the sound source matters more than everything else, if you want to achieve good results. Even with the world's best shotgun mics, movie studios pay boom operators and set up a live video screen so the person holding the pole can position it as close as possible to the actors without actually getting into the picture frame.

04-19-2016, 05:16 AM
Thak you pual. You have helped me a lote. I have one last qustion witch is more scientific.
can I build a decibel meter with the teensy? I am looking for a way to calculating the acostic power(in watt).
I thought of using the formolla: db=10log(p(w)/p0(w)
What do you say?

04-19-2016, 01:57 PM
That's the forumula for measuring gain in DB if you have two different powers (audio or others). Which is correct if you can MEASURE audio power in watts in the first place. Teensy isn't going to do that out of the box. You can happily measure relative 'loudness' in units of your own design (with errors if measuring different frequencies), but that formula is the last step in a complex calibration and linearisation process converting units as measured by the Teensy audio function, and that calibration that starts with either having a known source, or having a known good meter to work from.

More likely would be skip the formula and just create a lookup table that converts Teensy loudness units into DBs read from whatever you calibrate against, and hoping your measurement subjects are approximately white noise. Low or high frequencies will kill any precision in those sort of thing, and very hard to fix in software (true meters use clever analog design to engineer a level wide band response into the digital processing stages).