problem while decoding and syncing
luisrr1590 opened this issue · 9 comments
Hello....i've been trying to develop my own program to capture and decode images from NOAA sattelites....when trying to decode i came across your program which is the only one a have seen in python but the problem is that the decoding is not working for me.....i recorded the wav using gnuradio and it works fine in other softwares like wxtoimg....the wav is sampled at 11025hz....your program asks for 20800hz...why??? and can it be changed????
well i tried to resample the wav using your code and audacity but when trying to decode the new wav file the result is always the same
the image repeat itself to the right and the synchronization is not perfect either
update: the resultant image is sized 2080x540. the weird thing is that in 2080 pixel width is fitting the original image twice????
what is going on???
could you please help me
Looks like the audio is still on 11025Hz and apt-decoder is processing it just as if it were at 20800Hz. You see (almost) two horizontal images because 20800/11025 = 1.88. Also you should find that the height of the image is almost half.
I find it a little strange as apt-decoder first checks the header of the WAV file, so I guess your WAV file says 20800Hz but the data is actually at 11025Hz. WXtoIMG by default works at 11025 so that's why it works there.
I imagined it could be that....but the problem is that I created another wav resampled with audacity and it does the same.....I even resampled the wav with the resampler.py and it still doing the same
Can you upload the WAV somewhere? I can reproduce the issue if I grab a 11025Hz file and edit the header with an hex editor so it says 20800 to confuse apt-decoder.
I've temporarily created a repository in my github account....try and see if you can download the files from there.
Thank you
now that i'm seeing its a bit weird that both files have the same size
OMG I'm such an idiot...i re-resampled the wav in audacity and this time i did it correctly and it worked fine.....You were right the file was still in 11025hz even though it was saying 20800hz.....however resample.py still doesn't work for me... i'm thinking it is still leaving the file in 11025hz
Yes, looks like the 20800Hz file you uploaded was resampled using resample.py and is wrong, it sounds like sped up too because of the sample rate.
Maybe later I'm going to take a look into resample.py
I think i figured it out....in the resampling code the line:
coef = (RATE / rate) is giving result 1.0 which is why the resampling is throwing exactly the same
i changed it to:
coef = (float(RATE) / float(rate))
and now is resampling to 20800
the problem now is that it takes forever to resample
I dont understand much of the _reshape function so this is why I'm asking...is there a way to synchronize directly from the 11025hz wav without having to resample?????????
Probably it takes forever because the function scipy.signal.resample()
was not designed for resampling millions of samples.
We can synchronize at 11025 but if I remember correctly the demodulation needs a higher sample rate to avoid aliasing (aliasing happens when you produce frequencies higher than the maximum allowed by the sample rate, at 11025Hz you can't go higher than 5512Hz, at 20800Hz the maximum is 10400Hz).
Regarding the _reshape()
function, I wrote that myself. When I made my other decoder I wrote this page explaining an overview of the process but I have no problem adding a longer explanation. You can email me to the address listed on the bottom of the page if you want to avoid sending notifications to the people subscribed to this issue.
Thank you very much for your time.....if I have another doubt I'll write you....thanks again