yashsingh1/xdaforums huggingface dataset:
[Spirit FM] mikereidis:
Great ! Yeah, I hate the complications from HTC's DSPs and drivers. They've caused me major grief on Desire HD and all it's descendents using aic3254 .

On stock OneX, and the CM ROMs which I guess use stock audio libraries, this code enables FM to headset:

setDeviceConnectionState (0x2000, DEVICE_STATE_AVAILABLE, "");
setForceUse (FOR_MEDIA, FORCE_NONE);
setParameters ("FM_type=1");

The ALSA method via /dev/snd/controlC does this, where ssd_run() is my function for setting ALSA registers via the ssd utility:

ssd_run ("4 2 \"Pcm Playback Route\" 17 /dev/snd/controlC1"); // FM_Out_Headphone
ssd_run ("4 2 \"Pcm Capture Route\" 17 /dev/snd/controlC1"); // FM_In_Headphone
ssd_run ("4 2 \"Config AIC3008 DSP\" 20 /dev/snd/controlC1"); // Playback_FM

There are many large files under /system/etc/soundimage/ which I guess contain use cases and TONs of register settings for whatever Realtek or whatever audio chip/codec they're using.

I see the /system/etc/AIC3008_REG_DualMic.csv and AIC3008_REG_DualMic_XC.csv files is empty for FM (A17 & B17):

A17,FM_In_Headphone,SET,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,^M
,,REGISTER,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,^M
,,VALUE,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,^M
B17,FM_Out_Headphone,SET,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,^M
,,REGISTER,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,^M
,,VALUE,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,^M

But contain this for OFF, which I guess are DSP register settings:

A23,Uplink_Path_Off,SET,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,^M
,,REGISTER,0x00,0x7F,0x00,0x34,0x36,0x37,0x39,0x3B,0x3C,0x3D,0x00,0x51,0x52,0x53,0x54,0x00,0x33,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,^M
,,VALUE,0x00,0x00,0x01,0x00,0x00,0x00,0x00,0x80,0x80,0x00,0x00,0x00,0x88,0x00,0x00,0x01,0x32,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,^M
B23,Downlink_Path_Off,SET,w,w,w,w,d,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,^M
,,REGISTER,0x00,0x7F,0x00,0x1B,0x00,0x1B,0x1F,0x20,0x1C,0x1D,0x24,0x25,0x2E,0x2F,0x28,0x29,0x2D,0x30,0x16,0x00,0x40,0x3F,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,^M
,,VALUE,0x00,0x00,0x01,0x30,0x05,0x00,0xB9,0xB9,0x7F,0xFF,0x7F,0x7F,0x7F,0x7F,0x39,0xB9,0x00,0x00,0x00,0x00,0x0C,0x00,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,^M

So perhaps the DSP FM mode just bypasses the DSP, as it did for aic3254 ?

Would be nice to have a schematic.

I can try to baksmali the HTC FM app for OneX+ to get further info on enabling FM audio on stock libraries. I haven't done this for any phone for months now. Just getting the stock library FM audio enable code is often just a small part of supporting audio on a new device.

I presume the code for the HTC audio libraries is secret as usual. Would be nice to have a schematic, but HTC sadly doesn't let them out, unlike Samsung.
[Spirit FM] Slovenec:
Re: [APP] Spirit FM: Broadcom,Texas Instruments,Samsung Silicon Labs & Qualcomm FM ch

Thanks but it wasnt a question. :)
[Spirit FM] Alucard:
Here is the FMRadio3.apk from v30c p970 rom,dont if this helps to make spirit fm work.

---------->https://anonfiles.com/file/ad8eee10bce7cb1199a4419ed004aa5e
[Spirit FM] todonormal:
Thanks

Thank you very much. Testing in Andromadous 10.1 for HTC Vision
[Spirit FM] aini12aian:
Hope someday you can make this available in the Philippines! :)

I tried using the free version but I can't get any radio station. :(

I really want to buy the app but I want to make sure first that it is really working!

Thanks for making this by the way! and Keep up the good work! :good:
[Spirit FM] mikereidis:
It has nothing to do with your country, it's about your phone and ROM or rooted status.

If it doesn't work automatically, it likely can't work.
[Spirit FM] ManicStreetPreacher:
Hi everyone, and thanks for the app! I tried to look a bit through the thread, but I haven't seen my issue. I have a HTC One X running a CM 10.1 rom (before that used AOSP 4.2) and the same issue showed up, I open the app, it works perfectly, but the volume is stuck to max and neither hardware keys or software keys cannot change it. I have Spirit FM Unlocked. Thanks in advance for your answer.
[Spirit FM] Lagkage:
I have some problems with audio notifications and digital audio.

