multifilesrc looping 24bit corrupted data on loop

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

multifilesrc looping 24bit corrupted data on loop

Nick_law
Hi guys,
I am finding that looping specifically a 24bit .wav file with multifilesrc
creates corrupted data seemingly every second loop.

I generate a 24bit wav with the following:

gst-launch-1.0 interleave name=i \
audiotestsrc num-buffers=100 wave=0 freq=100 volume=0.4 ! \
audio/x-raw,channels=1 ! tee name=t1 \
audiotestsrc num-buffers=100 wave=2 freq=100 volume=0.4 ! \
audio/x-raw,channels=1 ! tee name=t2 t1. ! queue ! i. t2. ! queue ! \
i. i.src ! audioconvert ! audio/x-raw,format=S24BE ! audioconvert ! wavenc !
filesink location=testin.wav

Which will generate the testin.wav file

I then try play out and loop this file to a new .wav with the following:

gst-launch-1.0 interleave name=i ! \
audioconvert ! audio/x-raw,format=S24BE ! audioconvert ! wavenc ! filesink
location=testout.wav \
multifilesrc num-buffers=600 location=testin.wav loop=true ! wavparse
ignore-length=1 ! \
deinterleave name=d0 d0.src_0 ! audioconvert ! volume volume=1 ! queue ! \
i.sink_0 d0.src_1 ! audioconvert ! volume volume=1 ! queue ! i.sink_1

I then open testout.wav in audacity and can see the first loop looks ok but
then the second loop is corrupted but then the 3rd loop looks OK again.

Looping 16bit and 32bit seems to work with a small glitch on each loop.

All I really want is to loop a .wav (16bit,24bit and 32bit) without pauses
between loops.

Any help would be greatly appreaciated.
Nick




--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: multifilesrc looping 24bit corrupted data on loop

Nick_law
I did some digging and found some stuff out.

If you open the testin.wav with a normal editor (like gedit). You are able
to see the ascii headers for the wav chunks.
I noticed that after the data chunk there were two other ascii headers, LIST
and INFO.

My thinking is because I use "wavparse ignore-length=1"
The LIST and INFO headers get included in the data chunk and that for 24bit
those additional bytes are not
byte aligned and so shift the data thereby corrupting it. This is why after
a few loops it can output correctly as it it eventually shifts back to
correct alignment. I think this is also why for 16 and 32bit, there seems to
be a few glitches when looping, because the headers after data chunk are
included?

If I don't use ignore-length=1 , the file doesn't loop at all and plays out
only once.  

Is there some expert out there than can confirm my findings? And if so, I'm
guessing there is no way around this.

I have found a potential solution that I will post in another reply. But
there are still data glitches between loops but it at least still recovers.  

regards Nick



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: multifilesrc looping 24bit corrupted data on loop

Nick_law
I will post my workaround for 24bit file looping.

multifilesrc Reads buffers from sequentially named files. So the idea is to
add a 32bit silent(zero) data wav file that is very short with the same name
(with an index appended) as the actual file you want to loop.
This will then mean the intended file will be played out, a few zero samples
will be appended from the 2nd file that will byte align the data and then
the intended file will loop again. BUT there will be glitches in audio
between each file but unsure if I can get around that.

First I generate a 24bit .wav file. But obviously a previously generated
file can be used.

gst-launch-1.0 interleave name=i \
audiotestsrc num-buffers=2 wave=0 freq=100 volume=0.4 ! \
audio/x-raw,channels=1 ! tee name=t1 \
audiotestsrc num-buffers=2 wave=2 freq=100 volume=0.4 ! \
audio/x-raw,channels=1 ! tee name=t2 \
t1. ! queue ! i. \
t2. ! queue ! i. \
i.src ! audioconvert ! audio/x-raw,format=S24BE ! audioconvert ! wavenc !
filesink location=testin.0.wav

Then a silent 32bit wav is generated with the same name(index appended) and
with samplesperbuffer=1 num-buffers=1.

gst-launch-1.0 interleave name=i \
audiotestsrc samplesperbuffer=1 num-buffers=1 wave=4 freq=100 volume=0.4 ! \
audio/x-raw,channels=1 ! tee name=t1 \
audiotestsrc samplesperbuffer=1 num-buffers=1 wave=4 freq=100 volume=0.4 ! \
audio/x-raw,channels=1 ! tee name=t2 \
t1. ! queue ! i. \
t2. ! queue ! i. \
i.src ! audioconvert ! audio/x-raw,format=S32BE ! audioconvert ! wavenc !
filesink location=testin.1.wav

Then finally the file playout with looping:

gst-launch-1.0 interleave name=i ! \
audioconvert ! wavenc ! filesink location=testout.wav \
multifilesrc num-buffers=60 location=testin.%01d.wav index=0 loop=true ! \
wavparse ignore-length=1 ! deinterleave name=d0 \
d0.src_0 ! audioconvert ! volume volume=1 ! queue ! i.sink_0 \
d0.src_1 ! audioconvert ! volume volume=1 ! queue ! i.sink_1


Not sure if this will help anyone but me. Or if anyone has a better
solution?

kind regards
Nick


Nick_law wrote
> I have found a potential solution that I will post in another reply. But
> there are still data glitches between loops but it at least still
> recovers.  





--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel