yashsingh1/xdaforums huggingface dataset:
[Spirit FM] Kess78:
Hi Mike,

Does the transmit function really works on the Xperia T? With sound also?

Thanks
[Spirit FM] CresCoJeff:
Are there any FM chipsets with public APIs?

Hi all,

I'm an FM radio enthusiast and fairly experienced Android developer, and after reading about Spirit FM I would very much like to try my hand at experimenting with true FM radio reception and tuning on Android devices (my development devices include a Samsung Nexus S, a Galaxy S 4, and a Nexus 7, but I can get more hardware if other devices/OEMs have proved to be easier to work with). My question is mostly for the OP, but anyone with experience please feel free to chime in: are there any FM chipset manufacturers (Broadcom, Qualcomm, etc.) who publish APIs for their FM chipsets? The OP mikereidis mentioned a great deal of reverse engineering work and often requiring root to get Spirit working; which chipsets (if any) don't require any reverse engineering (presumably due to well-documented public APIs)? Regarding root privileges, what determines whether or not root will be needed to access a device's FM chipset (assuming it has one)? Which device(s) are best for experimenting with FM on Android?

thanks!
[Spirit FM] Simonna:
Works quite good on my phone, only one issue that audio quality is quite bad on some radio stations but thanks for the app.:good:
[Spirit FM] mikereidis:
Debug logs are disabled now because I don't want any more.

Interesting. Usually the Internal Antenna pin is grounded. In this case it may be left open. So maybe it can transmit a few inches. I created a test binary for this at one point.
[Spirit FM] mikereidis:
Maybe. I sent someone a test utility once and never heard back.

No, no sound. That would be the hardest part, and likely at least as painful as reverse engineering the FM receive audio.

Same issue with some/European Xperia P/U/Sola/Go's. Spirit can be config'd to transmit on some of these, but my remote attempts at enabling audio for transmit didn't work.
[Spirit FM] mikereidis:
Probably not; there is some hardcoded stuff still that expects files in the usual place for a normal, non-system app.

You should not need to make it a system app.
[Spirit FM] mikereidis:
None of these are physically capable of OTA FM.

Qualcomm released source code for a sample FM app for their FM/combo chips a few years ago. That's their only "public documentation" and it may not be publicly posted anymore. The CM app and the original Spirit were both derived from this "Quicinc" app. As usual, this won't enable FM audio, which has been 50% of my work the last few years. Don't underestimate how hard it is to provide three functions: Mute, FM Speaker, and FM Headset. Every phone OEM does it differently, and often differently on different phones or "eras".

Texas Instruments has released various bits of source code, and Sony released their TI based FM app for 2011 and earlier devices. But TI is not popular and has been exiting mobile. This also doesn't provide audio enabling. And I think the Sony 2010-2011 devices require a system app to do FM. I've never been able to support these.

Sony is the best with their 2012+ devices. They support the "ST Ericsson proposed Android FM API" that Spirit2 is based on. This API didn't become an Android standard and only Sony uses it.

The documentation is about 3 years old now, and the sample FM app and underlying code is maybe "only" 1.5-2 years old now.

But the audio part of the spec is only supported on 2012 devices. Sony's 2013 devices use new APIs.

-----

I've started looking at Spirit2 again. I think it will have a public API (basically the Sony API, at one level), so people could write their own apps.

Stock devices don't need root, if one of the OEM Proprietary APIs that Spirit supports exists and works on the device. Spirit supports just about every high level OEM Prop API except Mediatek's.

So usually there needs to be a stock FM app on the device for Spirit to work without root. There are a few exceptions, such as later Motorola's and ATT OneX LTE, which have the API but no app.

Sometimes a device, such as V4L /dev/radio0 or /dev/tifm or Samsung /dev/fmradio, will have open permissions. That allows Spirit to use the lower level API without root.

The biggest usage of root is on AOSP based ROMs which don't support FM APIs. But those ROMs mean you have root already.

Also, root is required for some features, like better RDS, or no antenna operation, or digital audio for BT, recording, EQ and visualization.
[Spirit FM] CarlettoGas:
Hello Mike!

Can you add the Samsung Galaxy S 4 Mini LTE GT-I9195 to the compatibility list when you update it, please?

It seems working, it gets the station and the RDS about it but there's no audio output..

Thanks!
[Spirit FM] mikereidis:
If there is no audio, then it's not working.

