Android 6 audio input/output on the Neo

Discussion in 'UDOO NEO' started by frudman, Oct 17, 2016.

  1. frudman

    frudman Member

    Joined:
    Apr 15, 2014
    Messages:
    64
    Likes Received:
    14
    We've been working with the Quad for a while and audio input/output is simple via the connectors on the board (and direct Android support through the api, no need to go through Arduino).

    We're very interested in switching over to the Neo because of its smaller form factor (a big plus for a small enclosure we're working with) but I can't find any information about how to read/write audio streams (or what hardware connectors we'd use).

    Does anyone have any ideas how to go about this? I2C? S/PDIF? (presumably via arduino?)

    Two more possibilities would be to use the audio-output part of the hdmi connector (we're using the 7" lvds screen so the hdmi "port" is available, or the audio part of it) but not sure how to "wire" this (including the software stack starting with android's api). Also, that would only solve the ouput part not the input/microphone.

    We also considered a USB-to-audio type setup. This could work and USB-audio is builtin Android starting with Lollipop. This seems most promising especially since Marshmallow (6.0) is now (or soon to be) on the Neo. A cheap $4 dongle would give us the microphone/speaker ports we'd need. Also the cleanest fastest solution, if that works. We're now leaning in that direction.

    Does anyone have any experience with this? Both opinions or recommendations welcome.

    Thanks in advance.
    Freddy.
     
    Last edited: Oct 17, 2016
  2. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Sorry, I have experience but not with Android.
    With Linux I have chosen for the USB stick. Be sure that you select a compatible one. Not all sticks are Linux/Android compatible.

    The HDMI way can only be done with very little adapters as the powersupply of the hdmi port of the Neo is normally to small to power the conversion circuit. You have to add an extra 5V power supply.
     
  3. frudman

    frudman Member

    Joined:
    Apr 15, 2014
    Messages:
    64
    Likes Received:
    14
    yes, I'm putting the hdmi solution on hold for now and focusing on the USB stick instead as it seems simplest and most promising.

    Do you happen to know which model stick you used (even if for Linux)?

    I ask because a linux-compatible stick might also work with Android since the Android drivers are Linux-based.

    Let me know. Thanks.
    Freddy.
     
  4. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
  5. frudman

    frudman Member

    Joined:
    Apr 15, 2014
    Messages:
    64
    Likes Received:
    14
    Wow, Fast Reply! Thank You for that!
    Great, I'll get that one (and a few others) to test with my just-delivered Neos. I'll report back here which ones (if any) work with Android (currently about to load 6.0.1-beta-1).
    Freddy.

    ps: for future readers, link of product suggested was http://www.ebay.co.uk/itm/282005728213
    ps2: I'm also considering:
    1) https://www.amazon.com/Adapter-Comp...able-products/dp/B00VWLITB8/ref=pd_day0_147_4
    2) https://www.amazon.com/Turtle-Beach-Advantage-Headset-Adapter/dp/B0036VO4XO/ref=pd_sim_147_2
    3) https://www.adafruit.com/products/1475
    4) https://www.walmart.com/ip/Manhattan-150859-Hi-Speed-USB-3D-Sound-Adapter/20612338
     
    Last edited: Oct 18, 2016
    waltervl likes this.
  6. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Good hunting :)
     
  7. jas-mx

    jas-mx Active Member

    Joined:
    Dec 31, 2013
    Messages:
    407
    Likes Received:
    118
    I added support to the kernel for an external audio DAC Sabre ES9023 (I2S) for Neo, see this commit. If you can get it working this will free up the usb port.
     
  8. frudman

    frudman Member

    Joined:
    Apr 15, 2014
    Messages:
    64
    Likes Received:
    14
    Nice work! That's likely to be very useful to us down the road so we can go direct into the board and bypass the USB port (albeit, also via arduino).

    For now, however, I already ordered a few USB-based sound cards (as per my earlier prev msg) to see if we can get this running quickly and accessible directly through Android (i.e. usb audio streams, now built-in lollipop/5 and marshmallow/6) and able to skip over i2s (which is [or seems to be] non-trivial from the Android side: would need to pass audio streams in/out of arduino side, I think, which complicates the app's architecture).

    I'll report back here on viability of those usb cards/dongles.
    Freddy.
     
    Andrea Rovai likes this.
  9. frudman

    frudman Member

    Joined:
    Apr 15, 2014
    Messages:
    64
    Likes Received:
    14
    OK, I've done some work on this and have partially good news to report:
    1. I've tried a few different usb-card setups and many were able to properly output audio from Android (list below)
    2. Unfortunately, none of these were able to work with the microphone side yet (i.e. Neo Android image 6.0.1 beta-1)
    The list of usb-cards I tried that work are as follows:

    Some notes:
    • as per earlier, all cards/dongles above worked for audio out: none worked with the microphone for audio in: Android kept throwing an error (internal application error)
    • I've included a link of where I purchased each just as fyi in case someone wants to do more thorough testing (mine was NOT rigourous at all!)
    • on all of these I've tried connecting the cards to both the plain usb port as well as the otg port to make sure there weren't issues with one or the other: results were same for all
    • there is a difference between usb and usb-on-the-go (host vs. client setup) and there are difference in the pins for usb-otg. All of the above were tested with otg-adapters which MAY not capture the device as required for Android. I don't know and I wasn't able to get a usb-card that was explicitly otg. It might be possible that such a card could work for the microphone but the ones I had (with adapters) did not.
     
    waltervl likes this.
  10. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    @frudman: A-M-A-Z-I-N-G, thank you so much!
     
  11. frudman

    frudman Member

    Joined:
    Apr 15, 2014
    Messages:
    64
    Likes Received:
    14
    You're welcome!
     
  12. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Just for the record: I just tested my USB audio stick with a microphone on Udoobuntu2.1 and it works so it seems something in Android.
    (Philips U108 with the C-Media CM108 chip, It shows up in lsusb as 0d8c:000c C-Media Electronics, Inc. Audio Adapter)
     
    Andrea Rovai likes this.
  13. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    Thanks for sharing your tests @waltervl!
     
  14. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    @Andrea Rovai Yeah, Yeah, Yeah. One thank you is already enough :)
     
    Andrea Rovai likes this.
  15. frudman

    frudman Member

    Joined:
    Apr 15, 2014
    Messages:
    64
    Likes Received:
    14
    Any progress on this? We really need to be able to record/listen through the microphone.

    Alternatively, is there a way to do this programmatically directly via the linux layer? Maybe I can try that instead?

    Any ideas of why audio out is working but not audio in (in Android)?
     
  16. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    Any progress on this under Android.
    Under Linux you can use a USB stick.
     
  17. frudman

    frudman Member

    Joined:
    Apr 15, 2014
    Messages:
    64
    Likes Received:
    14
    How do we go about this? I'd like to create an incoming stream for the microphone. Something like a tty but for binary data. And would it require sudo privileges? If I can "read" this continuous stream, perhaps I can find a way to pass it on to the Android's stream-based methods. (I'm thinking something like a /dev/nul type device but instead of "nul" it's a stream that can actually be read, maybe? not sure if that's possible)
     
  18. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
  19. waltervl

    waltervl UDOOer

    Joined:
    Dec 12, 2015
    Messages:
    2,314
    Likes Received:
    580
    Does that work in Android? Documentation only shows Audio Out no Audio In. Is audio in supported in i2s?
     
  20. Andrea Rovai

    Andrea Rovai Well-Known Member

    Joined:
    Oct 27, 2014
    Messages:
    1,703
    Likes Received:
    240
    That doesn't work in Android and only Audio out is supported.
     
  21. frudman

    frudman Member

    Joined:
    Apr 15, 2014
    Messages:
    64
    Likes Received:
    14
    We have no problem with audio OUT from Android going through usb-audio-cards (and the basic Android APIs). The problem is for audio IN (i.e. the microphone). That's also built-in to Android (i.e. many APIs deal with that) but for some reason these fail when running on the Neo. Even the basic Recorder app on the Neo fails to start (with the very helpful "Internal Error" message).

    I wasn't sure how to go about moving audio streams in/out through the Arduino anyway but if the i2s solution above is only for audio out, that doesn't help us any since we already have that part working.

    We're doing some voice control apps that require some access to the microphone, not so much for actually recording, but in order to use Android's Speech API (which of course needs an input stream).

    So at the most basic level, we need to be able to "capture" an audio stream from the usb-card. Since this is a supported feature in Android's code base, I suspect that there's a driver issue for that part of the hardware.

    I'm not sure how to proceed forward at this point...

    ps: Looking at the documentation for I2S, I don't see where it says that audio IN is not supported. Am I missing something?

    ps2: What would be the "/device" to use to send audio stream (or maybe even read for audio in) to get it to play out? Also, do you have a recommended arduino card (or other attachment) to actually play the sounds?
     
    Last edited: Nov 28, 2016

Share This Page