[APP][4.1+] Spirit2: Real FM Radio for AOSP & root

What name would you prefer for this new FM app ?

  • Spirit2

    Votes: 441 81.4%
  • a2d.fm

    Votes: 23 4.2%
  • a2d

    Votes: 1 0.2%
  • A2D FM

    Votes: 51 9.4%
  • A2D

    Votes: 8 1.5%
  • Other: Please post

    Votes: 29 5.4%

  • Total voters
    542
Status
Not open for further replies.
Search This thread

Optimissimus99

Senior Member
Feb 21, 2014
362
122
Is it possible to support p880 on Spirit2? Because I don't know if its digital or not... If its it would be very nice to see it, because Spirit2 looks great! :)
 

sbcontt

Senior Member
Dec 3, 2011
211
36
Device Sony Xperia Z C6603, OS CM11 with Meow Kernel Linaro with Fidelity Z soundmod. Tried Spirit2 first, heard only static, no sound. Now using Spirit1. Sound quality is excellent, especially considering the fact that the transmitters are 30+ Kms away. This is my first mobile with reception as good as Philips FM sets, and without Mike I would have been left out of it.
 
Last edited:

mervluk

Senior Member
Jan 30, 2013
272
79
Device Sony Xperia Z C6603, OS CM11 with Meow Kernel Linaro with Fidelity Z soundmod. Tried Spirit2 first, heard only static, no sound.... reception as good as Philips FM sets, and without Mike I would have been left out of it.

I too occasionally get static only on Spirit2 on Sony Xperia Z. Always cured either by trying again after swopping to Spirit1 momentarily or a reboot though. Or may be force close Spirit2, then retry. Otherwise agree about sound quality which seems improved by PXA (though full version as I'm on stock) , and is as good on Spirit2. Spirit a saviour as latest PXA lost stock fm!
 
Last edited:

mikereidis

Inactive Recognized Developer
Jan 28, 2011
7,823
4,146
Ottawa/Gatineau, Canada
I have a LG G2 D802 and use the latest Mahdi Rom with 4.4 Source and Spirit2 not work.

I was trying to load the latest Mahdi on my G2 when I ended up in another awful bootloop, again. :(

I haven't had time to fix the G2 yet.

My guess is that Mahdi kernel doesn't have FM chip and/or FM friendly audio drivers anymore.

Besides stock kernels, the only FM friendly G2 kernels I've ever seen were the CM kernels.

And I can't guarantee that CM won't drop the kernel FM support either.

If someone can find a kernel dev willing to consider some work to restore FM friendliness, I'd be happy to try and help.

AFAICT, there's some "really cool stuff" in those FM unfriendly kernels, so I dunno if that's an obstacle.
 

Schrotty35

Senior Member
Oct 30, 2010
4,407
616
Vienna
I was trying to load the latest Mahdi on my G2 when I ended up in another awful bootloop, again. :(

I haven't had time to fix the G2 yet.

My guess is that Mahdi kernel doesn't have FM chip and/or FM friendly audio drivers anymore.

Besides stock kernels, the only FM friendly G2 kernels I've ever seen were the CM kernels.

And I can't guarantee that CM won't drop the kernel FM support either.

If someone can find a kernel dev willing to consider some work to restore FM friendliness, I'd be happy to try and help.

AFAICT, there's some "really cool stuff" in those FM unfriendly kernels, so I dunno if that's an obstacle.

You need the rom + patch for you device and kk baseband and thene boot fine.
 
  • Like
Reactions: mikereidis

mikereidis

Inactive Recognized Developer
Jan 28, 2011
7,823
4,146
Ottawa/Gatineau, Canada
You need the rom + patch for you device and kk baseband and thene boot fine.

Yeah, I was bitten by the patch issue twice before so I was extra careful to apply LS980 patch before reboot.

Maybe I got bit by the baseband.

I DID flash LS980_KKMODEM_AOSP.zip before flashing the ROM, but someone on the Mahdi thread said I should have flashed KK_Baseband_LS980.zip, which I have as a afile now (not flashed yet).

After flashing LS980_KKMODEM_AOSP.zip the CM Settings-> About showed "Unknown" for the baseband, so I'd guess it didn't work quite right.

Oh, well, it's an opportunity to try KK stock I guess.

Every phone has it's "magic tricks" and there's always a question of how much reading, checking and worrying I need to do for stock, stock derived and sometimes AOSP ROM updates.

Anyone who thinks I can just buy a phone and spend a few hours with it to support it is mistaken. EVERY well supported phone requires at least dozens of hours from me every year, and that's assuming I don't have to spend any time fixing Spirit for new Android versions. Ten phones means hundreds of hours, bare minimum; in reality, to fix new problems with new Android versions and ROMs, a thousand hours per year at least.

This "fragmentation" thing is a huge factor for hardware dependent "apps"* such as Spirit.

*"Apps": with all the low level stuff, it's hard to call Spirit just an "app". It's also a lot of kernel and HAL type driver code, and that's where most of the work is.
 
Last edited:

tanoxxx

Senior Member
Feb 10, 2010
1,731
427
Florence
@mikereidis
Hi,
very great app, buyed it ;):good::good:
i have only one issue volume cant chenge :(
i have LG G2 with Carbon Rom, i know it is a know issue, but how i can workaround?
i tryed to control the volume from "Viper4Android Fx" app, but nothing, the volume dont change :(
Please can help me? how i can controll the volume?
thanks


Edit:
i noted if i not put the jack the volume change, but when i plug in the jack the volume dont change again :(
do you know how fix or workaround it?
Usually i use phone speaker for listen music.

One question, how i can make automatic scan?


Edit2:
Now im on Mahdi-Rom and Spirit and Spirit2 dont work :(
Any fix? or Help?
 
Last edited:

mikereidis

Inactive Recognized Developer
Jan 28, 2011
7,823
4,146
Ottawa/Gatineau, Canada
Stock Android 4.4.3 seems to be compatible in general with both Spirit1 and Spirit2 :)

i ran both on my Nexus 7 2013 flo, and they seemed to work as needed, though the N7s are not, and are never expected to be fm capable.

The anticipated root app problems have not arisen, at least for now.


Of course OEM and device specific issues can still aruse, Eg the SELinix/Knox on GT-N7100 w/ stock 4.4.2 prevents either Spirit from working/ (I hope/expect to fix this.)
 

tanoxxx

Senior Member
Feb 10, 2010
1,731
427
Florence
Last edited:
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 64
    Spirit2 is the successor to Spirit1 Unlocked and is the "Best Darn FM app"* in existence ! :)

    I'm closing this thread again in favor of the general Spirit1/Spirit2 thread: http://xdaforums.com/showthread.php?t=1059296&page=868#post57106533

    It's too confusing trying to figure out where to post what.

    I will update first 10 posts of this thread as documentation when I can.

    Spirit2 Beta releases on Play for customers, updated sign up info: http://xdaforums.com/showpost.php?p=57079402&postcount=795

    Android ONE = Google FM Radio ?? !! http://xdaforums.com/showpost.php?p=53677209&postcount=781

    Spirit2:
    Hi Mike, I am still enjoying Spirit 1, is there any reason to pay again for Spirit 2? : http://xdaforums.com/showpost.php?p=52304934&postcount=647

    HTC One M8 Verizon ! :) http://xdaforums.com/showthread.php?p=51904184

    Spirit2 is a real, tuned, over-the-air FM radio app for Android. It does not require Internet access.

    Requires AOSP !: If you don't know what AOSP means, Spirit2 is not for you. Spirit1 Unlocked works on numerous stock phones: http://xdaforums.com/showthread.php?t=1059296

    *"Best darn FM app": Yes, it has some bugs, and some device support issues, and may lack some of the "polish" of many stock FM apps, but it's the most functional and even the current RC1 has more settings than stock apps.

    The ONLY FM app supporting ALL this: Equalizer, Effects, Recording, BT A2DP and Visualizer.

    Spirit2 also supports multiple "remote" displays and controls: Home and lock-screen widget, lock-screen, notification shade, BT AVRCP and future Android remotes. AVRCP puts RDS and station info on the display of compatible BT headsets, and controls Pause/Play and preset selection. Was pretty cool the first time I saw that working. ;)


    Install Spirit2 RC2, March 26 Google Play: https://play.google.com/store/apps/details?id=fm.a2d.s2

    Spirit2 Beta group. Latest releases for Play customers: https://play.google.com/apps/testing/fm.a2d.s2


    March 25 New Info:


    "Upgrades" from Spirit1:


    If you've been happily using Spirit1 Unlocked for at least 3-6 months, please consider Spirit2 as a second purchase, for a next generation FM app. Help me give Spirit2 the 3+ year lifespan that Spirit1 has had so far. My income is still at the lowest end of "tolerable". Support me and I can support you.

    The price is a bit higher than Spirit1 Unlocked. It will be dropped a bit on the 1st day of each month.

    At Release Candidate #1 all known major bugs have been addressed. Please understand: software always has bugs, new ROMs can require new code and improvements are ongoing.

    Thanks ! :)
    Mike.
    13
    Spirit2 "Official Support"*: ONLY these phones running "Compatible AOSP"** ROMs:

    • Samsung GS3 GT-I9300
    • Samsung GS2 GT-I9100
    • Samsung GS1 GT-I9000
    • Samsung Note2 GT-N7100
    • Samsung Note1 GT-N7000
    • HTC One (GPE requires BT off)
    • HTC OneXL LTE, OneS, Evo 4G LTE (2013 CM11 only. 2014 kernels broke FM)
    • LG G2 D802 International and Sprint LS980 only. (Some stock, CM11 and Mahdi ROMs only as of March, 2014)
    • Motorola Moto G
    *"Official Support" means I own the phone and I can properly support it.


    **"Compatible AOSP" ROMs includes as many AOSP ROMs as I can reasonably support, that have the FM and audio kernel drivers needed to enable FM. CM11 is the most popular and best supported, except for the incompatible 2014 kernels for HTC OneXL LTE, OneS, and Evo 4G LTE. LG G2 is only supportable on CM11 and Mahdi ROMs as of March, 2014.


    Unofficial Support:

    The only other devices with a chance of working fully are those with Qualcomm WCN3660 or newer compatible FM/BT/WiFi chips as well as Qualcomm WDC9310 or newer compatible audio chips. This includes most late 2012+ Sony devices starting with Xperia T. These may or may not work well, and are not officially supported. With sufficient demand I will consider buying a "Z" device and officially supporting some Sony's.


    Stock ROMs:

    Spirit2 also works reasonably well on many stock or stock derived ROMs when rooted. But there are often problems, such as FM over BT issues on Samsung stock ROMs. Most of my customers are on AOSP/CM ROMs.

    Stock FM apps are available on stock ROMs, and few stock ROM users support Spirit financially, so I focus on AOSP. The Death of access to stock, unrooted OEM proprietary FM APIs has sharpened that focus: http://xdaforums.com/showthread.php?p=50954346


    Support for New Devices:

    Support for new devices will be considered IF all of these are true:

    • FM is possible. GS4, Note3 (except Sprint) and GS5 are not possible for anyone to ever support. See GS5: http://xdaforums.com/showpost.php?p=50600906&postcount=7541
    • Digital FM Audio is possible, the Spirit way. Most higher end 2013+ phones are capable, as well as some lower end, such as Moto G.
    • Popular among AOSP ROM users. Galaxy S and 5 inch Note class flagships are the vast majority of Spirit2 and current Spirit1 Unlocked sales.
    • Higher end ; Inexpensive phones are great, but most apps are sold on high end devices.
    • I need to be convinced that the costs of purchasing this phone, PLUS the much greater costs of supporting it will result in at least a liveable wage. Just learning how to and flashing various ROMs can add up to hundreds of hours. Add fixing soft-bricks, learning the HW & SW, investigating, reverse-engineering, coding, and doing ongoing updates, fixes, workarounds and support and you get a glimpse of why Spirit2 support is limited to a handful of the most popular devices.
    • Ideally, the non-International North American variants support FM, at least in hardware. LG G2 and all Samsungs are a great disappointment here.

    Every day I get MANY Spirit1 Unlocked debug logs in my email from pirates. Most of them come from less expensive devices, especially Mediatek devices from Huawei, ZTE, and much lesser known companies.

    I have little interest in supporting phones that might earn me $100 if I got lucky, and would drown my email with even more pirate debug logs.
    10
    Usage:

    Power control:

    • Status: Center of shiny frequency dial power icon is blue if on or grey if off.
    • Toggle: Tap center of shiny frequency dial where blue (if on) or grey (if off) power icon is.
    • On: Tap Play button at lower right or in widget.
    • Off: Tap square Stop button at lower left, in widget or in notification shade.
    • Auto on: Start app to automatically turn on FM.
    • Auto off: Start another music app and FM will automatically turn off.
    Tuning:

    • Dial: Big shiny frequency dial displays and can be used to set frequency.
    • Blue Digital: Tap numbers to manually enter frequency.
    • Seek: Previous and Next buttons to left and right of Blue Digital display seek down or up to next strong station. Same for widget, notification shade, lock-screen and other remote controls, but ONLY when there are less than 2 presets programmed.
    • -/+: Left and right buttons below seek buttons tune down or up to next valid channel, depending on Band setting.
    • Presets: There are 16 presets at bottom. Press or long press a "+" to set or reset the current frequency as a preset. RDS names are now supported.
    • Preset -/+: When 2 or more presets are programmed, they can be navigated with the Previous and Next buttons for the widget, notification shade, lock-screen and other remote controls. With 0-1 presets, these are seek controls.
    Mute/Unmute:

    • Status: Pause/Play button at lower right, in widget or in notification shade shows expected result of tapping it. Eg shows Pause if currently playing.
    • Toggle: Tap Pause/Play button to pause or play audio.
    Volume:

    • Status/Change: Tap speaker button at top right or use hardware or headset media buttons to display and change Music stream volume.
    Record:

    • Status: Red button at top left is brighter when recording.
    • Toggle: Tap red button to change recording state. Files at /sdcard/Music/fm.
    Equalizer:

    • AOSP compatible equalizers, such as CM DSP Manager, can be accessed in ROM Audio settings, or with the Spirit2 on app "Menu" key (not the old style phone Menu keys). This key has 3 horizontal lines and is at low center between Stop and Pause/Play.
    Settings:

    • Some settings are accessible by swiping from right to left to access a window to the right of the main window.
    • UI Visual: To replace the frequency dial with a waveform and spectrum analysis visualizer.
    • Band: Use "USA" in North America or "EU+" everywhere else.
    • Tuner Stereo: Stereo 2 channel when checked or Mono when unchecked.
    • Tuner AF: Alternate Frequency switching enabled when checked.
    • Audio Stereo: Distinct from Tuner Stereo and can lower CPU load and recording size.
    • Audio Speaker: Experimental Speaker mode works on some phones but may have volume control issues.


    Notes:

    • Other settings: none at this time.
    • Debug log sending is experimental.
    • Remote display and controls: for lock-screen, notification shade, widget, wired headset media buttons and remote controls and info display via BT AVRCP.
    • Speaker output experimental. Workaround: remove wired headset plug enough to switch to speaker, but still inserted enough for a good antenna connection.
    6
    About "Digital Audio":

    History:

    Before 2013, most FM radio audio on Android phones was "mostly analog"*. FM audio bypassed the digital audio chain and was injected in the final stages, after the final D->A conversions.

    FM audio was a special path that did not follow the same rules as every other source of audio on Android. Hundreds if times I've heard "... but it works fine with music players etc." and I explained how FM is different. Fm audio usually can not be equalized or modified with effects. It usually can not be recorded, visualized, or routed to BT headsets.


    AOSP Difficulties:

    Besides lacking these digital audio features, "non-digital"** FM audio is difficult to do on AOSP ROMs. AOSP usually does not use the stock audio libraries that contain support for FM. This has been a never ending source of grief and work for me; I spend at least 50% of my development time on audio issues as a result.

    Basically, Spirit will use SU/root low level functions to set up the audio hardware for FM, via kernel device driver commands for ALSA or earlier APIs. But the ROM audio library has no idea that FM is running. This can often result in conflicts that break audio, especially during audio notifications. On some popular older devices, such as HTC Desire HD, I had to create a hack that resets the entire audio system when FM is turned off. And users just have to live with the fact that audio notifications break audio, at least until FM is turned off or the device is rebooted.

    There were many other problems, including a need to continuously loop a silent audio file, to convince the audio libraries that music was playing. Otherwise, volume control was lost, among other things.

    This was rarely a problem on CM7 ROMs that included a CM FM app, because the audio libraries supported FM. But most CM9 ICS and later ROMs dropped support for FM. I considered making code contributions to CM and other ROMs to fix this problem the proper way, in the audio libraries. But I concluded this would take all of my time, may create personal conflicts and might never cover the majority of ROMs anyway.


    *"Mostly" analog: Surprisingly, just about every FM chip does internal signal processing digitally, after the initial A->D conversions, Frustratingly, virtually every 2012- phone did not use digital outputs, where they existed, but converted the Digital left and right audio back to analog.

    "Non-digital"**: I do not use this term to strictly mean "Analog". I use it to mean a method to enable FM audio that stock OEM FM apps use, and that Spirit1 uses, when not using one of the "Digital..." Audio-> Method settings. At the chip level, the audio may be digital, as is the case when using Qualcomm FM/combo chips with Qualcomm WCD9310 or compatible audio chips.


    Spirit's Digital Audio Solution:

    A digital solution to most of these problems was envisioned in late 2012, and resulted in the 1st prototype alpha releases of Spirit2 in early 2013. Spirit2 was digital only and this proved to be a much easier way to do FM audio, with few problems. When it became clear how much more work was needed to complete Spirit2, and given that Spirit1 continued to sell well enough to live, digital audio was "back ported" to Spirit1.

    Here's how it works: Instead of just sending a few commands to the audio drivers, Digital audio mode sends different commands to enable digital, then continuously reads the ALSA PCM channel. All audio data read is then written to the Android Audiotrack API, the same as most streaming apps do. A streaming app reads from the network; but Spirit reads from the FM/audio chip.

    The main disadvantage of this digital audio method is higher CPU and battery consumption. OTOH, "non-digital" audio on most AOSP ROMs required a constantly looping silent audio file anyway, so the difference is minimized.

    Another digital disadvantage is that some devices can experience brief audio drop-outs. This does not affect Samsung devices. Full and partial workarounds include modifying CPU frequency or kernel scheduler. Tuning and investigative work is ongoing.

    There are also challenges for speaker mode. The current support is experimental and does not work on all devices. But the current code is much cleaner and much more robust than Spirit1 non-digital audio, which can have issues during phone call interruptions. Volume control can also be unusual over speaker. The reason for these problems is that Android is designed to switch to speaker only when the wired headset is unplugged. But FM is unique: the wired headset is used for the antenna. A workaround for motion-less devices: remove the wired headset plug just enough to switch to speaker, but not enough to lose the antenna affect.

    But the advantages of this form of digital audio are HUGE, IMO. They have allowed me to provide all the audio features people had been asking for: recording, equalization, effects, A2DP BT headset and visualizers.

    AND it allowed me to minimize the MANY FM specific audio problems with much smaller, better designed and better written code, with a minimum of special cases. The Spirit1 audio (and other) code is a huge mess and can never be re-written IMO.

    Audio dropouts on non-Samsung devices made me consider non-digital audio methods in Spirit2, despite the work and complications that would create. But a variety of fixes and re-tuning has improved audio, workarounds have been identified and work is ongoing.

    The advantages of digital only are too great IMO to "pollute" Spirit2 code with non-digital audio. I've even removed previous non-official support for stock Sony devices in order to concentrate on digital audio that is as flawless as possible.


    Drop-out Workarounds:

    Samsung devices only rarely have audio drop-outs. I've only seen this on the oldest, now "vintage" original Galaxy S GT-I9000, and only when recording, at the same time that the equalizer, effects and the visualizer are all running. The old single core CPU gets close enough to it's processing limit that very occasional ticks may be heard, but the recording is usually fine.

    LG G2 and Moto G are working pretty well now. The worst affected are the HTC One and the HTC OneXL/S/Evo 4G LTE, or other Qualcomm FM+audio devices. Further tuning and investigation is ongoing, but these things can minimize the problem:

    • Don't record.
    • Turn screen off.
    • Disable visualizers or any other app or service that might be using CPU resources.
    • Disable equalizer or other audio effects. Bass-boost and EQ alone don't seem too bad.
    • Raise CPU minimum and/or maximum frequency (Only if you understand the risks of CPU burnout.)
    • Change CPU scheduler: Performance risks CPU failure; Interactive or Pegasusq may be better.
    6
    Troubleshooting:

    Does not start:

    • SU/root missing is the most common problem. Ensure Spirit has permission enabled in the SuperUser or SuperSU app, or with the ROM Super* settings.
    • Omni & many other ROMs require manually flashing SuperSU. After flashing, run SuperSU and respond Yes when prompted to allow SU reflash after ROM updates.
    • If your device is not officially supported, it will likely not work. Except for devices with both recent Qualcomm FM and Qualcomm audio, phone architectures for FM are very different from each other.
    Stops playing or hangs:

    • Workaround: Force stop or reboot. Fixes are ongoing.
    Audio Stops at Homescreen:

    • Disable Google Now Launcher: Homescreen Long Press-> Settings-> Voice-> "OK Google" hotword detection-> Off.
    Audio Dropouts:

    Odd frequencies only:

    • Set Band to "EU+" after swiping from right to left to reveal right side settings. Default is "EU+" unless ROM identifies location as North America.
    Where are recordings ?:

    • See /sdcard/Music/fm for WAV files named with parseable start time. Compression to MP3 files will be considered in future. Maximum of 4 GB results in 5-10 hour maximum time, depending on sample rate (22-48 K depending on phone).
    Speaker does not work:

    • Experimental at present. Workaround: remove wired headset plug enough to switch to speaker, but still inserted enough for a good antenna connection.
    Speaker volume control broken:

    • Experimental at present. Turn Screen off or use on app volume.
    Phone call problems:

    • Avoid speaker mode
    • Avoid removing or inserting wired headset while FM or phone call is active.
    Other: