<p>There could be multiple ways from using a neural network to calculate even posteriors and feeding those posteriors into Hopfield like described in this paper:</p>

<p><a href="http://www.assta.org/sst/SST-92/cache/SST-92-NeuralNetworks-p14.pdf" rel="nofollow">http://www.assta.org/sst/SST-92/cache/SST-92-NeuralNetworks-p14.pdf</a></p>

<p>Second approach would be just to convert samples to bits, that would be more complex but also more interesting like in the following modern research:</p>

<p>Multilingual Language Processing From Bytes
Dan Gillick, Cliff Brunk, Oriol Vinyals, Amarnag Subramanya
<a href="http://arxiv.org/abs/1512.00103" rel="nofollow">http://arxiv.org/abs/1512.00103</a></p>

<p>You should have study algorithm and choose yourself first.</p>
Reading the Data part of a WAV file for voice recognition with Hopfield Neural Network
<p>I want to write a sound recognition program. I have the algorithm, but I cant properly read the voice from the microphone. I have a code from <a href="https://stackoverflow.com/">https://stackoverflow.com/</a>, witch read data from a wav file, but I don't know how to put the wav raw data in a binary vector or array. So basically I need a binary vector or array which contains the data bits (1-s or 0-s) and it has to be 2000-4000 bit long. How can I do that?</p>

<p>(I am using it with a Hopfield Neural Network)</p>

<pre><code>    #include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;fstream&gt;
#include &lt;cstdint&gt;

using std::cin;
using std::cout;
using std::endl;
using std::fstream;
using std::string;

typedef struct  WAV_HEADER
{
    /* RIFF Chunk Descriptor */
    uint8_t         RIFF[4];        // RIFF Header Magic header
    uint32_t        ChunkSize;      // RIFF Chunk Size
    uint8_t         WAVE[4];        // WAVE Header
    /* "fmt" sub-chunk */
    uint8_t         fmt[4];         // FMT header
    uint32_t        Subchunk1Size;  // Size of the fmt chunk
    uint16_t        AudioFormat;    // Audio format 1=PCM,6=mulaw,7=alaw,     257=IBM Mu-Law, 258=IBM A-Law, 259=ADPCM
    uint16_t        NumOfChan;      // Number of channels 1=Mono 2=Sterio
    uint32_t        SamplesPerSec;  // Sampling Frequency in Hz
    uint32_t        bytesPerSec;    // bytes per second
    uint16_t        blockAlign;     // 2=16-bit mono, 4=16-bit stereo
    uint16_t        bitsPerSample;  // Number of bits per sample
    /* "data" sub-chunk */
    uint8_t         Subchunk2ID[4]; // "data"  string
    uint32_t        Subchunk2Size;  // Sampled data length
} wav_hdr;

// Function prototypes
int getFileSize(FILE* inFile);

int main(int argc, char* argv[])
{
    wav_hdr wavHeader;
    int headerSize = sizeof(wav_hdr), filelength = 0;

    const char* filePath;
    string input;
    if (argc &lt;= 1)
    {
        cout &lt;&lt; "Input wave file name: ";
        cin &gt;&gt; input;
        cin.get();
        filePath = input.c_str();
    }
    else
    {
        filePath = argv[1];
        cout &lt;&lt; "Input wave file name: " &lt;&lt; filePath &lt;&lt; endl;
    }

    FILE* wavFile = fopen(filePath, "r");
    if (wavFile == nullptr)
    {
        fprintf(stderr, "Unable to open wave file: %s\n", filePath);
        return 1;
    }

    //Read the header
    size_t bytesRead = fread(&amp;wavHeader, 1, headerSize, wavFile);
    cout &lt;&lt; "Header Read " &lt;&lt; bytesRead &lt;&lt; " bytes." &lt;&lt; endl;
    if (bytesRead &gt; 0)
    {
        //Read the data
        uint16_t bytesPerSample = wavHeader.bitsPerSample / 8;      //Number     of bytes per sample
        uint64_t numSamples = wavHeader.ChunkSize / bytesPerSample; //How many samples are in the wav file?
        static const uint16_t BUFFER_SIZE = 4096;
        int8_t* buffer = new int8_t[BUFFER_SIZE];
        while ((bytesRead = fread(buffer, sizeof buffer[0], BUFFER_SIZE / (sizeof buffer[0]), wavFile)) &gt; 0)
        {
            /** DO SOMETHING WITH THE WAVE DATA HERE **/
            cout &lt;&lt; "Read " &lt;&lt; bytesRead &lt;&lt; " bytes." &lt;&lt; endl;
        }
        delete [] buffer;
        buffer = nullptr;
        filelength = getFileSize(wavFile);

        cout &lt;&lt; "File is                    :" &lt;&lt; filelength &lt;&lt; " bytes." &lt;&lt; endl;
        cout &lt;&lt; "RIFF header                :" &lt;&lt; wavHeader.RIFF[0] &lt;&lt; wavHeader.RIFF[1] &lt;&lt; wavHeader.RIFF[2] &lt;&lt; wavHeader.RIFF[3] &lt;&lt; endl;
        cout &lt;&lt; "WAVE header                :" &lt;&lt; wavHeader.WAVE[0] &lt;&lt; wavHeader.WAVE[1] &lt;&lt; wavHeader.WAVE[2] &lt;&lt; wavHeader.WAVE[3] &lt;&lt; endl;
        cout &lt;&lt; "FMT                        :" &lt;&lt; wavHeader.fmt[0] &lt;&lt; wavHeader.fmt[1] &lt;&lt; wavHeader.fmt[2] &lt;&lt; wavHeader.fmt[3] &lt;&lt; endl;
        cout &lt;&lt; "Data size                  :" &lt;&lt; wavHeader.ChunkSize &lt;&lt; endl;

        // Display the sampling Rate from the header
        cout &lt;&lt; "Sampling Rate              :" &lt;&lt; wavHeader.SamplesPerSec &lt;&lt; endl;
        cout &lt;&lt; "Number of bits used        :" &lt;&lt; wavHeader.bitsPerSample &lt;&lt; endl;
        cout &lt;&lt; "Number of channels         :" &lt;&lt; wavHeader.NumOfChan &lt;&lt; endl;
        cout &lt;&lt; "Number of bytes per second :" &lt;&lt; wavHeader.bytesPerSec &lt;&lt; endl;
        cout &lt;&lt; "Data length                :" &lt;&lt; wavHeader.Subchunk2Size &lt;&lt; endl;
        cout &lt;&lt; "Audio Format               :" &lt;&lt; wavHeader.AudioFormat &lt;&lt; endl;
        // Audio format 1=PCM,6=mulaw,7=alaw, 257=IBM Mu-Law, 258=IBM A-Law, 259=ADPCM

        cout &lt;&lt; "Block align                :" &lt;&lt; wavHeader.blockAlign &lt;&lt; endl;
        cout &lt;&lt; "Data string                :" &lt;&lt; wavHeader.Subchunk2ID[0] &lt;&lt; wavHeader.Subchunk2ID[1] &lt;&lt; wavHeader.Subchunk2ID[2] &lt;&lt; wavHeader.Subchunk2ID[3] &lt;&lt; endl;
    }
    fclose(wavFile);
    return 0;
}

// find the file size
int getFileSize(FILE* inFile)
{
    int fileSize = 0;
    fseek(inFile, 0, SEEK_END);

    fileSize = ftell(inFile);

    fseek(inFile, 0, SEEK_SET);
    return fileSize;
}
</code></pre>