Wav sink problem

Hi,

i construct very simple scheme Audio Source --> Wav Sink
gr generates non-null wav file
-rw-rw-r-- 1 anton anton 24M . 27 00:46 freq2.wav

but when i try to play it or fetch info about file with soxi (sox
plugin)
i got nothing

aplay freq2.wav
WAVE ‘freq2.wav’ : Signed 16 bit Little Endian,
44100 ,

and soxi freq2.wav shows

$ soxi freq2.wav

Input File : ‘freq2.wav’
Channels : 1
Sample Rate : 44100
Precision : 16-bit
Sample Encoding: 16-bit Signed Integer PCM

so it seems to me wav sink produces corrupted wav files or … what am
i doing wrong?

e.g.
soxi info on good wav file

$ soxi arecord.wav

Input File : ‘arecord.wav’
Channels : 1
Sample Rate : 8000
Precision : 8-bit
Duration : 00:00:02.38 = 19000 samples ~ 178.125 CDDA sectors
File Size : 19.0k
Bit Rate : 64.1k
Sample Encoding: 8-bit Unsigned Integer PCM

look at Sample Encoding - it is Signed for gnuradio and Unsigned for all
others.

Hi Anton,

I’d rather look if your audio source is producing the correct samples.

On Thu, Sep 27, 2012 at 12:51:20AM +0400, Anton K. wrote:

i construct very simple scheme Audio Source --> Wav Sink
gr generates non-null wav file
-rw-rw-r-- 1 anton anton 24M сент. 27 00:46 freq2.wav

Looks good.

$ soxi freq2.wav

Input File : ‘freq2.wav’
Channels : 1
Sample Rate : 44100
Precision : 16-bit
Sample Encoding: 16-bit Signed Integer PCM

Looks good, too.

File Size : 19.0k
Bit Rate : 64.1k
Sample Encoding: 8-bit Unsigned Integer PCM

look at Sample Encoding - it is Signed for gnuradio and Unsigned for all others.

You’re comparing 16- with 8-Bit. They’re different.

Check the WAV file with Audacity. You can also connect the WAV sink to a
signal source for further tests.

M


Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin B.
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT – University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association

Hi, Martin, thanks for reply.

In Audacity i see only gray background and no signal.

Actually i have started with nbfm reciever and tried to save audio in
wav file. That i tried to redirect it to audio sink and audio was ok.
Than i tried to use very simple scheme with audio source to wav sink
and realize that wav file is broken.

I do not think it is good when soxi not shoing time length for the
file - that means file is broken.

On Thu, Sep 27, 2012 at 6:42 PM, Martin B. (CEL)

On Thu, Sep 27, 2012 at 06:55:08PM +0400, Anton K. wrote:

file - that means file is broken.
Are you making sure the flow graph is terminated correctly? If you
simply kill the flow graph, the WAV block has no chance to write a
correct file header. This happens in the block destructor, or when you
call close().
If you can’t do that, you must use gr_file_sink.

MB

-rw-rw-r-- 1 anton anton 24M сент. 27 00:46 freq2.wav

Precision : 8-bit
signal source for further tests.
Kaiserstraße 12


Discuss-gnuradio mailing list
removed_email_address@domain.invalid
Discuss-gnuradio Info Page


Discuss-gnuradio mailing list
removed_email_address@domain.invalid
Discuss-gnuradio Info Page


Karlsruhe Institute of Technology (KIT)
Communications Engineering Lab (CEL)

Dipl.-Ing. Martin B.
Research Associate

Kaiserstraße 12
Building 05.01
76131 Karlsruhe

Phone: +49 721 608-43790
Fax: +49 721 608-46071
www.cel.kit.edu

KIT – University of the State of Baden-Württemberg and
National Laboratory of the Helmholtz Association

Martin,
actually no, i am not sure.
i am just pushing stop button in gnuradio companion.

from grc perspective view, what method is supposed to be used for
graceful script termination?

On Thu, Sep 27, 2012 at 7:07 PM, Martin B. (CEL)

I recall running into this issue myself now, with multimode and
simple_fm_rcv.

What I do in those two apps is that when I turn “off”
recording, I change the wavfile filename to /dev/null, which causes a
formal cleanup-and-close of the previous file.

On 27 Sep 2012 11:13,
Anton K. wrote:

Martin,
actually no, i am not sure.
i am
just pushing stop button in gnuradio companion.

from grc
perspective view, what method is supposed to be used for
graceful
script termination?

So it can programmed with GRC, or i supposed to make some stuff in
python script?

Ok i see.

And, if i want to run script from shell to record audio files and
rotate them every hour, how to make start/stop recording procedure in
this case?

On 27 Sep 2012 11:28, Anton K. wrote:

