BitVoicer Help

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

  1. _Nate_

    _Nate_

    Joined:
    Jun 12, 2017
    Messages:
    97
    Likes Received:
    0
    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.
     
    _Nate_, May 4, 2018
    #1
    1. Advertisements

  2. _Nate_

    _Nate_

    Joined:
    Jun 12, 2017
    Messages:
    97
    Likes Received:
    0
    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.
     
    _Nate_, May 13, 2018
    #2
    1. Advertisements

  3. _Nate_

    kellys_eye

    Joined:
    Jun 25, 2010
    Messages:
    3,611
    Likes Received:
    960
    Location:
    West Coast, Scotland
    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?
     
    kellys_eye, May 13, 2018
    #3
  4. _Nate_

    _Nate_

    Joined:
    Jun 12, 2017
    Messages:
    97
    Likes Received:
    0
    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
     
    _Nate_, May 13, 2018
    #4
  5. _Nate_

    kellys_eye

    Joined:
    Jun 25, 2010
    Messages:
    3,611
    Likes Received:
    960
    Location:
    West Coast, Scotland
    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.
     
    kellys_eye, May 13, 2018
    #5
  6. _Nate_

    _Nate_

    Joined:
    Jun 12, 2017
    Messages:
    97
    Likes Received:
    0
    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.
     
    _Nate_, May 13, 2018
    #6
  7. _Nate_

    kellys_eye

    Joined:
    Jun 25, 2010
    Messages:
    3,611
    Likes Received:
    960
    Location:
    West Coast, Scotland
    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?
     
    kellys_eye, May 13, 2018
    #7
  8. _Nate_

    _Nate_

    Joined:
    Jun 12, 2017
    Messages:
    97
    Likes Received:
    0
    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:

    _Nate_, May 13, 2018
    #8
  9. _Nate_

    Hopup

    Joined:
    Jul 5, 2015
    Messages:
    179
    Likes Received:
    20
    You do have the activated copy of the program?
     
    Hopup, May 14, 2018
    #9
  10. _Nate_

    _Nate_

    Joined:
    Jun 12, 2017
    Messages:
    97
    Likes Received:
    0
    I do ofc :)
     
    _Nate_, May 14, 2018
    #10
  11. _Nate_

    Hopup

    Joined:
    Jul 5, 2015
    Messages:
    179
    Likes Received:
    20
    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.
     
    Hopup, May 14, 2018
    #11
  12. _Nate_

    _Nate_

    Joined:
    Jun 12, 2017
    Messages:
    97
    Likes Received:
    0
    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.
     
    _Nate_, May 15, 2018
    #12
  13. _Nate_

    Hopup

    Joined:
    Jul 5, 2015
    Messages:
    179
    Likes Received:
    20
    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
    Hopup, May 15, 2018
    #13
  14. _Nate_

    _Nate_

    Joined:
    Jun 12, 2017
    Messages:
    97
    Likes Received:
    0
    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.
     
    _Nate_, May 15, 2018
    #14
  15. _Nate_

    Hopup

    Joined:
    Jul 5, 2015
    Messages:
    179
    Likes Received:
    20
    Yeah you need to add setAnalogReference() first in the setup.
     
    Hopup, May 15, 2018
    #15
  16. _Nate_

    _Nate_

    Joined:
    Jun 12, 2017
    Messages:
    97
    Likes Received:
    0
    Yes I did this but the error for the index still remains.
     
    _Nate_, May 15, 2018
    #16
  17. _Nate_

    _Nate_

    Joined:
    Jun 12, 2017
    Messages:
    97
    Likes Received:
    0
    Bump
     
    _Nate_, May 16, 2018
    #17
  18. _Nate_

    Hopup

    Joined:
    Jul 5, 2015
    Messages:
    179
    Likes Received:
    20
    Where did you get the code you posted here? I don't see need for all that code.
     
    Hopup, May 16, 2018
    #18
  19. _Nate_

    _Nate_

    Joined:
    Jun 12, 2017
    Messages:
    97
    Likes Received:
    0
    I got it from an instructable for controlling LEDs.
     
    _Nate_, May 16, 2018
    #19
    1. Advertisements

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.