If it's not working, I can't add it to the compatibility list.
[Spirit FM] rienkandroid:
Hi Mike,

Can't say your took a real brake there :rolleyes:, looking forward to Spirit nr2. If that means no upgrading to an updated rom, so be it.

For me this is the best app in the play store. You should consider to make a separate thread for Spirit2 to draw attention away from this thread.
[Spirit FM] GSR1611:
Is the Galaxy NOTE 8 , GT-N5100 supported?

Thanks
[Spirit FM] mikereidis:
Hi, yes.

Early this year some people would post and I'd have to ask "Spirit1 or Spirit2 ?".

Separate threads should be easier.

Here's hoping I future-proofed Spirit to some extent, by resolving 4.3 issues before my break, and hopefully Kit-Kat will change little in the Bluetooth area, or other things that impact FM.

And hopefully, the new "CyanogenMod Inc" won't mess around with FM either. I'm pretty sure over 50% of my customers are on CM or CM derived ROMs. They could really mess me up if FM drivers were removed from Samsung and Qualcomm device kernels.

I'm having a nice break from coding, though I'll still peek at the code a bit due to some questions.

Just finished my 2009 tax returns and hope to have 2010 done within 1 week.

I effectively have 6 returns to do for each year:

Personal Federal

Personal Provincial

Business Federal

Business Provincial

Wife's Federal

Wife's Provincial

But they mostly owe us refunds, so late filing isn't a big deal. And having a business can REALLY save on taxes, which are high here due to social programs and somewhat socialized medicine. My car is 100% business and 22% of my home expenses are business, and there's not a cellphone/tablet (among 22) or computer part in the house that isn't a business expense either.

I'm thankful for using tax software now though. Wasn't long ago I still used the old methods.

But this province of Quebec is VERY different than every other province in Canada. And for business (but not personal), they can refuse to speak to me in English (since I CHOSE to have a business here) and many forms are not translated.
[Spirit FM] mikereidis:
If it's not in post #2, then it's not supported.

And it's easy to search this thread for more info.
[Spirit FM] xmguy:
Cool.

Sent from my (Verizon) Samsung Galaxy S4 using the XDA app!
[Spirit FM] hnadov:
Is there a chance for my LG L3?

