Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Audio recording (using ossaudio)

Dear nia,

On 2020-03-13, nia wrote:
> On Tue, Mar 10, 2020 at 08:49:55PM +0200, Yorick Hardy wrote:
> > Can anyone else record audio correctly via ossaudio?
> > audiorecord seems to work as long as the frequency
> > divides the native frequency (see dmesg excerpt below)
> (I missed this post, but got contacted about it directly off-list. I'm
> probably a good person to contact about this sort of thing).

Thanks, I watched your recent talk :-)

> The sample rate and number of channels need to exactly match the device
> for ideal output.

Right, but I think it should not be a problem if it is different
(subject to some quality loss) because of the new audio system?
> The ffmpeg OSS code looks very primitive. I might be persuaded to write
> a backend that does detection of device characteristics. It's basically
> required for proper audio recording on NetBSD. Note that our OSS emulation
> doesn't match the spec exactly, and is also undocumented, so doing anything
> non-trivial is hard. I don't recommend writing new code that uses it for
> that reason.

You are correct. I threw together a NetBSD audio driver based on the oss
driver, but it had exactly the same problem. Strangely, I have been unable to
reproduce the problem on an old i386 netbook (so far).

I wrote a test program to try and reproduce what ffmpeg is doing, and
(I am not sure yet) it seems like non-blocking reads is causing the
distortion. The same test program with blocking reads seems to work

I will look into it a bit more, and then report back.

> Out of curiosity, does Audacity work for you (when set to single channel
> 16-bit PCM, etc - it defaults to 32-bit floats which won't work).

I am building it ... my computer is quite old! I will report back
once I have tried it out.

Kind regards,

Yorick Hardy

Home | Main Index | Thread Index | Old Index