Setting audio focus to auto, enable and enable+pause return results in the following:

Incoming SMS or Facebook notification>Spirit pauses and notification play>Spirit needs manual pause/play.

Setting audio focus to disable results in the following:

Incoming SMS>Both Spirit and notification play>Spirit continues playing.

Incoming Facebook notification>Spirit pauses and notification play>Spirit starts playing automatically.

I don't understand why it act like this with facebook notifications.

I have only tested SMS and facebook notifications. I have an I9100 with CM 10.1.

Beside this i really like your app:)
[Spirit FM] mikereidis:
Paid customers are welcome to contact me by email and don't really need to search the thread. But if it's not urgent, I prefer posts here for the benefit of all.

Hmmm, this max volume issue hasn't been reported by others I think, and I haven't seen it on either of my OneX's running CM10.1.

Was it working on the previous AOSP ROM ?

Please send me a debug log with Menu-> Email Logs. After 20 seconds press Send. or manually send the /sdcard/sprt_debug.txt file .

Sending a log is the first thing to do for unusual problems.
[Spirit FM] mikereidis:
I looked at the decompiled Smali code for HTC's OneX+ and found what it uses to enable/switch FM audio on stock ROMs.

On the original OneX/S/V series HTC uses an "android.intent.action.FM" Intent.

On OneX+ they changed to a "com.htc.intent.action.FM" Intent.

Next release of Spirit changes the last Debug-> HTC setting from "Intent" to "Intent1 (One)". The new setting is "Intent2 (OneX+)". As before, the Auto default runs all (now 4) the HTC audio "sub-methods".

This is only applicable on stock ROM (rooted or not) or stock ROM derived HTC devices. These have Audio-> Method automatically set to "HTC".

So I'd guess this isn't THE low level solution we need. Next component to study is whatever receives the "com.htc.intent.action.FM" Intent, but could just poke through the audio libraries too.
[Spirit FM] mikereidis:
I was scratching my head, then realized you said "digital audio".

Digital audio is experimental and will stay so for some time, even in Spirit2.

Spirit2 is finally my primary focus now, and I have a usable prototype now, though I'm still fixing bugs in Spirit1.

BUT... I appreciate all the details and will poke around that area next chance I get. If there's a simple solution, I'll do it. Clearly, there must be some differences between SMS and Facebook notifications though.
[Spirit FM] mikereidis:
Still fixing bugs in Spirit1: :)

I've found at least one source of mysterious SU requests when Spirit wasn't running.

This happens on Unlocked only if Spirit has NOT been run since phone boot. It may happen on the other versions at any time; haven't looked closely enough yet.

It's due to the media button receiver being called, even when Spirit has never run, and perhaps even on the versions, such as Free, which don't support media buttons.

Next release should be within a few days and have a fix.
[Spirit FM] mikereidis:
Email:

Hi, Thanks for your upgrade. :) I can cancel the old Light order if you wish.

1 - Menu-> Test-> Settings Import and Export can do this. There hasn't really been a demand for this feature though, and most people have few presets or settings to move. I made this automatic at one point but it caused problems and due to lack of demand I disabled that. Why have something buggy when nobody asks for it ? And why spend time fixing it ? I concentrate on features people ask for.

2 - I've tried to make all settings automatic, but there are MANY HUNDREDS of Spirit supportable phones out there with many ROMs and the unique combinations of phones & ROMs reach into the 10's - 100's of thousands IMO. Not to mention even the many versions of ROMs, stock or not. Now we're talking millions of combos ! :)

What phone and ROM do you have and can you send me a debug log with Menu-> Email Logs. I'll try to make it automatic. Sometimes though, the many hundreds to almost a thousand lines of code used to detect phones and ROMs for settings makes it easy to break settings for hundreds to thousands of customers when I add a "simple" addition for a new phone/ROM combination.

3 - I'm afraid I haven't put too much effort into making the UI-> Antenna settings robust. Very few people use this feature, and again, I concentrate on the most popular requests.

4 - See UI-> Notification Text Color for white or black. I made this a setting because it seemed impossible to always detect which color scheme was used for notifications. This is Android fragmentation at work; a downside of so much choice.

Regards,

Mike.
[Spirit FM] mikereidis:
Thanks for the log.

I saw this problem on the aosp 4.2 from Pabx, but I didn't see it on CM.

There's a "feedback loop" between Spirit and Android volume controls that always pushes volume back to max. None of the 3 related debug settings helped, in at least 4 combinations.

