By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,281 Members | 2,201 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,281 IT Pros & Developers. It's quick & easy.

Audio input buffering with ossaudiodev

msewing
P: 5
I'm running 2.5.1 on Fedora 8 (2.6.23.9-85.fc8) with the following soundcards:

Ensoniq ES1370 [AudioPCI] (rev 01)
VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 50)

I'm working on a real-time spectrum analysis program (for ham radio) using ossaudiodev, which seems to be working but with one problem. There is excessive buffering delay between electrical signal input and availability to ossaudiodev.read(). The lower the sample rate, the worse the problem, so there seems to be a fixed size buffer. (My application only needs 8 kHz sampling.)

So, my questions:

-Is there a way to reduce the buffering delay? It's ok if I skip some input samples, although I'd rather not. Using reset() doesn't seem to help. Using 44.1 kHz sampling helps, but it's not as good as I'd like.

-Should I be looking at the alsa interface, or some other alternative? I'd prefer to stay with Python rather than diving down into C programming.

-Is there a better forum for this issue?

TIA!

Martin
Jan 27 '08 #1
Share this Question
Share on Google+
1 Reply


msewing
P: 5
Answering myself, more or less:

You can apparently minimize the OSS delay in Python just by reading samples as fast as possible, keeping the buffer almost empty. Anyway, it worked for me. It may help to use the fastest possible sample rates.

The OSS manual says there are advanced functions that allow you to control the buffer and "frag" size, but these are apparently not exposed by Python's ossaudiodev. You'd have to do it in a special C routine. It would be good for the soul to do that, but more work than I need right now...
Jan 31 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.