Re: [linux-audio-dev] 24 bits, 2's complement - help!

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

Subject: Re: [linux-audio-dev] 24 bits, 2's complement - help!
From: David Olofson (audiality_AT_swipnet.se)
Date: ma tammi  17 2000 - 22:29:31 EST


On Mon, 17 Jan 2000, Juhana Sadeharju wrote:
> >From: Benno Senoner <sbenno_AT_gardena.net>
> >
> >yea, an opensource dithering/shaping library would be great,
>
> Sonic Flow has an initiative for such library. They don't have patented
> higher order shapers but it is a good start.
>
> >But explain me please why tables are a no-no ?
> >if you generate a few secs of white noise, and let the noise play in a loop,
> >you can't almost not detect that there is a loop, you should hear
>
> Reading memory is slower than such simple computations.
> And, you get a longer period with random number generators.
>
> You mention the /dev/urandom. Has it been tested in any way? How good it is?
> It might work ok if we need a random number once in a few seconds but
> because we need it at very fast rates (even several multiples of sampling
> rate!) it may fail badly.

The noise sounds just fine if I

        cat /dev/urandom | myplay

where myplay plays raw input data at 44100 kHz, 16 bit stereo, but if
I start skipping samples (by piping through another little hack), the
CPU is overloaded, and the audio drops out.

However, when using the random() func in yet another hack;

----8<-----------------------
main()
{
   int i;
   sample s[1024];
   for(;;) {
      for(i = 0; i<1024; i++) {
         s[i].left = random();
         s[i].right = random();
      }
      fwrite(&s,sizeof(sample)*1024,1,stdout);
   }
}
----------------------->8----

(replacing cat here), I can do the same thing and get enough 16 bit
stereo noise for more than 45 times the 44.1 kHz sample rate, in real
time...

Writing the noise from that hack to disk gave me 7.8 MB/s of high
quality noise, 95% CPU load. (Celeron 333) cating from /dev/urandom
gives 0.20 MB/s on the same machine.

//David

.- M u C o S -------------------. .- A u d i a l i t y ----------------.
| A Free/Open Multimedia | | Rock Solid, Hard Real Time, |
| Plugin & Integration Standard | | Low Latency Signal Processing |
`------> www.linuxdj.com/mucos -' `--> www.angelfire.com/or/audiality -'
.- D a v i d O l o f s o n ------------------------------------------.
| Audio Hacker, Linux Advocate, Open Source Advocate, Singer/Composer |
`----------------------------------------------> audiality_AT_swipnet.se -'


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

This archive was generated by hypermail 2b28 : pe maalis 10 2000 - 07:23:26 EST