Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sox after receiving wav file - fails #13

Closed
superingole opened this issue Feb 2, 2021 · 22 comments · Fixed by #23
Closed

sox after receiving wav file - fails #13

superingole opened this issue Feb 2, 2021 · 22 comments · Fixed by #23
Assignees
Labels
duplicate This issue or pull request already exists

Comments

@superingole
Copy link

sox FAIL formats: can't open input file `/tmp/sat.wav': WAVE: RIFF header not found

@stdevPavelmc
Copy link
Owner

Hi, have you installed the software in the last 12 hours?

If not, please upgrade it as last night I pushed some changes in the user settings and before some other changes fixing other bugs like this

BTW: please provide some context, for example you got that running it by hand or from a log of a programmed task?

Thanks for testing/using the software...

@stdevPavelmc stdevPavelmc self-assigned this Feb 2, 2021
@superingole
Copy link
Author

Hi

thanks for the very fast answer.
i have installed it on last friday.
run was from a programmed task.

Now i have reinstalled sw and wait for next passes.

i will update you with the results.

@stdevPavelmc
Copy link
Owner

Ok, I wait for your comments...

@stdevPavelmc
Copy link
Owner

Hey! any progress?

It worked?

@superingole
Copy link
Author

hi,

sorry for the long delay but i was busy this week :-(

i have reinstalled new version - but same error - have attached an output from shell script

sat-log.txt

@stdevPavelmc
Copy link
Owner

From your log:

timeout 120 /usr/local/bin/rtl_fm -d 4 -p 0 -f 145.800M -s 25k -g 44.5 -E wav -E deemp -F 9 -
Found 10 device(s):
  0:  Realtek, RTL2838UHIDIR, SN: 00010
  1:  Realtek, RTL2838UHIDIR, SN: 00009
  2:  Realtek, RTL2838UHIDIR, SN: 00008
  3:  Realtek, RTL2838UHIDIR, SN: 00006
  4:  Realtek, RTL2838UHIDIR, SN: 00007
  5:  Realtek, RTL2838UHIDIR, SN: 00005
  6:  Realtek, RTL2838UHIDIR, SN: 00004
  7:  Realtek, RTL2838UHIDIR, SN: 00003
  8:  Realtek, RTL2838UHIDIR, SN: 00001
  9:  Realtek, RTL2838UHIDIR, SN: 00002

Using device 4: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain set to 44.50 dB.
Tuned to 146200000 Hz.
Oversampling input by: 64x.
Oversampling output by: 1x.

Do you have 10 RTL-SDR devices connected to the Raspberry Pi?

Unlikely but possible, If so you need to modify the script to signal rtl_fm to choose just one of them.

If not and there is only one, then you have a problem with the RTL-SDR device detection... and maybe that is causing the problems.

Cheers.

@takagiwa
Copy link

takagiwa commented Feb 7, 2021

Hello.

I had same problem on Raspberry Pi OS yesterday.
rtl_fm from apt seems not have "-E wav" option.
My workaround was that build rtl_fm from https://github.com/keenerd/rtl-sdr .
Take care about install directory.


More information:

$ /usr/bin/rtl_fm --help
rtl_fm: invalid option -- '-'
rtl_fm, a simple narrow band FM demodulator for RTL2832 based DVB-T receivers

Use: rtl_fm -f freq [-options] [filename]
[-E enable_option (default: none)]
use multiple -E to enable multiple options
edge: enable lower edge tuning
dc: enable dc blocking filter
deemp: enable de-emphasis filter
direct: enable direct sampling
offset: enable offset tuning

$ /usr/local/bin/rtl_fm --version
/usr/local/bin/rtl_fm: invalid option -- '-'
rtl_fm, a simple narrow band FM demodulator for RTL2832 based DVB-T receivers

Use: rtl_fm -f freq [-options] [filename]
[-E enable_option (default: none)]
use multiple -E to enable multiple options
edge: enable lower edge tuning
no-dc: disable dc blocking filter
deemp: enable de-emphasis filter
swagc: enable software agc (only for AM modes)
swagc-aggressive: enable aggressive software agc (only for AM modes)
direct: enable direct sampling
no-mod: enable no-mod direct sampling
offset: enable offset tuning
wav: generate WAV header
pad: pad output gaps with zeros
lrmix: one channel goes to left audio, one to right (broken)
remember to enable stereo (-c 2) in sox

So I have modified "rtl_fm" to "/usr/local/bin/rtl_fm" in FAASGS/sat.sh


Best regars,

@superingole
Copy link
Author

Hello

it is not an rasperrry, it is an INTEL NUC with proxmox and serveral linux containers.
the detection of the stick is fine.

/usr/local/bin/rtl_fm -d 4

i have already rebuild the rtl_fm from newest source from osmocom - But same result

now i will try with the rtl_fm source from your link

i will inform you

regards

@stdevPavelmc
Copy link
Owner

My workaround was that build rtl_fm from https://github.com/keenerd/rtl-sdr .

Hum... interesting

Worth a note in the README.

@stdevPavelmc
Copy link
Owner

Please do feedback, I have included a note in the README.md about this issue

Hello

it is not an rasperrry, it is an INTEL NUC with proxmox and serveral linux containers.
the detection of the stick is fine.

/usr/local/bin/rtl_fm -d 4

i have already rebuild the rtl_fm from newest source from osmocom - But same result

now i will try with the rtl_fm source from your link

i will inform you

regards

@takagiwa
Copy link

takagiwa commented Feb 7, 2021

I got same problem when I tried osmocom .
There were no "-E wav" option.
I think you'll get different result when you try https://github.com/keenerd/rtl-sdr .

It seems forked from https://github.com/pinkavaj/rtl-sdr and added such a option.
There are much fork. I don't know which is best.


It may be better that use same repository that apt.armbian using. I couldn't find.

Best regards,

@superingole
Copy link
Author

hello

seems that now it produce an correct wave file.

question: the rasperry have to set to GMT time right ?
if yes can you make an remark in your readme, i thinks this can be helpful

thanks for your support

wolfgang

@stdevPavelmc
Copy link
Owner

question: the rasperry have to set to GMT time right ?

It does not matter if you set the correct timezone.

Run the raspi-config sudo raspi-config and look for the timezone settings, select the proper timezone and you are set.

If the Raspi has internet connection it will fetch the time from the net and you are set.

@Murzim2
Copy link

Murzim2 commented Feb 12, 2021

I am getting a similar problem, see text below and also have the problem of wxmap: error: city, country (Leicester, United_Kingdom) not recognised. Have tried every combination of City and Country.
City meets the requirements and Country I have used England, UK and United Kingdom and does not get accepted

Also I have noticed that a lot of the time 'Tuned to' does not have the correct satellite frequency
Thanks

Using device 0: Generic RTL2832U OEM
Found Rafael Micro R820T tuner
Tuner gain set to 44.50 dB.
Tuner error set to 75 ppm.
Tuned to 138020000 Hz.
Oversampling input by: 32x.
Oversampling output by: 1x.
Buffer size: 5.12ms
Allocating 15 zero-copy buffers
Sampling at 1600000 S/s.
Output at 50000 Hz.
Signal caught, exiting!

User cancel, exiting...
sox WARN wav: Premature EOF on .wav input file
Audio processing
It's a NOAA Satellite
wxmap: error: city, country (Leicester, United_Kingdom) not recognised
wxtoimg: error: could not open overlay map file '/var/www/html/sat/20210212-181253_NOAA15/NOAA15-map.png'
wxtoimg: warning: Narrow IF bandwidth (set Recording Options/receiver type), low S/N, or volume too high
free(): invalid pointer
/usr/local/bin/sats.sh: line 101: 5119 Aborted wxtoimg -m ${WSATP}-map.png,${SLANT_X},${SLANT_Y} -t n ${APT_OPTS} -e HVC -K -q ${WSATP}.wav ${WSATP}.${APT_IMAGE_FORMAT}
wxtoimg: error: could not open overlay map file '/var/www/html/sat/20210212-181253_NOAA15/NOAA15-map.png'
wxtoimg: warning: Narrow IF bandwidth (set Recording Options/receiver type), low S/N, or volume too high
wxtoimg: warning: no specific NOAA satellite (using NOAA 12/14 series model)
wxtoimg: warning: No map to use for MSA enhancement
free(): invalid pointer
/usr/local/bin/sats.sh: line 101: 5136 Aborted wxtoimg -m ${WSATP}-map.png,${SLANT_X},${SLANT_Y} -t n ${APT_OPTS} -e MSA -q ${WSATP}.wav ${WSATP}C.${APT_IMAGE_FORMAT}
wxtoimg: error: could not open overlay map file '/var/www/html/sat/20210212-181253_NOAA15/NOAA15-map.png'
wxtoimg: warning: Narrow IF bandwidth (set Recording Options/receiver type), low S/N, or volume too high
free(): invalid pointer
/usr/local/bin/sats.sh: line 101: 5141 Aborted wxtoimg -m ${WSATP}-map.png,${SLANT_X},${SLANT_Y} -t n ${APT_OPTS} -e therm -q ${WSATP}.wav ${WSATP}T.${APT_IMAGE_FORMAT}
wxtoimg: error: could not open overlay map file '/var/www/html/sat/20210212-181253_NOAA15/NOAA15-map.png'
wxtoimg: warning: Narrow IF bandwidth (set Recording Options/receiver type), low S/N, or volume too high
free(): invalid pointer
/usr/local/bin/sats.sh: line 101: 5159 Aborted wxtoimg -m ${WSATP}-map.png,${SLANT_X},${SLANT_Y} -t n ${APT_OPTS} -e anaglyph -q ${WSATP}.wav ${WSATP}3D.${APT_IMAGE_FORMAT}

@stdevPavelmc
Copy link
Owner

I am getting a similar problem, see text below and also have the problem of wxmap: error: city, country (Leicester, United_Kingdom) not recognised. Have tried every combination of City and Country.
City meets the requirements and Country I have used England, UK and United Kingdom and does not get accepted

The example in the docs is with the London city, in this way (I tested it and it works) "London, United Kingdom", so in your case it will become in the /etc/sat_data/user.conf file:

LOC_NAME="Leicester"
LOC_COUNTRY="United Kingdom"

Change it and just wait for the next pass to validate.

@stdevPavelmc
Copy link
Owner

Also I have noticed that a lot of the time 'Tuned to' does not have the correct satellite frequency
Thanks

That's normal, the RTL-SDR is 2 Mhz wide receiver, it can't tune to the exact freq as the DC spike will disturb the signal we need. Instead it tunes above or below and uses oversampling to try to squeeze all the useable information from the radio signal.

Note this data in your log dump :

Tuned to 138020000 Hz.
Oversampling input by: 32x.
Oversampling output by: 1x.
Sampling at 1600000 S/s.
Output at 50000 Hz.

It's sampling at 1.6 Mhz wide (1600000 S/s), Tuned to 138,020 Mhz, oversampling by 32 the input, shifted 50khz down from the DC spike and with no oversampling on the out signal.

@Murzim2
Copy link

Murzim2 commented Feb 13, 2021

Changing user.conf to read
LOC_NAME="Leicester"
LOC_COUNTRY="United Kingdom"
I still get an error.
wxmap: error: city, country (Leicester, United) not recognised

Here is part of my user.conf file
######### LOCATION OPTIONS ####################

CALL=G8PGO
NAME=Dave
LOC=IO92im
LOC_NAME="Leicester"
LOC_COUNTRY="United Kingdom"

@stdevPavelmc
Copy link
Owner

wxmap: error: city, country (Leicester, United) not recognised

Yep,
The space is spliting the name of the city, a bug you found, I will fixit, staty tuned

@stdevPavelmc stdevPavelmc added the duplicate This issue or pull request already exists label Feb 18, 2021
@AgriVision
Copy link

as I prefer to stick to standard installations, why not let rtf_fm grab in raw format and let sox convert from raw to wav?

@stdevPavelmc
Copy link
Owner

stdevPavelmc commented Feb 23, 2021

as I prefer to stick to standard installations, why not let rtf_fm grab in raw format and let sox convert from raw to wav?

I would llike to see the code for that, but please remember

  • We are on a SBC, so storage is slow and frame drops will occur in high datarate writes
  • We use /tmp that is in RAM to avoid that, but it's just ~50 MB so...

@AgriVision
Copy link

I would llike to see the code for that, but please remember

We are on a SBC, so storage is slow and frame drops will occur in high datarate writes
We use /tmp that is in RAM to avoid that, but it's just ~50 MB so...

valid points indeed, although by default /tmp is not in RAM on a raspberry PI.
Is it possible to pipe rtl_fm output directly to sox?

@AgriVision
Copy link

AgriVision commented Feb 25, 2021

I would llike to see the code for that

This works for me:

timeout $5 rtl_fm -p "${RTL_PPM}" -f "${FREQ}M" -s "${rxbw}" \
			-g 44.5 -E deemp -F 9 - | \
			sox -t raw -r "${rxbw}" -e signed -b 16 -c 1 - ${WSATP}.wav rate 11025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants