Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Frame Duration #194

Open
encrxpted opened this issue Jun 30, 2022 · 8 comments
Open

Frame Duration #194

encrxpted opened this issue Jun 30, 2022 · 8 comments

Comments

@encrxpted
Copy link

Hi, is there any way to control the length of each frame that is sent to the audio rostopic? I am trying to integrate ROS with WebRTCVAD, which only accepts frames of 10, 20, or 30ms. Thanks!

@knorth55
Copy link
Member

knorth55 commented Jul 1, 2022

can you try throttle node to stabilize the topic frame rate?
http://wiki.ros.org/topic_tools/throttle

@encrxpted
Copy link
Author

can you try throttle node to stabilize the topic frame rate? http://wiki.ros.org/topic_tools/throttle

I think that throttle will still send over the same messages, right? Won't each frame will still be the wrong duration since throttle just republishes the ros messages?

@knorth55
Copy link
Member

knorth55 commented Jul 2, 2022

yes, but if /audio topic ha s higher frequency, it is worth trying.
but the sound may not be continuous.
if you are talking about audio_capture node, the frequency of the node loop is controlled by gstreamer, and we currently don't support the frequency change.

@encrxpted
Copy link
Author

Then is there any way for me to "resize" the chunks after I receive the audio data?

@knorth55
Copy link
Member

knorth55 commented Jul 5, 2022

currently no. we need to implement it.

@encrxpted
Copy link
Author

currently no. we need to implement it.

Is there any way I could accurately implement something like this:
Say that the size of each chunk needs to be n bytes. Could I receive the audio data, and once there are n bytes received, send those n bytes to be processed by WebRTCVAD. Then, I'll do this to the next n bytes I receive and so on, basically just splicing the bytes objects that I receive.

@encrxpted
Copy link
Author

Adding to the above:
We are able to bag the audio data and save it as a wav file. Plus, I am able to take audio data from a wav file, splice it into the chunk sizes I need, and successfully use the VAD library to process those chunks. Thus, I know that you can certainly "resize" the chunks via the wav file. My question now is, how can I directly just change the chunk size of the audio data when I receive enough bytes?

@knorth55
Copy link
Member

knorth55 commented Jul 6, 2022

I have no idea, sorry.
I think just concatenating several topics is enough, but I'm not sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants