[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Discuss-gnuradio] unable to read a WAV file recorded using GNU radio bl

From: Rensi Mathew
Subject: [Discuss-gnuradio] unable to read a WAV file recorded using GNU radio block
Date: Tue, 22 Jan 2019 06:39:27 +0000 (UTC)

I am trying to read a FM signal recorded as WAV file using GNU radio Companion, using python. I am attaching the .grc file used.

I can clearly hear the recorded signal but reading the data gives a null ([] ) value.

The python code

     import soundfile as sf

     data, fs = sf.read('/home/fm_record_RSM_10_01_2019_dat.wav')

     for i in data:


this gives data as array([], dtype=float64) and fs as 96000.

When the following code is used,

          import wave

     input_wave_file= wave.open('/home/dstlab2/fm_record_RSM_10_01_2019_dat.wav', 'r')

     nc,sw,fr,nf,ct,cn = input_wave_file.getparams()

another error is raised

Error                                     Traceback (most recent call last)
<ipython-input-3-5009fe3506e7> in <module>()
      1 import wave
----> 3 input_wave_file= wave.open('/home/fm_record_RSM_10_01_2019_dat.wav', 'r')
      4 nc,sw,fr,nf,ct,cn = input_wave_file.getparams()
      5 frame_data = input_wave_file.readframes(5)

~/anaconda3/lib/python3.7/wave.py in open(f, mode)
    508             mode = 'rb'
    509     if mode in ('r', 'rb'):
--> 510         return Wave_read(f)
    511     elif mode in ('w', 'wb'):
    512         return Wave_write(f)

~/anaconda3/lib/python3.7/wave.py in __init__(self, f)
    162         # else, assume it is an open file object already
    163         try:
--> 164             self.initfp(f)
    165         except:
    166             if self._i_opened_the_file:

~/anaconda3/lib/python3.7/wave.py in initfp(self, file)
    131             raise Error('file does not start with RIFF id')
    132         if self._file.read(4) != b'WAVE':
--> 133             raise Error('not a WAVE file')
    134         self._fmt_chunk_read = 0
    135         self._data_chunk = None

Error: not a WAVE file

Could someone help me to find what the problem could be? Is it because of any mistake in the setting of record wav block in .grc file or any mistake in python file? Kindly help

Thanking you

reply via email to

[Prev in Thread] Current Thread [Next in Thread]