OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 2:43 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Audio click/pop sound due to scheduling
PostPosted: Sat Jul 16, 2022 7:41 am 
Offline
Member
Member

Joined: Fri Nov 01, 2019 1:17 am
Posts: 95
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...


Top
 Profile  
 
 Post subject: Re: Audio click/pop sound due to scheduling
PostPosted: Sat Jul 16, 2022 2:50 pm 
Offline
Member
Member

Joined: Mon Mar 25, 2013 7:01 pm
Posts: 5100
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.)


Top
 Profile  
 
 Post subject: Re: Audio click/pop sound due to scheduling
PostPosted: Sun Jul 17, 2022 3:15 am 
Offline
Member
Member

Joined: Mon Dec 07, 2020 8:09 am
Posts: 212
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:

Quote:
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.


Top
 Profile  
 
 Post subject: Re: Audio click/pop sound due to scheduling
PostPosted: Sun Jul 17, 2022 4:45 am 
Offline
Member
Member

Joined: Fri Nov 01, 2019 1:17 am
Posts: 95
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..


Top
 Profile  
 
 Post subject: Re: Audio click/pop sound due to scheduling
PostPosted: Mon Jul 18, 2022 2:50 pm 
Offline
Member
Member

Joined: Fri Nov 01, 2019 1:17 am
Posts: 95
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..


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Majestic-12 [Bot], MichaelPetch, SemrushBot [Bot] and 74 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group