ge0rg / aprsdroid

APRSdroid - Geo-Location for Radio Amateurs
https://aprsdroid.org/
GNU General Public License v2.0
515 stars 100 forks source link

Incorrect AFSK modulation #16

Closed cooldemo closed 13 years ago

cooldemo commented 13 years ago

Seems like the AFSK modulation is not correct on HTC Desire S. The sound sounds a little off in frequency. I did not check it precisely yet, jut by ear. Also the MultiPSK software was not able to demodulate it, while it was able to demodulate packets from the air. Perhaps add a parameter to change the frequencies, baud rate ?

nogy commented 13 years ago

Hi, thanks for the information. The easiest fix (imho) would be to double check whether the audio API correctly sets the samplerate to the requested value. The code came up quick and dirty and worked ever since. I'll have a look. best regards, NoGy

cooldemo commented 13 years ago

I would say the frequency was off by just a few hundreds of hertz. I will measure it more precisely tomorrow.

cooldemo commented 13 years ago

OK, I did these 3 images from soundcard spectrum analyzer:

This is a transmittion of a APRS packet from aprsdroid with 70ms preamb: http://imageshack.us/photo/my-images/834/aprsdroid70mspreambandd.jpg/ This is just a few second preamb from aprsdroid: http://imageshack.us/photo/my-images/191/aprsdroidpreamb.jpg/ and finally this is sound analysis of real data from the air, where you clearly can see the 2200 and 1200 Hz spikes. http://imageshack.us/photo/my-images/109/realaprs.jpg/

Overall the preambule looks very weird, don't know if the cause is my phone (HTC DESIRE S) or the 8kHz sampling rate or the algorithm.

cooldemo commented 13 years ago

Looking at the

jsoundmodem / src / com / nogy / afu / soundmodem / Afsk.java: line 144: while(t++<samplerate/bps)

Using 8k sampling rate and 1200bps, we get a division of 6.6666, so the while loop gets executed 6 times, every time. Giving us a timing error of 11%, which could be too much. If the rate would be switched to 22k the error would be reduced to 1.8%, which would be more acceptable and also the cosine wave would look better.

nogy commented 13 years ago

I think the problem is that your device might not accept the 8k sampling rate but instead use 11k which when you play an 8k audio file will result in distortion and the frequency shift you observed. I'll try to look into this this weekend.

nogy commented 13 years ago

You might want to join the irc channel #aprsdroid on freenode. Please note that due to the time shift you'll have a better chance to catch me active around 19:00-21:00 UTC :)

ge0rg commented 13 years ago

I have made a binary using 22050 Hz as the sampling rate. That should be widely supported, please test this APK and report if it works!

ge0rg commented 13 years ago

I have also changed the pcmData generation to remove the rounding error. Please test this build for improvement as I currently do not have the required equipment.

cooldemo commented 13 years ago

Hi,

I got to testing the previous version you sent me only last weekend and it worked ;) I will check this one soon Thanks

Martin Demin

On Thu, Oct 6, 2011 at 7:09 PM, Georg Lukas < reply@reply.github.com>wrote:

I have also changed the pcmData generation to remove the rounding error. Please test this build for improvement as I currently do not have the required equipment.

Reply to this email directly or view it on GitHub: https://github.com/ge0rg/aprsdroid/issues/16#issuecomment-2312368

ge0rg commented 13 years ago

The previous version still had the rounding error, which should be fixed by now (unless I broke something else in the process ;) As I can not test this myself, I am patiently waiting :)

ge0rg commented 13 years ago

Any news with testing that build yet?