Giorno: 25 marzo 2016

Speex encode in a file using python

I'm using the script found on this blog Google speech recognition with python (I give any credit to author).

 import sys
    import pyaudio, speex
    import numpy as np  # just for doing a standard deviation for audio level checks
    import urllib2
    import wave

    e = speex.Encoder()
    d = speex.Decoder()

    chunk = 320 # tried other numbers... some don't work
    FORMAT = pyaudio.paInt16
    CHANNELS = 1
    RATE = 16000 # "wideband" mode for speex. May work with 8000. Haven't tried it.

    p = pyaudio.PyAudio()

    # Start the stream to record the audio
    stream = = FORMAT,
                    channels = CHANNELS,
                    rate = RATE,
                    input = True,
                    output = True,
                    frames_per_buffer = chunk)

    print "Listening. Recording will start when some sound is heard."

    threshold = 200  # Adjust this to be slightly above the noise level of your recordings.
    nquit = 40 # number of silent frames before terminating the program
    nover = 0
    keepgoing = True
    spxlist=[]  # list of the encoded speex packets/frames
    while keepgoing:
      data = # grab 320 samples from the microphone
      spxdata = e.encode(data) # encode using the speex dll
      print "Length encoded: %d"%len(spxdata) # print the length, after encoding. Can't exceed 255!
      a=np.frombuffer(data,np.int16) # convert to numpy array to check for silence or audio
      if audiolevel < threshold:  # too quiet

      if nover >= nquit:

      print '%2.1f (%d%% quiet)'%(audiolevel, nover*100/nquit)

    print "Too quiet. I'm stopping now."
    fullspx=''.join(spxlist)  # make a string of all the header-ized speex packets
    out_file = open("test.spx","wb")

Annunci Einstein-A20, A unlimited potential Embeded Computer Module

Just like the previous announcement,  Cubietech will operate another product category other than Cubieboard series, we call it Einstein series. It’s also a relatively complete computer module, but with more potential feature expanding ability. Now we deliver the first member of this family Einstein-A20. With this product, the small company and start-up team can finish their prototypes very quickly and even run production with no trouble. Below is some preview photoes, I hope you will like it…