Connect with us

BitVoicer Help

Discussion in 'Microcontrollers, Programming and IoT' started by _Nate_, May 4, 2018.

  1. _Nate_

    _Nate_

    99
    0
    Jun 12, 2017
    Hi everyone! I would like to get a concept realized that I have been looking into recently. So I am attempting to familiarize myself with BitVoicer, a voice-recognition software that uses an online database rather than an on-board system. Once parts arrive, I'm going to attempt making a wireless voice-recognition system using BitVoicer, an Arduino Nano with an esp-01 (or just esp8266 board) and an Adafruit electret microphone module and amplifier module. The main issue is this: there aren't many tutorials online with making a connection from the ESP to the BitVoicer server. I would like to ask anyone knowledgeable on the subject to help guide me in connecting the software to my wireless Nano & ESP-01 configuration.

    My end goal is this: make a small portable system where I can use voice recognition with the esp-01 tied to a wifi hotspot on my phone.
     
  2. _Nate_

    _Nate_

    99
    0
    Jun 12, 2017
    So I am attempting projects with BitVoicer, but with the lack of known information and online help about this program, I am having great difficulty troubleshooting. I am looking for someone knowledgeable in this subject to aid me in my current project. Right now the issue I am having is getting speech to recognize on the BitVoicer application (error is "Audio Level Limit Not Reached") and also connecting my adafruit electret microphone to be used as input.
     
  3. kellys_eye

    kellys_eye

    4,286
    1,143
    Jun 25, 2010
    Which version of Adafruits electret are you using? Does it have the same specifications as the module recommended in the Bitvoicer manual? Have you connected the microphone module correctly and adjusted the level control?
     
  4. _Nate_

    _Nate_

    99
    0
    Jun 12, 2017
    I need to clarify real quick - the audio level error appears when I use my headset mic. Using this microphone, the option to select the device does not appear when wired correctly: https://rover.ebay.com/rover/0/0/0?mpre=https://www.ebay.com/ulk/itm/162539910574
     
  5. kellys_eye

    kellys_eye

    4,286
    1,143
    Jun 25, 2010
    Your headset mic will not have an amplified output (as the electret boards from Adafruit et al have) and the board cannot detect the small levels coming from your headset mic.
     
  6. _Nate_

    _Nate_

    99
    0
    Jun 12, 2017
    Alright thanks. So What's wrong with the configuration of the adafruit mic? Where it says "Recognition client" on the server there are no available devices, and calibrating the microcontroller audio streaming doesn't seem to do anything.
     
  7. kellys_eye

    kellys_eye

    4,286
    1,143
    Jun 25, 2010
    dunno??? does it have an adjustable level control? If so, try it at three or four positions around the span of operation - but speaking into the mic and observing the audio level (as per page 71 of the bitvoicer manual) you should be able to adjust it so that normal speech shows a decent movement of the bargraph display.

    Can you show a picture of your wiring arrangement?
     
  8. _Nate_

    _Nate_

    99
    0
    Jun 12, 2017
    Ok picture is attached below. Here is the code BTW:

    #include <BitVoicer11.h>
    #include <BVSP.h>
    #include <BVSMic.h>

    // Defines the Arduino pin that will be used to capture audio
    #define BVSM_AUDIO_INPUT 5

    // Defines the LED pins
    #define RED_LED_PIN 6
    #define YELLOW_LED_PIN 9
    #define GREEN_LED_PIN 10

    // Defines the constants that will be passed as parameters to
    // the BVSP.begin function
    const unsigned long STATUS_REQUEST_TIMEOUT = 1000;
    const unsigned long STATUS_REQUEST_INTERVAL = 2000;

    // Defines the size of the audio buffer
    const int AUDIO_BUFFER_SIZE = 64;

    // Defines the size of the receive buffer
    const int RECEIVE_BUFFER_SIZE = 2;

    // Initializes a new global instance of the BVSP class
    BVSP bvsp = BVSP();

    // Initializes a new global instance of the BVSMic class
    BVSMic bvsm = BVSMic();

    // Creates a buffer that will be used to read recorded samples
    // from the BVSMic class
    byte audioBuffer[AUDIO_BUFFER_SIZE];

    // Creates a buffer that will be used to read the commands sent
    // from BitVoicer Server.
    // Byte 0 = pin number
    // Byte 1 = pin value
    byte receiveBuffer[RECEIVE_BUFFER_SIZE];

    void setup()
    {
    // Sets up the pin modes
    pinMode(RED_LED_PIN, OUTPUT);
    pinMode(YELLOW_LED_PIN, OUTPUT);
    pinMode(GREEN_LED_PIN, OUTPUT);

    // Starts serial communication at 115200 bps
    Serial.begin(115200);

    // Sets the Arduino serial port that will be used for
    // communication, how long it will take before a status request
    // times out and how often status requests should be sent to
    // BitVoicer Server.
    bvsp.begin(Serial, STATUS_REQUEST_TIMEOUT, STATUS_REQUEST_INTERVAL);

    // Defines the function that will handle the frameReceived
    // event
    bvsp.frameReceived = BVSP_frameReceived;

    // Prepares the BVSMic class timer
    bvsm.begin();
    }

    void loop()
    {
    // Checks if the status request interval has elapsed and if it
    // has, sends a status request to BitVoicer Server
    bvsp.keepAlive();

    // Checks if there is data available at the serial port buffer
    // and processes its content according to the specifications
    // of the BitVoicer Server Protocol
    bvsp.receive();

    // Checks if there is one SRE available. If there is one,
    // starts recording.
    if (bvsp.isSREAvailable())
    {
    // If the BVSMic class is not recording, sets up the audio
    // input and starts recording
    if (!bvsm.isRecording)
    {
    bvsm.setAudioInput(BVSM_AUDIO_INPUT, EXTERNAL);
    bvsm.startRecording();
    }

    // Checks if the BVSMic class has available samples
    if (bvsm.available)
    {
    // Makes sure the inbound mode is STREAM_MODE before
    // transmitting the stream
    if (bvsp.inboundMode == FRAMED_MODE)
    bvsp.setInboundMode(STREAM_MODE);

    // Reads the audio samples from the BVSMic class
    int bytesRead = bvsm.read(audioBuffer, AUDIO_BUFFER_SIZE);

    // Sends the audio stream to BitVoicer Server
    bvsp.sendStream(audioBuffer, bytesRead);
    }
    }
    else
    {
    // No SRE is available. If the BVSMic class is recording,
    // stops it.
    if (bvsm.isRecording)
    bvsm.stopRecording();
    }
    }

    // Handles the frameReceived event
    void BVSP_frameReceived(byte dataType, int payloadSize)
    {
    // Checks if the received frame contains binary data
    // 0x07 = Binary data (byte array)
    if (dataType == DATA_TYPE_BINARY)
    {
    // If 2 bytes were received, process the command
    if (bvsp.getReceivedBytes(receiveBuffer, RECEIVE_BUFFER_SIZE) ==
    RECEIVE_BUFFER_SIZE)
    {
    analogWrite(receiveBuffer[0], receiveBuffer[1]);
    }
    }
    }
     

    Attached Files:

  9. Hopup

    Hopup

    216
    27
    Jul 5, 2015
    You do have the activated copy of the program?
     
  10. _Nate_

    _Nate_

    99
    0
    Jun 12, 2017
    I do ofc :)
     
  11. Hopup

    Hopup

    216
    27
    Jul 5, 2015
    Your code is not similar than in the chapter 5.5.2 Audio Captured by a Microphone Wired to the Microcontroller. I think you should try this code for testing.
     
  12. _Nate_

    _Nate_

    99
    0
    Jun 12, 2017
    I have used test codes to figure out that the problem isn't the mic so that's good. The issue lies elsewhere. Right now testing with any audio input results in an error: "Index was out of range. Must be non-negative and less than the size of the collection." I don't recall messing with any indexes.
     
  13. Hopup

    Hopup

    216
    27
    Jul 5, 2015
    You need to have Analog reference voltage AREF pin connected to positive side of the microphone.

    EDIT: Forget this if your microphone did really work just fine with testing.
     
    Last edited: May 15, 2018
  14. _Nate_

    _Nate_

    99
    0
    Jun 12, 2017
    Alright. I have been warned about connecting this pin without making sure some code is run on the Arduino's part. Is this correct?

    EDIT: I added the necessary code into the program. Nothing has changed regarding the index error.
     
  15. Hopup

    Hopup

    216
    27
    Jul 5, 2015
    Yeah you need to add setAnalogReference() first in the setup.
     
  16. _Nate_

    _Nate_

    99
    0
    Jun 12, 2017
    Yes I did this but the error for the index still remains.
     
  17. _Nate_

    _Nate_

    99
    0
    Jun 12, 2017
    Bump
     
  18. Hopup

    Hopup

    216
    27
    Jul 5, 2015
    Where did you get the code you posted here? I don't see need for all that code.
     
  19. _Nate_

    _Nate_

    99
    0
    Jun 12, 2017
    I got it from an instructable for controlling LEDs.
     
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-