How do I purposely delay an audio streaming?
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
How do I purposely delay an audio streaming?
Hello there!
I use my smartphone as a webcam with DroidCam. The video is slightly delayed.
Since the video is slightly delayed while my sound input (not through DroidCam) is not delayed, audio and video are not in sync.
How do I set things so that the sound input is also delayed as much as the video is delayed?
I played with "Latency offset" in pavucontrol, thinking it was the trick, but it doesn't change a thing.
I use my smartphone as a webcam with DroidCam. The video is slightly delayed.
Since the video is slightly delayed while my sound input (not through DroidCam) is not delayed, audio and video are not in sync.
How do I set things so that the sound input is also delayed as much as the video is delayed?
I played with "Latency offset" in pavucontrol, thinking it was the trick, but it doesn't change a thing.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Re: How do I purposely delay an audio streaming?
I'd like to add latency to the microphone so that the audio input is in sync with a lagging webcam.
Configuring latency offset on pavucontrol doesn't work. Then, I types two lines in the terminal:
After I type the first line, the terminal indicates a number. After I run the second line, it says
Also, /etc/pulse/client.conf only has comment lines (starting with ; or #). Is it normal?
Configuring latency offset on pavucontrol doesn't work. Then, I types two lines in the terminal:
Code: Select all
pactl load-module module-null-sink sink_name=delayed
pactl load-module module-loopback latency_msec=2000 source=delayed.monitor sink=alsa_output.pci-0000_00_1b.0.analog-stereo
Failure: Module initialization failed
Also, /etc/pulse/client.conf only has comment lines (starting with ; or #). Is it normal?
Re: How do I purposely delay an audio streaming?
Hi Tobari,
Yes, client.conf is normal. They are showing the defaults, so if you want to change them, you remove the semicolon and space at the beginning of the line you are changing. You then need to run
I have no experience at all with what you're trying to do, but your idea seems like the right one to me.
Yes, client.conf is normal. They are showing the defaults, so if you want to change them, you remove the semicolon and space at the beginning of the line you are changing. You then need to run
pulseaudio -k
in the terminal to restart the sound daemon or reboot for the change to take effect.I have no experience at all with what you're trying to do, but your idea seems like the right one to me.
Re: How do I purposely delay an audio streaming?
Thanks for the encouragement!
In fact, if I understand correctly,
But it's not what I want. What I want is for my mic in Zoom (or Skype, or whatever) to be delayed.
Do you know a command line to do that?
Do you have any suggestion?
In fact, if I understand correctly,
pactl load-module module-loopback
is to hear myself in realm time. I got it to work this way.But it's not what I want. What I want is for my mic in Zoom (or Skype, or whatever) to be delayed.
Do you know a command line to do that?
Do you have any suggestion?
Re: How do I purposely delay an audio streaming?
I do not know how to do something like that. The issue is the two different devices each have their own latencies, and obviously they aren't in sync.
If I get any free time this weekend I'll see if I can find anything that might be helpful.
If I get any free time this weekend I'll see if I can find anything that might be helpful.
Re: How do I purposely delay an audio streaming?
Thank you, MrEen!
For today, I'll teach with both audio and video from droidcam. This way, both will be in sync, but the sound is a little trashy. It's better than nothing. If I plug my mic on the computer, the sound is better, but it arrives before the slightly delayed video from droidcam.
So, my ideal solution would be to have a good sound intentionally delayed to be in sync with the video. If that makes sense.
Re: How do I purposely delay an audio streaming?
Not having much luck yet, but I have an idea that we can test.
Install (if necessary) and run PulseAudio Volume Control (pavucontrol) and on the Input Devices tab click on Advanced under the mic you want to delay. Try 2000 there for Latency offset. If it makes no difference, run pulseaudio -k and try again. And if the sound gets even further ahead of the video, try -2000.
It sounds like this is what might be needed, but it doesn't seem to have worked for anyone that I could find. But one person did have them get further out of sync, so it must have done something.
If the above doesn't do anything at all with both 2000 and -2000, I don't know what else to try. If one of them has any sort of impact, even in the wrong direction, maybe we can do some more tweaking to get it right.
Install (if necessary) and run PulseAudio Volume Control (pavucontrol) and on the Input Devices tab click on Advanced under the mic you want to delay. Try 2000 there for Latency offset. If it makes no difference, run pulseaudio -k and try again. And if the sound gets even further ahead of the video, try -2000.
It sounds like this is what might be needed, but it doesn't seem to have worked for anyone that I could find. But one person did have them get further out of sync, so it must have done something.
If the above doesn't do anything at all with both 2000 and -2000, I don't know what else to try. If one of them has any sort of impact, even in the wrong direction, maybe we can do some more tweaking to get it right.
Re: How do I purposely delay an audio streaming?
Thank you for your time!
Unfortunately, it doesn't work. I've tried it already and came to the same conclusion.
I vaguely remember reading somewhere that such settings in Pavucontrol don't take effect because there is another piece of software (possibly ALSA) that overrides Pavucontrol. Can that be the case?
Unfortunately, it doesn't work. I've tried it already and came to the same conclusion.
I vaguely remember reading somewhere that such settings in Pavucontrol don't take effect because there is another piece of software (possibly ALSA) that overrides Pavucontrol. Can that be the case?
Re: How do I purposely delay an audio streaming?
Well ALSA is pretty vanilla. PulseAudio is where things like latency can be tweaked.
Please realize my specialty is getting sound working properly, not mucking it up!
I suspect you're going to need a LADSPA plugin to accomplish this but I don't know if you can use them successfully without using JACK. Either way, I can't offer much help on that. This is getting into advanced territory that I stopped playing with a couple of years ago. You might have better luck asking on linuxmusicians.com as the people there actually use this stuff. I tried searching for answers there, but their search is even worse than the one on the this forum.
Please realize my specialty is getting sound working properly, not mucking it up!
I suspect you're going to need a LADSPA plugin to accomplish this but I don't know if you can use them successfully without using JACK. Either way, I can't offer much help on that. This is getting into advanced territory that I stopped playing with a couple of years ago. You might have better luck asking on linuxmusicians.com as the people there actually use this stuff. I tried searching for answers there, but their search is even worse than the one on the this forum.
Re: How do I purposely delay an audio streaming?
Thanks for your help.
I still have a question, then. Do you that if I buy an actual camera and plug my Rode mic on the camera, the video will not lag and the sound and the video will be in sync?
All this issue is due to the lagging video with droidcam. I tested other soft, such as iriun: the video was not lagging, and therefore the sound was in sync even when it was not connected to the phone, but the video quality was poorer.
So far, my understanding is: with turning a smartphone into a webcam, the better the quality video, the more lag. I assume there is no such problem with an actual camera, since it has its own software.
I still have a question, then. Do you that if I buy an actual camera and plug my Rode mic on the camera, the video will not lag and the sound and the video will be in sync?
All this issue is due to the lagging video with droidcam. I tested other soft, such as iriun: the video was not lagging, and therefore the sound was in sync even when it was not connected to the phone, but the video quality was poorer.
So far, my understanding is: with turning a smartphone into a webcam, the better the quality video, the more lag. I assume there is no such problem with an actual camera, since it has its own software.
Re: How do I purposely delay an audio streaming?
Assuming the mic can plug into the camera, I would assume there'd be no lag as they would be sharing the same connection to the computer. Mind you, I have no experience with something like this.
Re: How do I purposely delay an audio streaming?
Thanks for your assistance,
You helped me a great deal.
I've just managed to delay the sound input with OBS Studio. It's a proper way of mucking it up.
You helped me a great deal.
I've just managed to delay the sound input with OBS Studio. It's a proper way of mucking it up.
Re: How do I purposely delay an audio streaming?
LOL!
One thing I should mention. While you're mucking about, you may confuse PulseAudio from time to time. For example, when you want mic input to be normal, it may be messed up somehow. Deleting the files in /home/YourUserName/.config/pulse then running
pulseaudio -k
in the terminal should clear it up again. This is a somewhat common need for people that keep changing things sound-wise.Re: How do I purposely delay an audio streaming?
Thank you! I'll keep that in mind.MrEen wrote: ⤴Mon Feb 22, 2021 10:22 pmLOL!
One thing I should mention. While you're mucking about, you may confuse PulseAudio from time to time. For example, when you want mic input to be normal, it may be messed up somehow. Deleting the files in /home/YourUserName/.config/pulse then runningpulseaudio -k
in the terminal should clear it up again. This is a somewhat common need for people that keep changing things sound-wise.
Anyway, I had a false joy. OBS still doesn't work with zoom and I gave up. So normally I won't need to kill pulseaudio.
Re: How do I purposely delay an audio streaming?
I made myself a useful script for this and would like to share it here, because this posting is what got me on the way. I am not a Mint user but I hope the script will not depend on the distro. Details and code at https://superuser.com/a/1661554/1459918.