EDIT:
If you are new to my app, you can now install the latest version from the Android Market:
https://market.android.com/details?id=com.mikersmicros.fm
Since the initial release of v2.0.2 many bugs have been fixed and now RDS data is supported on both TI and Broadcom chips as of v2.0.9.
I hope to get this app working on phones with Silicon Labs FM chips as well, and stock or stock based ROMs, but there are challenges..
Skip to the end of this thread for latest info.
-----------------------
Version 2.0.2 of the "Spirit FM Radio" :
https://docs.google.com/uc?id=0B7UP...Tk2YTMtNGM3ZmFjNjgyZjZl&export=download&hl=en
This is NOT a streaming app. It's for "REAL" tuned radio, usually from 88-108 MHz or so. Like the MIUI and CM FM apps, it is derived from the Code Aurora FM app. I believe I've made more extensive mods than the MIUI or CM apps though.
Spirit FM Radio is in beta testing now. Don't expect a flawless, polished app. If I waited for all bugs to be squashed, this app would never be released.
The app has support for starting and stopping audio when a phone call is initiated or answered. I've done almost no testing on this feature at this time however, and it does not appear fully functional. So please don't expect proper co-operation between phone and FM audio until this is fixed.
Spirit requires Android version 2.1 or greater. On unsupported phones it should go into an emulator mode to allow the UI to be explored. For trouble-shooting, "adb logcat" can be useful. Root/superuser privileges are not required, but there is still one place in the audio routing code that attempts to run a "su" command to chmod /dev/msm_snd. This is only needed on older CM ROMs that do not have an FM radio app. Otherwise, you can configure SuperUser to deny the privilege.
The app has RDS data support on TI FM chip based phones, and hopefully I will be able to add RDS support for Broadcom based devices soon.
At this time it's most likely to work on CyanogenMod 7 on devices/phones on which the CM FM app works. It may also work on MIUI ROMs that support a MIUI FM app. I intend to get this app working on as many devices and ROMs as is feasible. Please feel free to "vote" on what I should prioritise, as far as device or ROM support, bug fixes or new features.
I also have it working on the HTC Legend using the Blayo ROM, and it may work on the stock ROM for HTC TI FM chip based phones such as Legend or Click/Tattoo. This requires the use of a "btipsd_cli_ binary. Under some circumstances, the btipsd daemon may crash. Slower devices, or those which are using a lot of CPU due to other apps/daemons etc. may have timing issues.
Other than the btipsd_cli method explained above, Spirit requires a working "hcitool" executable to control and retrieve data from the radio. The CM7 and MIUI apps use the same method for FM radio access. Spirit is also able to read data from the radio. I think the CM7 app does not have this capability (certainly not for TI chips).
To verify hcitool compatability, turn on Bluetooth and from a terminal emulator type "hcitool cmd 4 1", or from a USB connected PC with adb, enter the following and see if the results roughly match mine. This command gets the Bluetooth etc. versions. The last line should have 12 bytes, perhaps some will be different for you:
adb shell hcitool cmd 4 1
< HCI Command: ogf 0x04, ocf 0x0001, plen 0
> HCI Event: 0x0e plen 12
01 01 10 00 04 00 00 04 0D 00 1F 1D
The following should be able to confirm support for a Broadcom based FM chip. Eg. HTC Desire etc. The seventh and last byte should be 0, or 1 if running an FM app, or 2 if RDS is also being used.
a hcitool cmd 3f 15 0 1 1
< HCI Command: ogf 0x3f, ocf 0x0015, plen 3
00 01 01
> HCI Event: 0x0e plen 7
01 15 FC 00 00 01 00
The following should be able to confirm support for a TI based FM chip. Eg. HTC Legend or Click/Tattoo. The fourth and last byte should be 0. If running an FM app at this time, the radio will stop:
adb shell hcitool cmd 3f 137 1 1
< HCI Command: ogf 0x3f, ocf 0x0137, plen 2
01 01
> HCI Event: 0x0e plen 4
01 37 FD 00
The app supports somewhat different layouts for portrait and landscape. This has been tested at the resolutions:
- 240x320 For HTC Click/Tattoo on emulator).
- 320x480 HTC Legend.
- 480x800 HTC Desire HD
At this time, when switching orientation, the audio will always switch to the analog headset, which can be annoying if you are using the speaker.
Unlike many other FM apps, the app does not enforce the insertion of a headset wire as an antenna. On my Legend I can pick up strong stations without an antenna. On my Desire HD, even moderately strong stations come in without antenna. For best audio and RDS the antenna is recommended.
TI FM chip support has been tested extensively on my HTC Legend and is relatively mature, providing features such as RSSI, seeking, RDS program ID, program type, program service and radio text.
Broadcom FM chip support has been added just recently and is tested on my HTC Desire HD. It supports RSSI and seeking, although the seeking is somewhat broken at this time.
On recent CM7 ROMs, the app and the CM audio framework will "fight" a bit over volume levels. You will likely hear louder volume briefly when adjusting volume using the hardware volume buttons.
Only analog speaker and headphones are supported for audio outputs. The app has some experimental support for recording but it's unlikely to work on any phone at present.
The user interface has 3 "Blocks":
- Station Info. At top in portrait or top right in landscape.
- Presets. Middle in portrait or bottom in landscape.
- Mute/Power. Bottom in portrait or top left in landscape.
"Mute / Power" are simple on / off toggles. Power should automatically be enabled at app
startup. Bluetooth should be enabled automatically if not already enabled, but it's best to pre-enable it manually.
"Station Info" controls frequency via direct entry or left/right buttons. Tap frequency to enter manually. Frequency 102.1 MHz can be entered as "102.1" (with decimal) or "1021" or even "10210". Outside the US, NTSC channel 6 audio can be received (with lower volume) at "8775".
Tap the left or right arrows to move up or down one channel. Channels are 0.2 MHz apart in North America, and may be different elsewhere. The settings menu allows entering country/region to set things such as this increment. North America is default.
Long press the left or right arrows to seek to the next strong channel. This is working well for TI chips, but the Broadcom support for this is mostly broken at present.
"Station Info" also shows such info as RSSI, stereo/mono signal, and the 4 types of RDS data supported at present.
Presets: The app supports unlimited presets and multiple preset lists. The top or left button should display "LIST-1". Tap to select a list, or add a new list. Long press to rename or delete the list.
Pressing a preset button showing a frequency tunes to that frequency. To create a preset, tune to the desired frequency and long press any unused preset button. If there is a preset for that button already, you can select "Tune", "Replace", "Rename" or "Delete".
Once 5 presets are set, the right arrow will be enabled which allows moving to the next "page" of 5 presets.
On my Desire HD the app seems to automatically switch between speaker and headphones when plugging/unplugging the headphone jack. This does not work on my Legend.
The standard android phone "Menu" button provides access to "Settings", an "Enable/Disable Speaker" button which switches between speaker and headphones, and a "Sleep" function. The "Scan" button is not currently functional. The recording buttons may produce a file on the SD card (or may cause a crash!) but the file is unlikely to contain any FM audio.
The "Settings" menu allows changing region, which should change frequency limits, channel spacing, odd/even frequencies, pre-emphasis and RDS/RBDS switching as appropriate. Audio output mode can switch between stereo and audio. Alternate frequency is not yet functional. Factory Defaults should return the config to original.
At this time, the app sends hcitool output to a "fm1" file, on the /sdcard if available, otherwise in the app private cache directory. I will likely remove this requirement to write regularly to the file-system at some point.
This more or less completes my intro to the Spirit FM Radio app. This post will be regularly edited to contain the latest info.