SIGN IN YOUR ACCOUNT TO HAVE ACCESS TO DIFFERENT FEATURES

FORGOT YOUR PASSWORD?

FORGOT YOUR DETAILS?

AAH, WAIT, I REMEMBER NOW!
  • LOGIN

ProtoSupplies

  • HOME
  • SHOP
    • Arduino, Teensy & IOT
    • Audio & Video
    • Breadboards & Supplies
    • Breakout Modules
    • Cables and Wires
    • Communications & Interfacing
    • Connectors & Headers
    • Displays, LEDs & Panel Meters
    • Fans & Hardware
    • ICs & Semiconductors
    • Passive Components
    • PCBs – Prototype & Adapter
    • Power Supplies & Converters
    • Proximity, Distance and Collision
    • Relays, MOSFETs & Power Ctrl
    • Robotics, Motors & Motion
    • Sensors
    • Supplies & Consumables
    • Switches & User Input
    • Temperature & Humidity
    • Test, Tools & Test Accessories
  • LEARN
  • TECH
    • Guide To Solderless Breadboards
    • Determining Unknown I2C Addresses
    • Determining LED Resistor Values
    • DC-DC Step-Down Converter Overview
    • s
  • BLOG
  • INFO
    • About Us
    • FAQ
    • My Account
    • Contact Us
  • Wishlist –
  • MY CART
    No products in cart.

Home » Tutorials » Audio Tutorials and Workshop » Audio Workshop 8

March 20, 2023

Audio Workshop 8

Audio Workshop 8

< Audio Tutorial 7 – Playing Samples
Audio Tutorial 9 – Simple Delay >

Using the Microphone

Now is it time to try using the microphone as the source for audio. These microphones are inexpensive mics, so you can expect telephone quality sound.

Prototyping Systems for Teensy 4.1 ‘Fully Stuffed’ versions have microphones added starting July 2022.

If you have an Audio Adapter without a microphone, you can add one to your adapter which requires a little simple soldering and is available below.

Alternatively, you can order the Audio Adapter with pins that now come with the microphone preinstalled.

You can also skip the tutorials that make use of the microphone for now and perhaps come back to them later if / when you have a microphone installed.

Audio Adapter Microphone
Teensy Audio Adapter Microphone $1.95

Design the Audio System

For a first microphone test, use this simple system below. Be sure to use one of the input section i2s objects and one of the output section i2s objects.

The i2s input object provides stereo data, but when the mic is in use both channels are the same data since it is a mono device. Of course you want to connect to both output channels because listening with only 1 ear is unpleasant.

Turn the Design into Code and Use it in a Program

You can copy and paste the code below into an IDE window, or open the File > Examples > Audio > Tutorial > Part_2_04_Microphone_Check as they are the same for this example.

// Advanced Microcontroller-based Audio Workshop
//
// http://www.pjrc.com/store/audio_tutorial_kit.html
// https://hackaday.io/project/8292-microcontroller-audio-workshop-had-supercon-2015
// 
// Part 2-4: Using The Microphone


///////////////////////////////////
// copy the Design Tool code here
///////////////////////////////////


//===============================================================================
//  Initialization
//===============================================================================
void setup() {
  Serial.begin(9600);
  AudioMemory(8);
  sgtl5000_1.enable();
  sgtl5000_1.volume(0.5);
  sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
  sgtl5000_1.micGain(36);
  delay(1000);
}
//===============================================================================
//  Main
//===============================================================================
void loop() {
  // do nothing
}

Now Export and copy & paste the Design Tool code into the program to complete it and verify and upload the program to the Teensy.

If you tap on the microphone or speak into it, you should hear tapping noises or your voice in the headphones.

Modify the Microphone Volume

Until now, every example has simply enabled the SGTL5000 and set the headphone volume. If you review the SGTL5000 documentation in the right panel of the Design Tool, it has a dizzying number of configurable features. By default, the I2S input will use the line level input pins on the top edge of the Audio Adapter. The inputSelect() function is needed to use the microphone.

  sgtl5000_1.enable();
  sgtl5000_1.volume(0.5);
  sgtl5000_1.inputSelect(AUDIO_INPUT_MIC);
  sgtl5000_1.micGain(36);

The main setting to adjust is the micGain(). you can adjust between 0 to 63. Zero will not let you hear anything from this mic and 63 will amplify a lot of static and probably be far too sensitive. Try adjusting this parameter to see the effect.

< Audio Tutorial 7 – Playing Samples
Audio Tutorial 9 – Simple Delay >

PRODUCT SEARCH

PRODUCT CATEGORIES

  • Arduino, Teensy & IOT
  • Audio & Video
  • Breadboards & Supplies
  • Breakout Modules
  • Cables & Wires
  • Communications & Interfacing
  • Connectors & Headers
  • Displays, LEDs & Panel Meters
  • Fans & Hardware
  • ICs & Semiconductors
  • Passive Components
  • PCBs - Prototype & Adapter
  • Power Supplies & Converters
  • Proximity, Distance & Collision
  • Relays, MOSFETs & Power Ctrl
  • Robotics, Motors & Motion
  • Sensors
  • Supplies & Consumables
  • Switches & User Input
  • Temperature & Humidity
  • Test, Tools & Test Accessories

Pay Additional Charges

Dollar SignClick to add additional charges to your order

Recent Blog Entries

  • Prototyping System for Teensy 4.1 Baseboard

    Prototyping System for Teensy 4.1 Now Available

    It’s hard not to love the Teensy 4.1 with its 6...
  • Teensy 4.1 Fully Loaded

    Teensy 4.1 Fully Loaded Products Available

    As we expand our Teensy product offerings, we n...

Like Us On Facebook

Fine Print

  • Terms of Service
  • Shipping & Returns
credit-card-paypal-logos
RapidSSL_SEAL-90x50

GET IN TOUCH

Email: support@protosupplies.com

ProtoSupplies.com
Veteran Owned and Operated
Lake Stevens WA 98258, USA

  • Terms of Service
  • Shipping & Returns

© 2022 All rights reserved.

TOP