Here's what I thought would be a workaround, but may be the best answer going forward, as ROMs become more AOSP and less using stock audio libraries:

- Enable Debug-> Silent Loop.

- Change Audio->Method setting to the recently added (with a purpose now !) "HTC OneX/X+ Int ALSA". It's the one between two others named somewhat similarly, LOL.

- Restart Spirit.

In my limited testing so far, it seems to work OK. I may make this the default soon if no problems are reported.

EDIT: My investigation startlingly indicates some nasty Nvidia code captures the TI FM chip volume command, turns it into maximum volume and feeds that back in.

So I think the "... ALSA" audio method is the way forward. Jan 25 release thankfully doesn't need Silent Loop and also works on speaker.

It works OK on CM10.1 so I've made it default for Jan 25.
[Spirit FM] mikereidis:
versionCode: 200

versionName: Jan25

Updated on Play, fresh for the weekend.

Free: http://d-h.st/24M

Miscellaneous fixes and adjustments. Hopefully good enough for at least another week, LOL.
[Spirit FM] dreccon:
Re: [APP] Spirit FM: Broadcom,Texas Instruments,Samsung Silicon Labs & Qualcomm FM ch

Hi, I'm new in this thread! I have an LG Optimus 3d (p920). I used to have LG FM radio working but, out of curiosity, I had tried Spirit and it worked as well. The problem is that after I upgraded to CM10, LG FM radio doesn't work anymore and neither does Spirit. Is there anything I can do to help fix it? A logcat perhaps?

Sent from my 3D Jellybean phone
[Spirit FM] electronic13:
Dear mikereidis, maybe it can implement sound Xperias 2011, as I understand it is the source of the team FREE XPERIA, I'm not good programming so this is my guess! This radio is on the last builds cyanogenmod and works fine, but do not like functional.

github.com/freexperia/vendor_ti_fmradio
[Spirit FM] mikereidis:
No, sorry, the FM audio secrets remain uncovered.
[Spirit FM] mikereidis:
That's based on code Sony open sourced.

I checked it when it was released and it has no value to me.

The audio secrets are not revealed in this code.
[Spirit FM] dreccon:
Re: [APP] Spirit FM: Broadcom,Texas Instruments,Samsung Silicon Labs & Qualcomm FM ch

No, no. You got me all wrong! I'm not asking for any secrets! I just asked if I can send you some kind of info that might help you get the app working on LG P920 with CM10! I'm not a dev but if I can be of some help, I'd be glad!

Any chance to see this working?

Sent from my 3D Jellybean phone
[Spirit FM] Shangalisto:
This application does not work at all on the ZTE Skate with ICS & JB (reboots) :s
[Spirit FM] mikereidis:
I don't think there's much chance.

The secrets are those held by LG and their chip suppliers. Pretty much all the phone and chip OEMs keep their documents and HAL library source code secret. That's a major reason why we don't see many FM apps, and why custom ROMs are very difficult to build with working camera etc.
[Spirit FM] mikereidis:
When I support ZTE & Huawei devices, the result is a lot of work for me, a few sales that pay for a small fraction of the work, and hundreds-thousands of debug logs from non-customers in China.

So... I don't support such devices.
[Spirit FM] karolp1993:
Hi! Someone is interested Broadcom BCM4330 in ZTE Grand X In ? Spirit FM found a few station, RDS info is ok too, but no sound :( When I switched audio mode to Samsung Broadcom or ZTE Blade 2 i've heard in headphones sounds like knocking, one, twice, and then, phone is very slow. Maybe working FM radio on Grand X In is possible?

I'm using Android ICS 4.0.4 and custom rom Next v2.
[Spirit FM] mikereidis:
The post above yours explains why I'm not too interested in ZTE to start with.

The IN device is Intel and my low level code doesn't support Intel. Spirit must be using the Broadcom (or other ?) proprietary FM API in order to work, like the Razr I.

Is there no stock FM app ? Finding one may be your best bet, as long as the ROM supports the Broadcom BT stack and perhaps stock audio libraries.
[Spirit FM] Lagkage:
http://review.cyanogenmod.org/#/q/owner:Jerpelea+status:open,n,z

I just noticed this. Would it be to any help?
[Spirit FM] Giogts:
what setting for huawei u8150 on cm9.1?

with automatic setting dont work.

thanks
[Spirit FM] karolp1993:
No, there is no stock FM app. Grand X In in Poland doesn't have FM at all. Doesn't have 16GB memory and NFC antenna too. I wrote about radio because RDS working, so maybe little work and sound could too. I wish that you support zte not, maybe in the future someone found the solve. Thanks for reply ! ;)
[Spirit FM] mikereidis:
Thanks for posting this ! :)

