Audio click/pop sound due to scheduling

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
Kamal123
Member
Member
Posts: 99
Joined: Fri Nov 01, 2019 1:17 am

Audio click/pop sound due to scheduling

Post by Kamal123 »

Hi,
I have been working on audio in my os.. currently I am using Intel HD audio...it plays sound without any problem before scheduler runs.. but after the scheduler is initialised and task switching is going on, it produces pop/click sound when cyclic buffer reach its beginning..

is there any special scheduling algorithm for sound? What can be the problem?

My rep :https://github.com/manaskamal/aurora-xeneva

Thanks in advance...
Octocontrabass
Member
Member
Posts: 5563
Joined: Mon Mar 25, 2013 7:01 pm

Re: Audio click/pop sound due to scheduling

Post by Octocontrabass »

Did you get interrupts working?

Are you waiting until the buffer is completely empty before you refill it, or are you refilling it before it reaches that point?

Is the buffer big enough to absorb your latency? The buffer needs to be big enough that you can respond to the IRQ and refill it before it completely empties. (But a bigger buffer also increases the audio delay, so you have to find a good balance.)
xeyes
Member
Member
Posts: 212
Joined: Mon Dec 07, 2020 8:09 am

Re: Audio click/pop sound due to scheduling

Post by xeyes »

If HDA only pops rather than plays a small piece of audio repeatedly, it may not be an under-run due to the userspace app not being able to keep up, but rather that the buffer updating process isn't happening correctly for certain cases.



IMO you don't have to have interrupts to get it to work well.

You can choose to dedicate a core for HDA and let the driver spin on it polling the card and software queues.

Other core(s) can build "software defined descriptor packets" and send them over to the driver core for service.

This should give you very low latency between the card and the driver, at the cost of CPU cycles. It seems quite suitable for the current situation:
Multiprocessor support (multiprocessor scheduler not ready!!)
Later, you'd have to decide whether audio is important enough to always have a dedicated core servicing it though.
Kamal123
Member
Member
Posts: 99
Joined: Fri Nov 01, 2019 1:17 am

Re: Audio click/pop sound due to scheduling

Post by Kamal123 »

Hi,
I have interrupts working very well , I use msi for hda.. my hda driver has ioc after completion of every buffer which request sound system for already available audio data.......

also i faced an issue, even if my output converters are not configured... running the output stream gives output...and the pop click sound occurs in left speaker only.. I think I am failing to configure the pins and output converters properly..
Kamal123
Member
Member
Posts: 99
Joined: Fri Nov 01, 2019 1:17 am

Re: Audio click/pop sound due to scheduling

Post by Kamal123 »

Hi,

Finally I came to know the problem and I fixed it...it was due bdl_size*buffer_size crossing 4k page..it should be bdl_size*buffer_size = 4096..

Also I fixed all output path configuration bugs.. Now pins, mixer & DACs are initialised properly..

https://github.com/manaskamal/aurora-xeneva

Thank you everyone for your replies,
Manas Kamal..
Post Reply