Menu

iPhone question

Help
2009-11-24
2012-09-22
  • Jeremie Papon

    Jeremie Papon - 2009-11-24

    So after searching like crazy I can't find any useful information regarding
    Pocketsphinx and the iPhone. All I could find on these forums was a brief post
    by DHD from over a year ago that stated that PocketSphinx works on the iPhone.
    Basically I'm looking into whether it would be possible to put a version of an
    Urdu handwriting application I developed (using Sphinxtrain and Sphinx-4) onto
    the iPhone.
    Possible without TOO many headaches that is... I probably can't convince my
    boss to let me do it if there's no possibility of a basic prototype running
    within a month or two.

    My research did turn up
    (http://www.cactusvoice.com/), an
    apparently discontinued iPhone app which uses PocketSphinx. I emailed the
    author of course, but figured I'd put up a post here to see if anyone might be
    able to throw me a bone.

    Thanks for any advice!

     
  • Jeremie Papon

    Jeremie Papon - 2009-11-24

    So Antoine (Cactusvoice dev) says it wasn't too bad at all, just required some
    modifications to get pocketsphinx and sphinxbase to build in Xcode.

    I'll post again when I've got it building about what I had to do.

    That said, if anyone has done this already I'd appreciate any tips!

     
  • mindthief

    mindthief - 2010-02-04

    Hello,
    Was anyone able to get PocketSphinx running in xcode? If so, could you post
    the steps necessary to get it to work?
    Thanks!

     
  • Sean

    Sean - 2010-02-04

    You need to build Sphinx outside of xcode using configure. Have a look at the
    following page for tips and a script to help with that process:

    http://pseudogreen.org/blog/build_autoconfed_libs_for_iphone.html

    You will need to build the sphinxbase first, and then build pocketsphinx.

    Once you have built and installed them you then have to add the
    libsphinxbase.a and libpocketsphinx.a files to your xcode project.

    Finally, to get xcode to find the libraries and the headers during a build,
    you need to add paths to the "Header Search Paths" and "Library Search Paths"
    for your project. This is discussed in the link above ... for reference mine
    look like:

    Header Search Paths: $(HOME)/$(SDKROOT)/include/sphinxbase $(HOME)/$(SDKROOT)/sphinx/include/pocketsphinx
    
    
    
    
    Library Search Paths: $(HOME)/$(SDKROOT)/lib
    

    Hope that helps.

    Sean.

     
  • Nickolay V. Shmyrev

    We would be interested in importing xcode project into pocketsphinx/sphinxbase
    source. Corresponding headers could be put into separate locations like they
    are now for Win32. It's nice to support pocketsphinx on Mac so if someone
    could contribute the makefiles, that will be appreciated.

     
  • Antoine Raux

    Antoine Raux - 2010-02-09

    So I uploaded the XCode projects I used to build Sphinxnase and Pocketsphinx
    for my Cactus iPhone app at the following URL:

    http://www.mediafire.com/?sharekey=4fbb55a4bdc073f01bee9a6e9edd9c7691f90c4b22
    03ede26d217c73094ddc3b

    iphonesphinxbase.zip and iphonepocketsphinx.zip each contain the full thing,
    including all source files, as well as a text file explaining the changes I
    had to make in order to make it build on iPhone OS. From that you'll see that
    it was pretty quick and dirty but it worked... ;)

    Note that I haven't worked on any iPhone software for more than a year so
    nothing has been tested on iPhone OS 3.x but that should probably work.
    Basically, these projects can serve as a base for someone (else than me) to
    make official XCode projects for pocketsphinx/sphinxbase.

    Please not that I don't have any set up for development under Mac OS now (nor
    do I have any spare time) so don't expect me to support any of this. I'm just
    putting it out there since I don't have any time to work on Cactus, others
    might as well make the most of it. Also, I'm tired of having people emailing
    me directly to ask about this thing, now I'll have a place to point at. ;)

    If anyone does use these to make something useful, please post it on these
    forums. Same goes for any questions you might have.

    cheers,
    antoine

    As a bonus, I also include the iPhone version of flite, which I used to
    generate name pronunciations for Cactus (I have never tested the full
    synthesis, but the LTS worked).

     
  • Anonymous

    Anonymous - 2010-02-09

    Thanks for your help Antoine! Sorry to be the one to push you over the edge
    ;^)
    I took your lead and added .xcodeproject's to the sphinxbase / pocketsphinx
    projects a little more aligned with the project structure - although the unit
    tests aren't running against the xcode-compiled code. Once I get my project
    linking and something working I can post a patch. This doesn't have any of the
    LTS stuff either.

    XCode process is pretty simple:

    ./configure # This generate sphinx_config.h and config.h
    open sphinxbaseiphone.xcodeproj # This is an XCode project that will create libsphinxbaseiphone.a for linking in your iphone app
    

    I was hoping that I could get the unit test files to link to the object files
    from the xcode build, but the unit tests link against a .la which xcode does
    not build. I imagine this would be possible with a little bit of
    investigation.

    That's the easy part though! I guess I'll try passing off a sound in my iphone
    app to pocketsphinx and see if the gears turn. I have been stumbling trying to
    get pocketsphinx_continuous or pocketsphinx_batch working with data from my
    microphone. But I'll try passing off some of my sounds in my iphone app into
    pocketsphinx and see what happens. Any assistance on the mac toolchain (like
    an ad_darwin for example) would be great.

    You know if you wanted to release the source for cactus it would be a great
    reference point ;^)

    Brian King

     
  • Anonymous

    Anonymous - 2010-02-09

    2 more steps I found at link:

    1) Add the iconv framework to your project
    2) add the following ~ line 102

    #if defined(TARGET_OS_IPHONE)
    #define LOGMATH_INLINE static inline
    

    Thanks Again.

    Brian

     
  • mindthief

    mindthief - 2010-02-21

    btw thanks all, this was very helpful!

     
  • mindthief

    mindthief - 2010-03-08

    Hi all,
    I'm having some issues getting pocketsphinx to work properly for the iphone. I
    used the pocketsphinx lib files from anchan77, and the issues I'm having are
    reported here: https://sourceforge.net/projects/cmusphinx/forums/forum/5471/t
    opic/3581798/index/page/1

    If you have faced similar issues and could point me in the right direction,
    that would be greatly appreciated. Thanks!

     
  • mindthief

    mindthief - 2010-03-14

    Did anyone get the Flite Xcode project from anchan77 to work? I built it,
    included the Debug-iphonesimulator lib file (.a) in my Xcode project, and
    pointed the "Header Search paths" to the includes folder. Now I get the
    message "Cannot locate file cst_synth.c" when I do:

    audioLen = flite_text_to_speech(hyp, voice, "play");

    (or even "none" instead of "play"). I don't know why it should even be looking
    for a source file when the static library should be serving that purpose...
    any ideas?
    Thanks!

     
  • Anonymous

    Anonymous - 2010-04-05

    Hello, being a total newbie at audio/speech related code. Does anyone have any
    example code on just simple voice commands. I have a app for the iPhone which
    I want to add speech commands to. Literally like 3 or 4 commands. It sounds
    like pocketsphinx is what I want to use but I'm having a hard time getting
    started.

    Thanks!

     
  • Jeevan

    Jeevan - 2010-04-05

    joint the club! I also wanted to do the same thing!
    there is an example code you could use(http://cmusphinx.sourceforge.net/wiki/
    pocketsphinxmigration),

    but not sure about xcode! If you find anything, please do share...

    Thanks

     
  • Jeevan

    Jeevan - 2010-04-30

    This sample code works fine in xcode... I just added Audio Queuing to Record
    (Save audio file first) and pass it to PS for decoding... works fine... But
    bit slower in iPhone device!!!!

     
  • Jeevan

    Jeevan - 2010-05-13

    Okay, I've written something about how to get PocketSphinx working inside
    iPhone using pre-recorded audio and added my xcode project to be downloaded…
    My english is not in professional level, but I'm sure you can manage.

    download it at: http://www.rajeevan.co.uk/pocketsphinx_in_iphone/

     

Log in to post a comment.