Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 13 Aug 2004 10:11:19 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        Peter Wood <peter@alastria.net>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: FreeBSD pcm(4) latency (From write() to audible output)
Message-ID:  <20040813151119.GE4198@dan.emsphone.com>
In-Reply-To: <411CC1EF.5090201@alastria.net>
References:  <411CC1EF.5090201@alastria.net>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Aug 13), Peter Wood said:
> I'm currently in the middle of writing an automated radio playout
> system for a northern student radio station in the UK (post SBN
> liquidation).
> 
> I have the requirement of it running on a *nix system. I'm a large
> BSD advocate between our friends, so would prefer not to use Linux.
> 
> The system design consists of a daemon for each soundcard used in the
> studio. I'm currently in the process of writing this daemon.
> 
> I've found that there is about a 800ms delay between the output data
> being written to /dev/dsp and being able to hear the output from the
> soundcard on FreeBSD. I'm working to a 200ms deadline.
> 
> I'm opening the soundcard with:
> 
> audio_fd = open((char *) device, O_WRONLY | O_FSYNC | O_DIRECT);
> 
> I've used O_DIRECT and O_FSYNC to try and get rid of this delay, but
> alas that didn't work, device is cast as it's coming from a void *
> (thanks to pthread_create ;).

What's your write size?  At 44100khz*2 channels, a 65k write would take
around 800 ms to play.  Try writing smaller chunks, or maybe raise
hw.snd.targetirqrate.

-- 
	Dan Nelson
	dnelson@allantgroup.com



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040813151119.GE4198>