[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Discuss-gnuradio] Re: gr.wavfile_source
From: |
Martin Braun |
Subject: |
[Discuss-gnuradio] Re: gr.wavfile_source |
Date: |
Wed, 17 Dec 2008 13:24:32 +0100 |
User-agent: |
Mutt/1.5.16 (2007-06-09) |
On Wed, Dec 17, 2008 at 11:17:11AM +0100, Dimitrios Symeonidis wrote:
> Hi Martin, I am trying to read a stereo wav file converted from an mp3
> using audacity on ubuntu, and I get the error
> "RuntimeError: is not a valid wav file"
>
> I looked at the code
> http://gnuradio.org/trac/browser/gnuradio/branches/releases/3.1/gnuradio-core/src/lib/io/gr_wavfile_source.cc?rev=7808
> and I can see that it comes from
> if (!gri_wavheader_parse(d_fp,
> d_sample_rate,
> d_nchans,
> d_bytes_per_sample,
> d_first_sample_pos,
> d_samples_per_chan))
>
> how do you propose i create the wav file from mp3 on linux, in order to
> have a valid wavheader?
Hi Dimitrios and whoever it may interest on the GR list,
the gr_wav* blocks only accept WAV if:
- They are uncompressed (RIFF/WAV supports some kind of compression)
- Samples are saved as integers, 8 or 16 bit resolution
- They must have a valid header (i.e. begin with 'RIFF....WAVEfmt ')
The latter should not be a problem with any audio program, including
audacity. I know audacity uses a proprietary floating point format
internally, so possibly one of the first conditions was violated?
An easy way to convert an mp3 to a GR-compatible WAV file is to use sox:
$ sox infile.mp3 -2 outfile.wav
The -2 switch converts the output to 16-bit samples.
Hope this helps,
Martin
> thank you in advance for your help
>
> ps you might want to publish your answer to discuss-gnuradio for future
> reference...
--
Dipl.-Ing. Martin Braun Phone: +49-(0)721-608 3790
Institut fuer Nachrichtentechnik Fax: +49-(0)721-608 6071
Universitaet Karlsruhe (TH) http://www.int.uni-karlsruhe.de/
pgp0Ih_vXiigr.pgp
Description: PGP signature
- [Discuss-gnuradio] Re: gr.wavfile_source,
Martin Braun <=