Menu

-adcdev argument in Python script

Help
2016-03-11
2016-03-14
  • Agathe Blaise

    Agathe Blaise - 2016-03-11

    I'm trying to launch pocketsphinx with a mic.

    So when I'm launching "pocketsphinx_continuous -hmm /usr/local/share/pocketsphinx/model/en-us/en-us -lm 9961.lm -dict 9961.dic -samprate 16000/8000/48000 -inmic yes -adcdev plughw:1,0", there are no problems.

    But when I'm launching a script with pocketsphinx where I give some arguments to the decoder, it doesn't work.
    Here is an extract of the code :

    from pocketsphinx import *
    
    hmm = '/usr/local/share/pocketsphinx/model/en-us/en-us'
    dic = '/usr/local/share/pocketsphinx/model/en-us/9961.dic'
    lm= '/usr/local/share/pocketsphinx/model/en-us/9961.lm'
    
    config = Decoder.default_config()
    config.set_string('-hmm', hmm)
    config.set_string('-lm', lm)
    config.set_string('-dict', dic)
    config.set_string('-logfn', '/dev/null')
    config.set_string('-adcdev', 'plughw:1,0')
    

    But it returns : ERROR: "cmd_ln.c", line 938: Unknown argument: -adcdev

    Maybe I haven't the right syntax, I don't know.

     
    • Nickolay V. Shmyrev

      In python you configure adcdev in pyaudio framework which does the recording, not in pocketsphinx. You can use input_device_index option for that.

       
  • Agathe Blaise

    Agathe Blaise - 2016-03-11

    So I remove the line config.set_string('-adcdev', 'plughw:1,0').
    Then I replace the line stream = p.open(format=pyaudio.paInt16, channels=1, rate=16000, input=True, frames_per_buffer=1024)
    with stream = p.open(format=pyaudio.paInt16, channels=1, rate=16000, input=True, frames_per_buffer=1024, input_device_index=1)

    But I still have some errors.

     
    • Nickolay V. Shmyrev

      What errors

       
  • Agathe Blaise

    Agathe Blaise - 2016-03-11

    Exception in thread Thread-1:
    Traceback (most recent call last):
    File "/usr/lib/python2.7/threading.py", line 810, in bootstrap_inner
    self.run()
    File "testMic0.py", line 51, in run
    decoder = Decoder(config)
    File "/usr/local/lib/python2.7/dist-packages/pocketsphinx/pocketsphinx.py", line 266, in __init

    this = _pocketsphinx.new_Decoder(*args)
    RuntimeError: new_Decoder returned -1

     
    • Nickolay V. Shmyrev

      You can enable logging back (-logfn option) to see the details.

       
  • Agathe Blaise

    Agathe Blaise - 2016-03-11

    It is saved in /dev/null, but I don't know how to open this file.

     
    • Nickolay V. Shmyrev

      /dev/null is a unix special file (device) to drop output. Everything written to that file is lost.

      You can remove the line

        config.set_string('-logfn', '/dev/null')
      

      to dump log to stdout. You can also use

      config.set_string('-logfn', 'filename.log')
      

      to dump log to a file.

       
  • Agathe Blaise

    Agathe Blaise - 2016-03-11

    Ok, thanks you.
    So I could fix some erros, but I still have these ones :

    INFO: pocketsphinx.c(152): Parsed model-specific feature parameters from /usr/local/share/pocketsphinx/model/en-us/en-us/feat.params
    Current configuration:
    [NAME]          [DEFLT]     [VALUE]
    -agc            none        none
    -agcthresh      2.0     2.000000e+00
    -allphone               
    -allphone_ci        no      no
    -alpha          0.97        9.700000e-01
    -ascale         20.0        2.000000e+01
    -aw         1       1
    -backtrace      no      no
    -beam           1e-48       1.000000e-48
    -bestpath       yes     yes
    -bestpathlw     9.5     9.500000e+00
    -ceplen         13      13
    -cmn            current     current
    -cmninit        8.0     40,3,-1
    -compallsen     no      no
    -debug                  0
    -dict                   /usr/local/share/pocketsphinx/model/en-us/9961.dic
    -dictcase       no      no
    -dither         no      no
    -doublebw       no      no
    -ds         1       1
    -fdict                  
    -feat           1s_c_d_dd   1s_c_d_dd
    -featparams             
    -fillprob       1e-8        1.000000e-08
    -frate          100     100
    -fsg                    
    -fsgusealtpron      yes     yes
    -fsgusefiller       yes     yes
    -fwdflat        yes     yes
    -fwdflatbeam        1e-64       1.000000e-64
    -fwdflatefwid       4       4
    -fwdflatlw      8.5     8.500000e+00
    -fwdflatsfwin       25      25
    -fwdflatwbeam       7e-29       7.000000e-29
    -fwdtree        yes     yes
    -hmm                    /usr/local/share/pocketsphinx/model/en-us/en-us
    -input_endian       little      little
    -jsgf                   
    -keyphrase              
    -kws                    
    -kws_delay      10      10
    -kws_plp        1e-1        1.000000e-01
    -kws_threshold      1       1.000000e+00
    -latsize        5000        5000
    -lda                    
    -ldadim         0       0
    -lifter         0       22
    -lm                 /usr/local/share/pocketsphinx/model/en-us/9961.lm
    -lmctl                  
    -lmname                 
    -logbase        1.0001      1.000100e+00
    -logfn                  
    -logspec        no      no
    -lowerf         133.33334   1.300000e+02
    -lpbeam         1e-40       1.000000e-40
    -lponlybeam     7e-29       7.000000e-29
    -lw         6.5     6.500000e+00
    -maxhmmpf       30000       30000
    -maxwpf         -1      -1
    -mdef                   
    -mean                   
    -mfclogdir              
    -min_endfr      0       0
    -mixw                   
    -mixwfloor      0.0000001   1.000000e-07
    -mllr                   
    -mmap           yes     yes
    -ncep           13      13
    -nfft           512     512
    -nfilt          40      25
    -nwpen          1.0     1.000000e+00
    -pbeam          1e-48       1.000000e-48
    -pip            1.0     1.000000e+00
    -pl_beam        1e-10       1.000000e-10
    -pl_pbeam       1e-10       1.000000e-10
    -pl_pip         1.0     1.000000e+00
    -pl_weight      3.0     3.000000e+00
    -pl_window      5       5
    -rawlogdir              
    -remove_dc      no      no
    -remove_noise       yes     yes
    -remove_silence     yes     yes
    -round_filters      yes     yes
    -samprate       16000       1.600000e+04
    -seed           -1      -1
    -sendump                
    -senlogdir              
    -senmgau                
    -silprob        0.005       5.000000e-03
    -smoothspec     no      no
    -svspec                 0-12/13-25/26-38
    -tmat                   
    -tmatfloor      0.0001      1.000000e-04
    -topn           4       4
    -topn_beam      0       0
    -toprule                
    -transform      legacy      dct
    -unit_area      yes     yes
    -upperf         6855.4976   6.800000e+03
    -uw         1.0     1.000000e+00
    -vad_postspeech     50      50
    -vad_prespeech      20      20
    -vad_startspeech    10      10
    -vad_threshold      2.0     2.000000e+00
    -var                    
    -varfloor       0.0001      1.000000e-04
    -varnorm        no      no
    -verbose        no      no
    -warp_params                
    -warp_type      inverse_linear  inverse_linear
    -wbeam          7e-29       7.000000e-29
    -wip            0.65        6.500000e-01
    -wlen           0.025625    2.562500e-02
    
    INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='current', VARNORM='no', AGC='none'
    INFO: cmn.c(143): mean[0]= 12.00, mean[1..12]= 0.0
    INFO: acmod.c(164): Using subvector specification 0-12/13-25/26-38
    INFO: mdef.c(518): Reading model definition: /usr/local/share/pocketsphinx/model/en-us/en-us/mdef
    INFO: mdef.c(531): Found byte-order mark BMDF, assuming this is a binary mdef file
    INFO: bin_mdef.c(336): Reading binary model definition: /usr/local/share/pocketsphinx/model/en-us/en-us/mdef
    INFO: bin_mdef.c(516): 42 CI-phone, 137053 CD-phone, 3 emitstate/phone, 126 CI-sen, 5126 Sen, 29324 Sen-Seq
    INFO: tmat.c(206): Reading HMM transition probability matrices: /usr/local/share/pocketsphinx/model/en-us/en-us/transition_matrices
    INFO: acmod.c(117): Attempting to use PTM computation module
    INFO: ms_gauden.c(198): Reading mixture gaussian parameter: /usr/local/share/pocketsphinx/model/en-us/en-us/means
    INFO: ms_gauden.c(292): 42 codebook, 3 feature, size: 
    INFO: ms_gauden.c(294):  128x13
    INFO: ms_gauden.c(294):  128x13
    INFO: ms_gauden.c(294):  128x13
    INFO: ms_gauden.c(198): Reading mixture gaussian parameter: /usr/local/share/pocketsphinx/model/en-us/en-us/variances
    INFO: ms_gauden.c(292): 42 codebook, 3 feature, size: 
    INFO: ms_gauden.c(294):  128x13
    INFO: ms_gauden.c(294):  128x13
    INFO: ms_gauden.c(294):  128x13
    INFO: ms_gauden.c(354): 222 variance values floored
    INFO: ptm_mgau.c(476): Loading senones from dump file /usr/local/share/pocketsphinx/model/en-us/en-us/sendump
    INFO: ptm_mgau.c(500): BEGIN FILE FORMAT DESCRIPTION
    INFO: ptm_mgau.c(563): Rows: 128, Columns: 5126
    INFO: ptm_mgau.c(595): Using memory-mapped I/O for senones
    INFO: ptm_mgau.c(835): Maximum top-N: 4
    INFO: phone_loop_search.c(114): State beam -225 Phone exit beam -225 Insertion penalty 0
    INFO: dict.c(320): Allocating 4112 * 20 bytes (80 KiB) for word entries
    INFO: dict.c(333): Reading main dictionary: /usr/local/share/pocketsphinx/model/en-us/9961.dic
    INFO: dict.c(213): Allocated 0 KiB for strings, 0 KiB for phones
    INFO: dict.c(336): 11 words read
    INFO: dict.c(358): Reading filler dictionary: /usr/local/share/pocketsphinx/model/en-us/en-us/noisedict
    INFO: dict.c(213): Allocated 0 KiB for strings, 0 KiB for phones
    INFO: dict.c(361): 5 words read
    INFO: dict2pid.c(396): Building PID tables for dictionary
    INFO: dict2pid.c(406): Allocating 42^3 * 2 bytes (144 KiB) for word-initial triphones
    INFO: dict2pid.c(132): Allocated 21336 bytes (20 KiB) for word-final triphones
    INFO: dict2pid.c(196): Allocated 21336 bytes (20 KiB) for single-phone word triphones
    INFO: ngram_model_trie.c(456): Trying to read LM in trie binary format
    INFO: ngram_model_trie.c(467): Header doesn't match
    INFO: ngram_model_trie.c(189): Trying to read LM in arpa format
    INFO: ngram_model_trie.c(205): LM of order 3
    INFO: ngram_model_trie.c(207): #1-grams: 10
    INFO: ngram_model_trie.c(207): #2-grams: 13
    INFO: ngram_model_trie.c(207): #3-grams: 12
    INFO: lm_trie.c(399): Training quantizer
    INFO: lm_trie.c(407): Building LM trie
    INFO: ngram_search_fwdtree.c(99): 10 unique initial diphones
    INFO: ngram_search_fwdtree.c(148): 0 root, 0 non-root channels, 6 single-phone words
    INFO: ngram_search_fwdtree.c(186): Creating search tree
    INFO: ngram_search_fwdtree.c(192): before: 0 root, 0 non-root channels, 6 single-phone words
    INFO: ngram_search_fwdtree.c(326): after: max nonroot chan increased to 136
    INFO: ngram_search_fwdtree.c(339): after: 10 root, 8 non-root channels, 5 single-phone words
    INFO: ngram_search_fwdflat.c(157): fwdflat: min_ef_width = 4, max_sf_win = 25
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.front.0:CARD=0'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM front
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround21
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround21
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround40.0:CARD=0'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround40
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround41
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround50
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround51
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround71.0:CARD=0'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround71
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM iec958
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM spdif
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM spdif
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
    ALSA lib dlmisc.c:252:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_pcm_bluetooth.so
    ALSA lib dlmisc.c:252:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_pcm_bluetooth.so
    Cannot connect to server socket err = No such file or directory
    Cannot connect to server request channel
    jack server is not running or cannot be started
    Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1514
    Expression 'ValidateParameters( inputParameters, hostApi, StreamDirection_In )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2818
    Exception in thread Thread-1:
    Traceback (most recent call last):
      File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
        self.run()
      File "testMic0.py", line 53, in run
        stream = p.open(format=pyaudio.paInt16, channels=1, rate=16000, input=True, frames_per_buffer=1024, input_device_index=1)
      File "build/bdist.linux-armv7l/egg/pyaudio.py", line 750, in open
        stream = Stream(self, *args, **kwargs)
      File "build/bdist.linux-armv7l/egg/pyaudio.py", line 441, in __init__
        self._stream = pa.open(**arguments)
    IOError: [Errno -9998] Invalid number of channels
    
    INFO: ngram_search_fwdtree.c(432): TOTAL fwdtree 0.00 CPU nan xRT
    INFO: ngram_search_fwdtree.c(435): TOTAL fwdtree 0.00 wall nan xRT
    INFO: ngram_search_fwdflat.c(176): TOTAL fwdflat 0.00 CPU nan xRT
    INFO: ngram_search_fwdflat.c(179): TOTAL fwdflat 0.00 wall nan xRT
    INFO: ngram_search.c(303): TOTAL bestpath 0.00 CPU nan xRT
    INFO: ngram_search.c(306): TOTAL bestpath 0.00 wall nan xRT
    
     
  • Agathe Blaise

    Agathe Blaise - 2016-03-11

    I converted 9961.lm.bin into 9961.lm.bin and some errors are no longer here.
    It seems like I have some problems with my cards

    INFO: pocketsphinx.c(152): Parsed model-specific feature parameters from /usr/local/share/pocketsphinx/model/en-us/en-us/feat.params
    Current configuration:
    [NAME]          [DEFLT]     [VALUE]
    -agc            none        none
    -agcthresh      2.0     2.000000e+00
    -allphone               
    -allphone_ci        no      no
    -alpha          0.97        9.700000e-01
    -ascale         20.0        2.000000e+01
    -aw         1       1
    -backtrace      no      no
    -beam           1e-48       1.000000e-48
    -bestpath       yes     yes
    -bestpathlw     9.5     9.500000e+00
    -ceplen         13      13
    -cmn            current     current
    -cmninit        8.0     40,3,-1
    -compallsen     no      no
    -debug                  0
    -dict                   /usr/local/share/pocketsphinx/model/en-us/9961.dic
    -dictcase       no      no
    -dither         no      no
    -doublebw       no      no
    -ds         1       1
    -fdict                  
    -feat           1s_c_d_dd   1s_c_d_dd
    -featparams             
    -fillprob       1e-8        1.000000e-08
    -frate          100     100
    -fsg                    
    -fsgusealtpron      yes     yes
    -fsgusefiller       yes     yes
    -fwdflat        yes     yes
    -fwdflatbeam        1e-64       1.000000e-64
    -fwdflatefwid       4       4
    -fwdflatlw      8.5     8.500000e+00
    -fwdflatsfwin       25      25
    -fwdflatwbeam       7e-29       7.000000e-29
    -fwdtree        yes     yes
    -hmm                    /usr/local/share/pocketsphinx/model/en-us/en-us
    -input_endian       little      little
    -jsgf                   
    -keyphrase              
    -kws                    
    -kws_delay      10      10
    -kws_plp        1e-1        1.000000e-01
    -kws_threshold      1       1.000000e+00
    -latsize        5000        5000
    -lda                    
    -ldadim         0       0
    -lifter         0       22
    -lm                 /usr/local/share/pocketsphinx/model/en-us/9961.lm.bin
    -lmctl                  
    -lmname                 
    -logbase        1.0001      1.000100e+00
    -logfn                  
    -logspec        no      no
    -lowerf         133.33334   1.300000e+02
    -lpbeam         1e-40       1.000000e-40
    -lponlybeam     7e-29       7.000000e-29
    -lw         6.5     6.500000e+00
    -maxhmmpf       30000       30000
    -maxwpf         -1      -1
    -mdef                   
    -mean                   
    -mfclogdir              
    -min_endfr      0       0
    -mixw                   
    -mixwfloor      0.0000001   1.000000e-07
    -mllr                   
    -mmap           yes     yes
    -ncep           13      13
    -nfft           512     512
    -nfilt          40      25
    -nwpen          1.0     1.000000e+00
    -pbeam          1e-48       1.000000e-48
    -pip            1.0     1.000000e+00
    -pl_beam        1e-10       1.000000e-10
    -pl_pbeam       1e-10       1.000000e-10
    -pl_pip         1.0     1.000000e+00
    -pl_weight      3.0     3.000000e+00
    -pl_window      5       5
    -rawlogdir              
    -remove_dc      no      no
    -remove_noise       yes     yes
    -remove_silence     yes     yes
    -round_filters      yes     yes
    -samprate       16000       1.600000e+04
    -seed           -1      -1
    -sendump                
    -senlogdir              
    -senmgau                
    -silprob        0.005       5.000000e-03
    -smoothspec     no      no
    -svspec                 0-12/13-25/26-38
    -tmat                   
    -tmatfloor      0.0001      1.000000e-04
    -topn           4       4
    -topn_beam      0       0
    -toprule                
    -transform      legacy      dct
    -unit_area      yes     yes
    -upperf         6855.4976   6.800000e+03
    -uw         1.0     1.000000e+00
    -vad_postspeech     50      50
    -vad_prespeech      20      20
    -vad_startspeech    10      10
    -vad_threshold      2.0     2.000000e+00
    -var                    
    -varfloor       0.0001      1.000000e-04
    -varnorm        no      no
    -verbose        no      no
    -warp_params                
    -warp_type      inverse_linear  inverse_linear
    -wbeam          7e-29       7.000000e-29
    -wip            0.65        6.500000e-01
    -wlen           0.025625    2.562500e-02
    
    INFO: feat.c(715): Initializing feature stream to type: '1s_c_d_dd', ceplen=13, CMN='current', VARNORM='no', AGC='none'
    INFO: cmn.c(143): mean[0]= 12.00, mean[1..12]= 0.0
    INFO: acmod.c(164): Using subvector specification 0-12/13-25/26-38
    INFO: mdef.c(518): Reading model definition: /usr/local/share/pocketsphinx/model/en-us/en-us/mdef
    INFO: mdef.c(531): Found byte-order mark BMDF, assuming this is a binary mdef file
    INFO: bin_mdef.c(336): Reading binary model definition: /usr/local/share/pocketsphinx/model/en-us/en-us/mdef
    INFO: bin_mdef.c(516): 42 CI-phone, 137053 CD-phone, 3 emitstate/phone, 126 CI-sen, 5126 Sen, 29324 Sen-Seq
    INFO: tmat.c(206): Reading HMM transition probability matrices: /usr/local/share/pocketsphinx/model/en-us/en-us/transition_matrices
    INFO: acmod.c(117): Attempting to use PTM computation module
    INFO: ms_gauden.c(198): Reading mixture gaussian parameter: /usr/local/share/pocketsphinx/model/en-us/en-us/means
    INFO: ms_gauden.c(292): 42 codebook, 3 feature, size: 
    INFO: ms_gauden.c(294):  128x13
    INFO: ms_gauden.c(294):  128x13
    INFO: ms_gauden.c(294):  128x13
    INFO: ms_gauden.c(198): Reading mixture gaussian parameter: /usr/local/share/pocketsphinx/model/en-us/en-us/variances
    INFO: ms_gauden.c(292): 42 codebook, 3 feature, size: 
    INFO: ms_gauden.c(294):  128x13
    INFO: ms_gauden.c(294):  128x13
    INFO: ms_gauden.c(294):  128x13
    INFO: ms_gauden.c(354): 222 variance values floored
    INFO: ptm_mgau.c(476): Loading senones from dump file /usr/local/share/pocketsphinx/model/en-us/en-us/sendump
    INFO: ptm_mgau.c(500): BEGIN FILE FORMAT DESCRIPTION
    INFO: ptm_mgau.c(563): Rows: 128, Columns: 5126
    INFO: ptm_mgau.c(595): Using memory-mapped I/O for senones
    INFO: ptm_mgau.c(835): Maximum top-N: 4
    INFO: phone_loop_search.c(114): State beam -225 Phone exit beam -225 Insertion penalty 0
    INFO: dict.c(320): Allocating 4112 * 20 bytes (80 KiB) for word entries
    INFO: dict.c(333): Reading main dictionary: /usr/local/share/pocketsphinx/model/en-us/9961.dic
    INFO: dict.c(213): Allocated 0 KiB for strings, 0 KiB for phones
    INFO: dict.c(336): 11 words read
    INFO: dict.c(358): Reading filler dictionary: /usr/local/share/pocketsphinx/model/en-us/en-us/noisedict
    INFO: dict.c(213): Allocated 0 KiB for strings, 0 KiB for phones
    INFO: dict.c(361): 5 words read
    INFO: dict2pid.c(396): Building PID tables for dictionary
    INFO: dict2pid.c(406): Allocating 42^3 * 2 bytes (144 KiB) for word-initial triphones
    INFO: dict2pid.c(132): Allocated 21336 bytes (20 KiB) for word-final triphones
    INFO: dict2pid.c(196): Allocated 21336 bytes (20 KiB) for single-phone word triphones
    INFO: ngram_model_trie.c(456): Trying to read LM in trie binary format
    INFO: ngram_search_fwdtree.c(99): 10 unique initial diphones
    INFO: ngram_search_fwdtree.c(148): 0 root, 0 non-root channels, 6 single-phone words
    INFO: ngram_search_fwdtree.c(186): Creating search tree
    INFO: ngram_search_fwdtree.c(192): before: 0 root, 0 non-root channels, 6 single-phone words
    INFO: ngram_search_fwdtree.c(326): after: max nonroot chan increased to 136
    INFO: ngram_search_fwdtree.c(339): after: 10 root, 8 non-root channels, 5 single-phone words
    INFO: ngram_search_fwdflat.c(157): fwdflat: min_ef_width = 4, max_sf_win = 25
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.front.0:CARD=0'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM front
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround21
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround21
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround40.0:CARD=0'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround40
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround41
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround50
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround51.0:CARD=0'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround51
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.surround71.0:CARD=0'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM surround71
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM iec958
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM spdif
    ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.bcm2835.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2'
    ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
    ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM spdif
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
    ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
    ALSA lib dlmisc.c:252:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_pcm_bluetooth.so
    ALSA lib dlmisc.c:252:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/arm-linux-gnueabihf/alsa-lib/libasound_module_pcm_bluetooth.so
    Cannot connect to server socket err = No such file or directory
    Cannot connect to server request channel
    jack server is not running or cannot be started
    Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1514
    Expression 'ValidateParameters( inputParameters, hostApi, StreamDirection_In )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2818
    Exception in thread Thread-1:
    Traceback (most recent call last):
      File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
        self.run()
      File "testMic0.py", line 53, in run
        stream = p.open(format=pyaudio.paInt16, channels=1, rate=16000, input=True, frames_per_buffer=1024, input_device_index=1)
      File "build/bdist.linux-armv7l/egg/pyaudio.py", line 750, in open
        stream = Stream(self, *args, **kwargs)
      File "build/bdist.linux-armv7l/egg/pyaudio.py", line 441, in __init__
        self._stream = pa.open(**arguments)
    IOError: [Errno -9998] Invalid number of channels
    
    INFO: ngram_search_fwdtree.c(432): TOTAL fwdtree 0.00 CPU nan xRT
    INFO: ngram_search_fwdtree.c(435): TOTAL fwdtree 0.00 wall nan xRT
    INFO: ngram_search_fwdflat.c(176): TOTAL fwdflat 0.00 CPU nan xRT
    INFO: ngram_search_fwdflat.c(179): TOTAL fwdflat 0.00 wall nan xRT
    INFO: ngram_search.c(303): TOTAL bestpath 0.00 CPU nan xRT
    INFO: ngram_search.c(306): TOTAL bestpath 0.00 wall nan xRT
    
     
    • Nickolay V. Shmyrev

      You need to configure alsa properly first, then start playing with pocketsphinx.

       
  • Agathe Blaise

    Agathe Blaise - 2016-03-14

    It didn't work on my Raspberry Pi, but on my laptop, when I'm launching my program with a stream related to the third micro like this :

    stream = p.open(format=pyaudio.paInt16, channels=1, rate=16000, input=True, frames_per_buffer=1024, input_device_index = 3

    I obtain these errors, which said that the number of channel (1 here) is incorrect.

    Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1514
    Expression 'ValidateParameters( inputParameters, hostApi, StreamDirection_In )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2818
    Exception in thread Thread-1:
    Traceback (most recent call last):
      File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
        self.run()
      File "testMic.py", line 51, in run
        stream = p.open(format=pyaudio.paInt16, channels=1, rate=16000, input=True, frames_per_buffer=1024, input_device_index = int(self.device))
      File "/usr/lib/python2.7/dist-packages/pyaudio.py", line 747, in open
        stream = Stream(self, *args, **kwargs)
      File "/usr/lib/python2.7/dist-packages/pyaudio.py", line 442, in __init__
        self._stream = pa.open(**arguments)
    IOError: [Errno Invalid number of channels] -9998
    
     
    • Nickolay V. Shmyrev

      I don't think that index 3 is valid in your system, most likely you have different card layout. To get help on this issue you need to provide the alsa configuration. You can dump it with

            arecord -l
      

      you can also try to record from command line to make sure things work:

          arecord -D <device_name> -f S24_LE -c 1 -r 16000 test.wav
      
       
  • Agathe Blaise

    Agathe Blaise - 2016-03-14

    The result of arecord -l is :

    **** List of CAPTURE Hardware Devices ****
    card 1: PCH [HDA Intel PCH], device 0: 92HD91BXX Analog [92HD91BXX Analog]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 3: Device [USB Video Device], device 0: USB Audio [USB Audio]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    

    So I'm launching arecord -D plughw;3,0, but index_option_device requires an integer.

     
  • Agathe Blaise

    Agathe Blaise - 2016-03-14

    The result of arecord -l is :

    **** List of CAPTURE Hardware Devices ****
    card 1: PCH [HDA Intel PCH], device 0: 92HD91BXX Analog [92HD91BXX Analog]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    card 3: Device [USB Video Device], device 0: USB Audio [USB Audio]
      Subdevices: 1/1
      Subdevice #0: subdevice #0
    

    So I'm launching arecord -D plughw;3,0, but index_option_device requires an integer.

     
    • Nickolay V. Shmyrev

      I guess you need to try other values of index like 1 or 2, don't you think so.

       
  • Agathe Blaise

    Agathe Blaise - 2016-03-14

    Yes, of course I already tried index between 0 and 3 but none of these work. I think the channel is the problem.

     
    • Nickolay V. Shmyrev

      Try with two channels?

       
  • Agathe Blaise

    Agathe Blaise - 2016-03-14

    With this piece of code found on https://doc.ubuntu-fr.org/pocketsphinx, I succeeded to list all the input devices index like this :

    PortAudio System Info:
    ======================
    Version: 1899
    Version Text: PortAudio V19-devel (built Feb 25 2014 21:09:53)
    Number of Host APIs: 2
    Number of Devices  : 6
    
    Host APIs:
    ==========
    index: 0
    name: ALSA
    defaultOutputDevice: 5
    type: 8
    deviceCount: 6
    defaultInputDevice: 5
    structVersion: 1
    --------------------------
    index: 1
    name: OSS
    defaultOutputDevice: -1
    type: 7
    deviceCount: 0
    defaultInputDevice: -1
    structVersion: 1
    --------------------------
    
    Devices:
    ========
        defaultSampleRate: 44100.0
        defaultLowOutputLatency: 0.00580498866213
        defaultLowInputLatency: -1.0
        maxInputChannels: 0
        structVersion: 2
        hostApi: 0 (ALSA)
        index: 0
        defaultHighOutputLatency: 0.0348299319728
        maxOutputChannels: 8
        name: HDA Intel HDMI: 0 (hw:0,3)
        defaultHighInputLatency: -1.0
        Output rates: [32000.0, 44100.0, 48000.0, 88200.0, 96000.0, 192000.0]
    

    Here the index was 5.
    Thanks you very much for your help, I'm very grateful to you.

     

Log in to post a comment.