How to connect speakers for Android Things without HDMI - raspberry-pi

I have an android app that outputs sound normally on a phone. I also put it into an android device and can hear audio on tv through HDMI cable. I also have an android things app that moves a servo and can put audio on the tv, also working as expected.
What I can't do is get audio from the audio jack, which would be my preferred option since I want something without a display.
I have lots of logcat entries saying everything is normal and sound is not failing, but other than that I can't rule out if it's an OS capability that's turned off (there's no mention in release notes), something that needs to be tuned into config.txt, whether I need extra lines of code, or it is muted.
I'm assuming audio is not getting to the jack at all. I know that the Raspberry pi 3 b audio jack also carries video, and I've tried to tap into every combination of its pins without success, both using a cable splitter and putting cables on the pins of the connector directly on the board. I'm also assuming that one of the exposed pins under the board carries audio only. Though I'd be grateful if someone could clarify which has left / right channel, even if tested on Raspbian or other OSs.
As seen in following logs, audio focus is ok and SoundPool.play never return 0 (as showin in line that says RESULT === 8):
02-04 02:08:28.617 694-1722/com.example.androidthings.simplepio I/SoundEngine: Ask for focus
02-04 02:08:28.653 408-822/system_process I/MediaFocusControl: AudioFocus requestAudioFocus() from uid/pid 10025/694 clientId=android.media.AudioManager#f4664becom.example.androidthings.simplepio.audio.SoundEngine$1#c9ef91f req=3 flags=0x0
02-04 02:08:28.654 694-1722/com.example.androidthings.simplepio I/SoundEngine: Ask for focus and GOT it
02-04 02:08:28.655 694-1722/com.example.androidthings.simplepio W/SoundEngine: ********* RESULT === 8
02-04 02:08:28.656 408-420/system_process I/MediaFocusControl: AudioFocus abandonAudioFocus() from uid/pid 10025/694 clientId=android.media.AudioManager#f4664becom.example.androidthings.simplepio.audio.SoundEngine$1#c9ef91f
02-04 02:08:28.656 694-1722/com.example.androidthings.simplepio I/SoundEngine: release focus

As pointed in the Raspberry Pi overlay documentation
2) The onboard analogue audio output uses both PWM channel
So you can't use PWM to drive a servo and play sounds thru the onboard Audio simultaneously.
A few options are possible:
try the USB audio support announced in Developer Preview 2
file a feature request to add support for I2S in the Peripheral IO API.

I had the same issue sending audio to AUX port while the HDMI port is connected just for video output.
But, the solution that worked for me is, I first deployed my AndroidThings app onto RasPi and connected AUX port to test the audio, then I connected the HDMI to test the video out. In this sequence, everything worked both audio from AUX port and Video from HDMI.

Related

Issue with freeswitch mod_Port audio in raspberry pi 4 (debian buster)