Yes, it could end up being a lot of help, as well as "competition" Spirit hasn't seen since CM7.

It looks like CM might be supporting the "STE" ST-Ericsson/ Sony-Ericsson "Proposed Android FM API" in an experimental branch of AOSP, and/or perhaps some Qualcomm stuff.

The "Proposed Android FM API" is what Spirit2 is based on, so hopefully, eventually CM will build in the support I need. This could enable new devices to be supported by Spirit2, improve the handling of audio, and allow me to spend more time on added features.

I have a more or less working prototype of Spirit 2 now. I may have to release it soon if I want to claim some firsts, LOL. If I release it, and perhaps some or all of it's source code, I'd like to think it would be useful to advance the "cause" of FM.

I'd also be happy if this resolved the Galaxy S breaking speakers, or at least if it gave me someone else to blame it on, LOL. I recently went through the 300+ pages of the WM8994 data-sheet to see if some DC servo mis-config was happening, but found no such thing, and the servo applied only to headset. And the hundred+ WM8994 registers seemed virtually no different in the dangerous versus stock FM modes.

Anyway, I'll have more thoughts after I go through the CM code.

EDIT: For the most part so far, this is Jerpelea / FXP pulling in the experimental AOSP FM code, for the Free Xperia branches of CM at least. As of a few days ago, I heard he had an app running, with RDS, on Xperia Sola on his CM, but with no audio yet. Same spot that Spirit is in; audio on stock but not custom ROM.

Regardless, this is good news. When FXP CM can support FM on Xperia's, then Spirit can too, and users will have the choice of at least 2 apps, with perhaps more to come. And with this in a branch of CM it has a better chance to be adopted on other devices, such as Samsungs.

With my Spirit2 prototype, I've seen it's relatively easy to build an FM app when built on top of this framework, assuming someone has built the plugins etc. needed and audio handling somewhere. I've built one plugin now, for Samsung GS/GS2/GS3 etc., and can also use Sony's plugins for CG2900 and WCD3660 FM/combo chips.
[Spirit FM] mikereidis:
The fact that the Broadcom FM API is there indicates there may be some variants, or partially different phones (perhaps in future) with FM. So eventually, you may find a compatible FM app in a ZTE device.

FM Audio SEEMS like a simple problem. "Just send FM audio to headset", right ?

But FM Audio is the problem I spend most of my time on. MOST ! To be clear, over 50% of my work is on FM related audio issues.

Even if I find the "tricks" to enable audio there are dozens of different scenarios where audio problems will happen, and it can take a hundred hours or more of work to make it as close to flawless as I can.

If I don't have the exact phone in question, this can become virtually impossible.

And then at least 3 of the 10 people who might support me will report problems with the FM API.
[Spirit FM] mikereidis:
u8150 has lots of problems and there is no chance that Spirit will be able to support it properly.
[Spirit FM] LLStarks:
Any chance of US GS3 support now that FM support for the 8660+4330 and 8960+4334 is being cooked up by Code Aurora and the CM team?
[Spirit FM] cajunflavoredbob:
Mike, I'm not asking for a fix here. I'm just asking out of curiosity. Is there any reason why different devices would get different reception given that the headphone wire and station are the same?

I was playing with the UL app on a Sensation 4G, G2, HD2, and Defy XT. The Defy gets awful reception on a certain local station where the other three get perfect reception. The inverse is true of a different station where two get great reception and two do not.

I've switched over to using my old G2 as my dedicated FM radio, since it has pretty good audio output on CM10 and gets all my stations clearly.

I should also note that the headphone jack is plugged into a splitter. One line goes to a 1 meter 3.5mm stereo audio cable to my desk speakers. The other side of the splitter has a 3.5mm antenna plugged into it.

The G2 seems to be the only one getting perfect reception considering the mass amount of wire feeding the entire antenna system here. lol

Also, I've been testing Spirit on the Defy for a while now. Other than this one thing, which is likely just an issue on my end, the app is rock solid. I'm writing up a review on it tonight for the other Defy users on the Republic Wireless forum. Is there anything special that I should note about it? I'm assuming the Lite and Unlimited versions will both pick up the Defy XT right away as long as root is gained, right? Just making sure that the changes to UL got merged into Lite as well.
[Spirit FM] usdy:
On fivehundredtwentysix pages, I'm not really sure if the issue has been brought up already before, so my apoligizes in that matter.

I've got a HTC One X from India and can't get speakers running. There's a bunch of debug settings, I've already done all under HTC. But now I'm stuck.