So it can programmed
with GRC, or i supposed to make some stuff in
python script?

On
Thu, Sep 27, 2012 at 7:17 PM, removed_email_address@domain.invalid wrote:

I recall
running into this issue myself now, with multimode and simple_fm_rcv.
What I do in those two apps is that when I turn “off” recording, I
change the wavfile filename to /dev/null, which causes a formal
cleanup-and-close of the previous file. On 27 Sep 2012 11:13, Anton
Komarov wrote: Martin, actually no, i am not sure. i am just pushing
stop button in gnuradio companion. from grc perspective view, what
method is supposed to be used for graceful script termination? O
_______________________________________________ Discuss-gnuradio mailing
list removed_email_address@domain.invalid [1]
Discuss-gnuradio Info Page [2]

Use a
conditional expression in the “filename” field of the wavefile sink, and
then have a “checkbox” control to control recording. Make the expression
conditional on the state of the checkbox, and if “recording” isn’t
checked, make the file /dev/null, otherwise make it the file you want.

Links:

Ok, tried with selector and check box.
I started script, check box appeared, i cheched it and recording to
wav file started.
Wait a bit and unchecked it, got file 2.7 Mbytes, not growing more,
then stopped the script.
FIle is corrupted.

Here is links on my grc scheme - http://db.tt/ACl4nLNy and wav file i
got - http://db.tt/87PIVwCy

Any help will be appreciated, i dont believe wav sink is so buggy…

On 27 Sep 2012 11:58, Anton K. wrote:

Ok i see.

And,
if i want to run script from shell to record audio files and
rotate
them every hour, how to make start/stop recording procedure in
this
case?

On Thu, Sep 27, 2012 at 7:31 PM, removed_email_address@domain.invalid wrote:

On 27 Sep 2012 11:28, Anton K. wrote: So it can programmed with
GRC, or i supposed to make some stuff in python script? On Thu, Sep 27,
2012 at 7:17 PM, <removed_email_address@domain.invalid [1]> wrote: I recall running into
this issue myself now, with multimode and simple_fm_rcv. What I do in
those two apps is that when I turn “off” recording, I change the wavfile
filename to /dev/null, which causes a formal cleanup-and-close of the
previous file. On 27 Sep 2012 11:13, Anton K. wrote: Martin,
actually no, i am not sure. i am just pushing stop button in gnuradio
companion. from grc perspective view, what method is supposed to be used
for graceful script termination? O
_______________________________________________ Discuss-gnuradio mailing
list removed_email_address@domain.invalid [2]
Discuss-gnuradio Info Page [3] Use a
conditional expression in the “filename” field of the wavefile sink, and
then have a “checkbox” control to control recording. Make the expression
conditional on the state of the checkbox, and if “recording” isn’t
checked, make the file /dev/null, otherwise make it the file you want.
_______________________________________________ Discuss-gnuradio mailing
list removed_email_address@domain.invalid [4]
Discuss-gnuradio Info Page [5]

You can use
the XMLRPC server that GRC provides to change any flow-graph variables
you want from outside.

Links:

[1]
mailto:removed_email_address@domain.invalid
[2] mailto:removed_email_address@domain.invalid
[3]
Discuss-gnuradio Info Page
[4]
mailto:removed_email_address@domain.invalid
[5]
Discuss-gnuradio Info Page

Ok, tried with selector and check box.
I started script, check box appeared, i cheched it and recording to
wav file started.
Wait a bit and unchecked it, got file 2.7 Mbytes, not growing more,
then stopped the script.
FIle is corrupted.

Looked at your flow-graph.

You have to make the filename on the WAV sink change depending on
recording/not-recording.

Just use a conditional expression as the filename parameter in the
filename sink

“myfile” if recording_on else “/dev/null”


Marcus L.
Principal Investigator
Shirleys Bay Radio Astronomy Consortium

ok! with conditional filename works like a charm!
thank you very much!
sorry that i did get for the first time :wink:

Hi, I know its an old thread but supper grateful for finding this and just wanted to add comments from my windows environment not sure why, but had a bit of a mare getting to it work especially around string vs. quotes vs nul value, etc.

I created a ‘QT GUI Checkbox’ called recording_on. I set the type to string. I set the default and false values to “C:\xxxx\rubbish.wav” (without the quotes and with a proper folder structure and the true value to “C:\xxxx\rf_file.wav” (without the quotes and with a proper folder". Then just set the filename property in the “Wav File Sync” to “recording_on” (without the quotes)…

Thanks All!

I recall running into this subject myself, with multimode and simple_fm_rcv. What I do in those two apps is that when I turn “off” recording, I changed the wav-file filename to /dev/null, which causes a formal cleanup-and-close of the previous file.