I have loaded mod_portaudio in freeswich. But after that when pa rescan the device, i found no device in the device list. While the pi is connected to a bluetooth speaker and also a headset with a aux cable and those are working fine in the system.
Can anyone please help me to sort out this issue.
Thanks
I am also working on this and shortly believed to have solved it (see https://lists.freeswitch.org/pipermail/freeswitch-users/2020-August/133883.html and https://lists.freeswitch.org/pipermail/freeswitch-users/2020-August/133884.html), but it wasn't true:
I was testing with my headset and had successful "pa looptest" indicating both indev & outdev were working
Then, when I tested that in the context of my application for auto-answering incoming calls (I called with my mobile phone while putting it in front of a tv so that I can test if I would hear anything on my headset), I didn't notice that in that case the mic was not working because I had the headset on my ears and was hearing the tv (because of success of looptest, I was just assuming that the mic would also be working)
But when I finally got a Plantronics Calisto 620-M Bluetooth Speakerphone, even the looptest failed. At this moment, I tested more carefully my headset again, and there I found out that the mic was not working.
Because it seemed that something device-specific should be the reason for failure, I also tested with my bluetooth earphones; there the effect was equivalent to Calisto speakerphone.
I finally got a USB speakerphone and tried that one, but in that case "pa rescan" failed to find any devices.
With all four devices, always arecord and aplay were working perfectly, and the above issues appeared only with mod_portaudio.
I don't have any idea what the issue could be with the usb, but with the three bluetooth devices, I still believe that something device-specific should be causing the problems here, e.g. the sample rate. But, currently I am lacking time to further work on this...

How to make Raspberry Pi to be a VoIP ATA Device

I want to make a VoIP ATA (Analog Telephone Adapter) Device using Raspberry Pi, furthermore, I also want to add FXS ports to the Raspberry Pi. Kindly, tell me whether it is possible or not. If Yes, then how?
Here is the
Reference Link
This is probably possible, but not with the Pi alone.
You will need to design and build some external circuitry to convert between telephone line audio (which apparently runs at 48 volts) and audio signals which the Pi can produce. Also it looks like the Pi has no audio input, so you might need to either add a USB audio device or use an analog to digital converter that the Pi has to read the audio signal coming in from the phone line, if it can be polled fast enough.
You might have better luck with a board that has a real microphone jack on it already, instead of the Pi.
Then on the software side you need to attach the audio out, whatever you are using to get audio in, and any circuitry you need to open/close the circuit or send special ring voltages to your VoIP software of choice. Working out how to write that driver code is going to depend heavily on what physical circuit you actually build and what VoIP software you want to have talk to it.
That link above has a design for a line-level audio to phone audio conversion circuit which may help you get started. You could also take the circuitry part of the project over to the Electrical Engineering StackExchange site.

Connect(control) Kodi Between Rooms?

Hello I am trying to work out how to set kodi up on my smart TV. My main problem lies with the TV being on the wall in another room too far away from power sources. She has sky installed and that was situated in the other room and with a HDMI lead fed under to floorboards to the other room by a professional someone or other. I am unable to feed another HDMI lead along the line.
Is there a way I could connect kodi by some other means to the TV? I am not really up on these things.
At the moment I have the kodi box in another room and I have to switch the sky lead to the kodi box to use. Also this means you have to be in the other room.
Can anyone suggest a way for me to get kodi working on the tv and be able to operate it via remote control?
I use Kodi on all of my TVs through an amazon fire stick. Most smart TVs have a USB on the back of the TV that can power the fire stick while its plugged into the HDMI so you wouldn't have to worry about power. I have a Sony bravia that will control the fire stick as long as I am on the input the fire stick is plugged into so no need for an additional remote.
To start off this is the wrong place to ask. This is a Q and A platform for programming questions and coding related questions.
To give you an answer though because I'm not a dick the best way to do it would be using a NAS. You would have two Kodi boxes but one media store.
I'm not sure which device do you use.
In my case, I installed Kodi on my Raspberry Pi(RPi) and TV and RPi are connected with HDMI. My TV is Samsung SmartTV, which supports HDMI-CEC. So, RPI can get RCU Key input from TV.
(HDMI-CEC allows devices connected to your TV through HDMI ports to communicate back and forth with your TV. )
In addition, you can customize keymaps for remotes in GUI by using the community Keymap Editor add-on.
https://kodi.wiki/view/Keymap
Check your TV supports HDMI-CEC, first.

Use Raspberry Pi like GoPro, Live Videostream over WiFi direct connection between Pi and Android

In the last weeks I experimented with my Raspberry Pi B and with the PiCamera. I had the idea to establish a connection between the RasPi and an Android device or (if it is easier) to a windows notebook without an access point in between, just like the GoPro camera and its App. I would like to have a live stream from the PiCamera to the other device and the possibility to start/stop recording a video or simply take a picture.
The app itself is not my problem, I wrote some simple apps before. But I didn't yet find a tutorial or description how to set up the communication and the stream.
I bought a WiFi dongle (Fritz!WLAN Stick N - by AVM) that supports WiFi direct and my phone (Samsung Galaxy S5 mini) does as well.
My first question is how to set up this stick on Raspbian - yet it is not recognises as a wifi dongle, and the second is how to achieve what I descriebed above.
Could anyone please describe what I can do?
Thanks in advance!
PS: I prefer a description for bash because I use SSH

iOS SDK Disable Internal Microphone

I am developing an iOS application that receives data through the auxiliary port (microphone).
We got oscilloscopes hooked up and are at the point where we can measure frequencies and amplitudes on a testing iPhone.
However, even with the auxiliary cable connected, the iPhone still listens to the internal microphone in addition to our external AUX input thus watering down our measurements.
The iPhone definitely recognizes the connected AUX cable (internal speakers are turned off).
Is there any way to programmatically disable the built-in microphone?
or
Is there some special signal we can send through the AUX port to disable the internal microphone?
After much research on this topic, there is no way to do it at this moment in time.
If you look at the Audio Session Programming Guide and the AVCaptureDevice Class Reference, all the properties relating to the devices input sources and audio routes are readonly.
If it's of any use, you can detect whether or not headphones or an external mic are plugged in. Here's a question relating to that.
I don't believe you can disable the built-in microphone without the user physically pressing the silent switch, but maybe you could store the data recorded by the built-in mic and then filter it out of the measurements taken by the oscilloscopes? I don't know how you would go about implementing this; it's just a theory.
Hope this helps!