The ROM is a Revolution HD 18.1, so it's basically stock (more or less).

Always when starting Spirit FM, an app called "Beats Audio" is sitting in my notification area. Now everytime I change a setting in Spirit FM, before stopping playback, I have to toggle "Beats Audio". Then pausing and relaunching Spirit FM will bring back sound in my earphones. But no speaker at all.

Can one help?

Thanks! Tom
[Spirit FM] LLStarks:
If I enable Iris for the CM10.1 kernel for the US GS3 and then load it, is there any chance of reception even though the antenna isn't hooked up?
[Spirit FM] mikereidis:
Where can I find info/discussion on this cooking ?

I've been convinced for a long time that US GS/GS2/GS3/Note/Note2 are not capable of FM due to the FM/combo chip FM antenna pin being grounded, or at least connected nowhere useful.

If I was wrong about that, I would be ecstatic ; I get multiple emails every day from people with these devices who are eager for FM. So many that I recently added notices near or at the top of my Play descriptions and what's new sections. People can't see Spirit from their phones, but they see it on the web Play and are hoping that "Google is wrong" about the incompatibility.

But sadly, I think I'm correct about no FM. Perhaps the "cooking" is for other devices.

OTOH, there could be some magic antenna switch somewhere that carriers like Sprint will enable when the FM broadcasters pay them their ransom.
[Spirit FM] mikereidis:
Most older Motorola devices use a TI FM/combo chip, such as WL1273, while most older HTC devices use a Broadcom FM/combo chip, such as BCM4325. The Broadcom chips are more sensitive/better. and that's one reason why Broadcom chips are so much more popular than TI.

Do you recall the same bad reception on the Defy XT with the stock FM app ? If not there's some slim possibility that firmware could be an issue. Also consider that there may be aging issues with headset jacks and cables and capacitors and other electronic components. Nearby lightning strikes and power surges may damage some components. I'm seeing more and more FM chips that just refuse to pick up a signal, with no pattern of particular devices.

Newer (and some older) chips are much better: BCM4330/4334, Silicon Labs si470x on Samsung high end, Qualcomm WCN3660.

My old compat list here: http://xdaforums.com/showthread.php?p=34028503

Says:

This is in reference to custom ICS & JB ROMs.

I appreciate any kind of reviews etc., but I don't think it would be too good to promote something to Defy XT557 owners that won't work on the latest custom ROMs.

EDIT: Is there a newer Defy XT ?
[Spirit FM] mikereidis:
I tried to load Revolution HD 18 on my OneX International the other day, but gave up because my HBOOT is an ancient 0.4.3 and I didn't want to go through the whole process. HTCs are a major pain, with no S-OFF compared to Samsungs...

Best bet is to set Audio-> Method to "HTC" and try the different settings for Debug-> HTC. Start with "Intent1" and "Intent2.

I presume the HTC app works on speaker.
[Spirit FM] mikereidis:
There is no Qualcomm FM/combo chip on the US GS3. It's the only device I've seen that doesn't pair Qualcomm WCN3660 with the Qualcomm S4 SOC.

It uses a Broadcom BCM4334, which seems to have no usable FM antenna connection. See http://xdaforums.com/showthread.php?t=1887750
[Spirit FM] cajunflavoredbob:
Well that makes a bit more sense. Thanks for the explanation. The Defy's stock FM app does have the same issue, so it's obviously not the Spirit app.

The Defy XT that I have does not have custom ROMs, nor will it ever due to the Republic Wireless WiFi calling feature. It's built into the Gingerbread firmware, so there's no chance of a custom ROM, since the whole cellular company is built around doing most of your activity over WiFi. I believe the Defy in the quote is one of the other carrier's models. This is the one that you and I were trouble shooting a month or two ago. Other than that one issue where the spirit app unpauses when there's a system sound, it works perfectly.
[Spirit FM] LLStarks:
Mike, if I felt so inclined, how would I enable the module for the crippled FM part of the 4334?
[Spirit FM] :
Re: [APP] Spirit FM: Broadcom,Texas Instruments,Samsung Silicon Labs & Qualcomm FM ch

January 2013 is leaving. are we gonna see spirit 2 soon?
[Spirit FM] black_bottom:
weak radio reception

spirit lite, HTC sensation with custom rom cyanogenmod10 Kang

comparing with HTC stock fm radio in ICS the radio reception of spirit fm significant weaker. I have much noise hearing a strong local city radiostation. the signal-meter is about 55 - 65. I set the the location to germany.

is there anything I can do to improve the signal? perhaps I do not use spirit in the right way. thanks a lot!