Re: [linux-audio-dev] orphans

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-dev] orphans
From: Benno Senoner (sbenno_AT_gardena.net)
Date: Fri Mar 31 2000 - 09:32:16 EEST


On Thu, 30 Mar 2000, Paul Winkler wrote:
> Erik Steffl wrote:
> >
> > Paul Winkler wrote:
> > ...
> > > But I still use DAP for three things I haven't found in Snd:
> > >
> > > 1) Comprehensive loop editing
> >
> > there is one problem that I had with DAP - the display of the wave is
> > in no way related to the sound - I mean in some other audio editors you
> > can corelate the picture and sound, in DAP i was completely lost - makes
> > it hard to find the right spot in the sample (which is often beginning
> > of some louder sound or quiet spot)... anybody else have the same
> > problem?
>
> If you mean the horrible glitch where you don't hear the first
> half-second of what you're trying to play, yep, I hate it.
> I've had to add silence at the beginning of samples to work around
> this. Yuck.

I don't know anything about the program, but I think that is due to the author
not pre-filling the DAC with data.

(after a sound start, the soundcard plays faster (there are zero bytes in
buffer and the soundcards immediately wants 170KByte/sec) than the application
can fill the buffer with data, therefore you hear this initial glitch.

As you saw adding silence at the beginning of the file helped, therfore it's
easy to add this silence in the application.

just search for the functions which starts the playing, and add a statement
like this:
write(audio_fd, my_silence_buffer, sizeof(my_silence_buffer))

just before the real playback is started.

the silence_buffer should be 16-64Kbytes in order to give the application
100-400 msecs to fil the DAC with the playback data, without initial glitches.

In case you do this, let me know if it helps. Notice that the start is hereby
 delayed by these 100-400 msecs, if you need instant-play and no glitches,
then the application has to be a little smarter:
It needs to:
- open the soundcard
- stop playback
- pre-fill the audio buffer with real data, not zeroes
- when you press play, PCM playback on the card is activated, and
   then normal buffer refilling occurs

In theory all applications should be designed that way, but it looks that
most programmers are too lazy.

Benno.

 


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Fri Mar 31 2000 - 21:15:20 EEST