I installed it already, didnt work :( (can track but no sound)
[Spirit FM] mikereidis:
The E400 released in early 2012 ?

If nobody has found a way to enable FM audio using Spirit in over 1.5 years, it's very unlikely to be figured out now.

Tell me what FM chip and audio chip it has and I might be able to say a little more.
[Spirit FM] ashleylai87:
Hi, first time user of spiritfm free.

I am currently using Samsung S2 I9100G with Cyanogenmod 10.2.

I noticed even though the volume (using spiritfm in speaker mode) has been turned to max, it still sounds too weak.

When I was using official stock roms radio apps in speaker mode, the volume in speaker mode is impressive.

Any suggestion on how to increase the volume even further in spiritfm? :confused:
[Spirit FM] mikereidis:
No.

Unfortunately the 9100G is very different than GT-I9100 and other popular Samsung devices (except for Galaxy Nexus with no FM.)

I've never been able to support the G variant well on non-stock ROMs.

Somebody who has this phone would have to investigate. I don't have one and don't expect to get one.
[Spirit FM] CresCoJeff:
HTC One radio driver

Hi Mike,

I borrowed an HTC One from a friend to experiment with (unrooted, Sprint, has a stock FM tuner app) and created a small FM chipset testing app that merely tries to open the radio driver. The trouble arose when I was setting a DEFAULT_RADIO_DEVICE macro; I did dome digging on the filesystem (couldn't get far due to lack of root) and found two immediate areas of interest: the directory /dev/radio and the character device /dev/radio_feedback, both of which are only accessible by members of the group 'radio'. Lacking root I couldn't look inside /dev/radio and when I tried to execute and fcntl open(...) command on the radio_feedback device, stderr unsurprisingly received 'Permission Denied'. Do you know how to access the FM chipset driver on an HTC One (location of a single device driver would be nice, but I doubt it is that simple), and is it possible to do so without root privileges?

thanks!
[Spirit FM] mikereidis:
I don't see any /dev/radio on my One. If it exists, it's not for FM, nor is /dev/radio_feedback. It's likely for the "cell radio" aka modem aka baseband.

The One uses a Broadcom FM/Bt/WiFi combo chip. I think the only way to access it at kernel level without the Bluez stack (that is no longer supported on Android) is via /dev/ttyHS0, which is a high speed serial port.

The ttyHS0 protocol is the same as it's been for many years. Source code can be found in Linux kernels or older Android AOSP kernels for JB 4.1 and prior. (Bluez does not work where the Broadcom proprietary BT stack is used.)

Of course you need permissions on ttyHS0; I don't recall any case where it was open to regular apps on any phone ever.

And besides the protocol you need to know at least some of the "registers", but a look at the old CM7 FM app can help with that.

And to use ttyHS0 requires that the BT stack is not using it. In Android 4.0, 4.3 and some 4.2's the BT stack ALWAYS has it open so another app can't use it.

If the closed source, secret and publicly undocumented Broadcom OEM Proprietary FM API is there and usable, that's one access method.

Spirit has a new experimental method (HCI Access=Bluedroid Shim) to access the FM on Android 4.3 with the new Bluedroid stack. But there are some small-ish risks with using an experimental method so I haven't been promoting it's use.

The Bluedroid Shim method works by using a new libbt-hci.so that calls the old one, and can inject it's own commands and consume the resulting responses.

There are no particularly easy methods to access Broadcom FM on recent Android versions, especially if stock, w/ OEM proprietary stack and unrooted. Older Bluez based versions of Android allowed commands to be sent with hcitool, but no more.
[Spirit FM] CarlettoGas:
Hello Mike,

With these settings Samsung Galaxy S4 Mini LTE GT I9195 works too!!

BAND - World 200khz (This might not be the same for you)

AUDIO - METHOD MODE (DigitalXL/ONE/S)

UI - RDS: (ON)

AF - AF MODE: RDS+Region

DEBUG - FM CHIP: (QC V4L HTC) & Motorola FW Load: (HCI)

Thank you

:good::good:
[Spirit FM] oscarandjo:
i9100 on CM 10.2

I'm trying to run the trial version of the app and get it to work on my Samsung Galaxy S2 GT-i9100 (Not G, just i9100) before I consider buying this app - It's unlocked and running Cyanogenmod 10.2 nightlies.

I can't get it to work, and have no idea what bands and other settings to use, I have tried all the bands with all the other settings set default/auto but it won't work. I live in southern UK

Can anyone give any info to whether this will work on my phone and what settings to use?

Thanks.
[Spirit FM] mustasusi:
Hi Mike,

I know you're OFF for a while but even though:

Are there any improvements with digital playback\record on Note 2? As for me it still plays the left channel and quarter of the right one. It plays and records stereo, as long as reception allows, but with a heavy tendency to the left. If you set the balance to right, you would clearly hear the right ch, but much weaker, to sustain my description - check out this record: http://www73.zippyshare.com/v/59221865/file.html

Any in-app sound settings to workaround on this?

So I'm sticking to analog but here I have another frustration: The only way I can guarantee a stereo record is by doing as follows:

1. Set the method to "Auto" or "MediaRecord" (for me it doesn't matter)

2. Toggle record

3. Stop

4. Set method to "PCM"

5. Record again when ready

If I don't push the record for several hours or more, it might result in mono PCM and I will have to redo the above procedure:

Also, it skips a lot during records and recently it's getting worse. You can listen to the following record sample and figure out how many skips in a particular song: http://www48.zippyshare.com/v/15991139/file.html

Those skips are unnoticeable during the record process on analog. You would hear the newly appeared skips only when you come to check the file. On digital method however, it skips even in regular playback!

Any advice for this?

The last question refers to HTC Butterfly S. Are playback and (stereo) record supported on this device?

http://www.gsmarena.com/htc_butterfly_s-5537.php
[Spirit FM] mikereidis:
The GT-I9100 is still the most common/popular phone among Spirit customers. If something is broken on this phone, on any reasonably popular ROM, I usually find out about it pretty quick.

All the settings to make it work should be completely automatic. Band doesn't mostly matter, though it should be set to "World..." outside of North America and South Korea.

One of the most common problems is that Spirit does not have the SU/root privileges it needs. Check your SuperUser or SuperSU config.

Beyond that, some kernels may not have the needed FM driver, but CM kernels almost always do.

You haven't said exactly what happens; IE if you get a power up error or what. With wired headset plugged in for the antenna, the RSSI at top left should be over 20 when tuned to a good station.
[Spirit FM] mikereidis:
Send me an email.

Digital audio features have problems on many Samsung stock ROMs. But record should work OK on stock ROMs that have the record feature on the stock FM app. You haven't mentioned if you are stock or ROM'd or rooted.

I have no problems with digital audio on my similar GT-I9300, but have heard some reports of issues on the GT-N7100.

I know nothing about the new Butterfly S at this point. Can you even confirm if it has stock FM radio ? Also, knowing the audio chip and FM/combo chip would help.
[Spirit FM] mustasusi:
Yes, I forgot to mention I'm using [MENTION=4826618]grilleld[/MENTION]'s MoonRom v10 (Sammy TW based, custom rooted ROM of course).

The Galaxy S3 is, as strange as it might sound, acting completely different, I know digital works fine on either S3 and the Note1 I previously owned, but on Note 2 it isn't the case. The imbalanced sound may occur even when you switch between speaker and phones or getting a phone call or message during the record (I'd rather put on vibration in this case), as well as many other actions may affect the record sound and these affections you won't hear during analog playback. It's nothing to compare with S3 I9300, custom nor stock ROMs.

About the HTC Butterfly I don't know much, except it stated according to GSMarena sheets to have radio and screenshots of the stock radio app are provided (they included a signal strength bar which is nice). I believe the chip and software are similar to HTC one, which I don't know much about either and I can't buy before being completely sure it plays and records radio too. This could be a deal breaker for me.
[Spirit FM] mikereidis:
OK, so the N7100 is different somehow; N7000 was a bit different than I9100 too, but I thought GS3 and Note2 were more similar.

I might consider getting a used N7100; they're getting cheaper now and I've had a reasonable number of sales for Note2.

Skipping indicates the CPU core(s) are getting too busy with other stuff. Some apps may do a lot in the background (Spirit included). You can try setting AF->AF Period to numbers like 8192, 16384, 30000, etc. This is a backdoor to raising the audio buffer size. It will result in a longer lag. Set it back to 500 for the default.

"MediaRecord" should be the same method as the stock app uses to record, but it should only be used with the stock Audio-> Method, which I think is "Galaxy S3/Note/S2_ICS". It may also help to set Debug-> FM API to "OEM Proprietary" to match what the stock FM app does (assuming it works on this stock derived ROM). If recording doesn't work this way, maybe Digital-> Source has to be changed to 9 or higher, instead of the default of 8.

For Butterfly S, I'd suggest we wait until someone with one of these tests Spirit. The HTC One settings might work if similar, or the OneX LTE settings may work if it's an all Qualcomm chip device.

But I'm not expecting the Butterfly S to sell well enough for me to get one.
[Spirit FM] oscarandjo:
Sorry, I had DorimanX installed and it supposedly has FM Radio support but it wouldn't work. Any ideas on how I could get this kernal to work because it has excellent battery savings. I put the one that comes with Cyanogenmod back on and it seems to at least get white noise and no errors - I'm inside at the moment though so when I go outside I should get a better signal.

Edit: I plugged the headphones that came with my phone in and now it works! 22-30 signal! :)
[Spirit FM] mikereidis:
Hmm, his kernel config file has this in it:

CONFIG_FM_SI4709=m

Which means the FM driver should be a module, and modules need to be loaded somehow. Perhaps his STweak app can enable/load the FM driver module ? Some kernels have config apps that need to be run.

I'd do a search on his thread, but XDA thread search seems to be off right now.
[Spirit FM] oscarandjo:
Doesn't seem to be in STweaks. I'll just keep the Cyanogenmod default Kernal, it's fine apart from the colours which look far more vibrant with Doriman.
[Spirit FM] psziroot:
I have I9100, CM10.1.3 and Dorimanx 9.41 kernel. Spirit FM works fine.
[Spirit FM] Vortran:
HD Radio

I don't really know much about digital radio. I bought this thinking it does HD Radio, but I don't understand any of the acronyms like RSSI, AF, RDS, PI, etc. So I don't really know if it does or does not actually do HD Radio which is what a number of the local stations advertise. Spirit FM(UL) displayed some callsigns, so I assume it's locking on to the HD Radio digital stream, but it never shows any song info or visualization. I assume this is because I haven't set it up correctly. I do have those UI items checked.

I have never used HD Radio before, but I thought once you locked on to a carrier, you could select from multiple streams and get content descriptions.

Any help is appreciated. Thanks in advance!

HTC One (m7spr) rooted

CyanogenMod 10.1.3

Milwaukee, WI - USA
[Spirit FM] Lagkage:
Spirit FM won't work with HD Radio, only regular FM radio. No phones have hardware capable of digital radio such as HD Radio. If you want to listen to a station which not broadcast through FM, you will have to use internet streaming apps.
[Spirit FM] saumar:
Lol Dude are you high or what??:beer: you've posted the same thing twice...tell us that's just a mistake :sly:

Inviato dal mio GT-I9070 con Tapatalk 4
[Spirit FM] scutworker:
Well, I've no idea what "HD Radio" is, but this app is for receiving radio over FM. That's the "old" system over the air radio and not one using the internet.

I guess HD radio must be an American thing, because I've never heard of it in the UK.

To use this app you need to plug in your headphones as the cable acts as an aerial. You should then be able to scan the frequencies to find a station. Each station has it's own frequency so I'm not sure what multiple streams are.

In short this is like an old-style FM radio on your phone. And a damn fine one it is too.
[Spirit FM] spunker88:
No HD Radio would require dedicated hardware in the phone and AFAIK no Android phone has HD Radio hardware due to the fact that its a proprietary standard only used in the United States and has been relatively unpopular in the US so far.

Spirit is getting its station and song info from RDS a digital subcarrier technology that is capable of sending text information on an FM broadcast and has been around longer than HD Radio. RDS/RBDS is used worldwide and isn't proprietary like HD Radio so you see it implemented on more devices.
[Spirit FM] mikereidis:
Lagkage and the other posters are correct. There isn't a single phone out there that supports HD radio (US / iBiquity) or DAB (Europe), and there are none that are publicly planned, and I don't think I've even heard any reliable rumor about any such phone in the pipeline.

I know iBiquity has tried to get phone OEMs to support HD Radio, but so far that hasn't happened. iBiquity created and has HD Radio patents and thus they are the only seller of HD Radio capabilities. So of course they'd like to sell HD Radio to everybody that builds radios or radio chips or phones.

You can get digital audio features, such as visualizer, by setting Menu-> Settings-> Audio-> Method to "Digital Auto" and restarting Spirit. I've noted though that HTC One visualizer doesn't work on the latest stock Android 4.3 ROMs, but CM should be fine.

Digital Audio in Spirit has nothing to do with HD Radio. The signal is still analog, but this allows that analog signal to be converted to digital, to allow BT headset usage, EQ, visualizer, record, and any other features that non-FM audio has. (FM on smartphones traditionally bypassed the Android audio processing, which is a major pain in the rear end.)

From http://en.wikipedia.org/wiki/Radio_Data_System :

"Conventional" in this quote means the standard analog FM that has been in use for many decades now. RDS has been around about 20 years now.

Besides AF Alternate Frequency, which isn't really used in the US, there are 4 RDS values that Spirit supports:

PI Program ID = Call letters in the US.

PT Program Type = "Rock", "Talk", "Country", etc.

RT RadioText = up to 64 characters often used to identify song, artist or show weather info or whatever the station decides.

PS Program Service = In the US is usually the same as RT, but scrolled 8 characters at a time. Outside North America it usually identifies the station.

And RSSI (Received Signal Strength Indicator) has nothing to do with the above. It's just a number indicating the signal strength.
[Spirit FM] mikereidis:
Thanks...

I believe there is some HD radio movement in Mexico now, and some new limited testing in Canada, though I'm not convinced these will have much success, or spread beyond "North America".

It would be nice if some mass market phones were able to support SDR software defined radios. Somebody could then just write code to support HD radio or DAB or whatever. But I'd guess that royalties would have to be paid to iBiquity for HD radio.

I'd bet there are at least a few Chinese phones with embedded TV chips that could be used for SDR, but I wouldn't seriously consider doing any SDR for non-mass-market devices.
[Spirit FM] spunker88:
I own one of those USB SDR dongles and AFAIK nobody has been able to get HD radio working with them due to the closed standard. Somebody would have to reverse engineer it, if thats even possible, and nobody has yet.
[Spirit FM] RaNDoLpH-GT-I9505:
thanks

good app thank you :thumbsup: