discuss-gnuradio
[Top][All Lists]
Advanced

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

Re: [Discuss-gnuradio] Re: gr.wavfile_source


From: Dimitris Symeonidis
Subject: Re: [Discuss-gnuradio] Re: gr.wavfile_source
Date: Wed, 17 Dec 2008 14:44:06 +0100

Yes, it did fix the problem, thank you Martin.

Just a note for other linux users: if sox complains about unknown file
type mp3, you need to also install libsox-fmt-mp3

Dimitris Symeonidis
"If you think you're too small to make a difference, try sleeping with
a mosquito!" - Amnesty International



On Wed, Dec 17, 2008 at 13:24, Martin Braun <address@hidden> wrote:
> 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/
>
> _______________________________________________
> Discuss-gnuradio mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/discuss-gnuradio
>
>




reply via email to

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