[vorbis] Ogg ouput using libvorbisfile

David St.Clair dstclair at cs.wcu.edu
Sun Jul 27 15:29:33 PDT 2003



Actually, doing a cat file.wav > /dev/dsp plays fine (just a low
bitrate.)  The sound I'm getting is distorted.  The sound I'm getting is
something like the sound you get when doing cat file.ogg >/dev/dsp
(ugly)   (This is with fwrite())

I tried setting ioctl()s (opening /dev/dsp with open()) and using
write() instead of fwrite() and I get a decoded ogg output, but after
about 11 seconds it starts to choke and it seems like it's not
buffered.  Don't know what's going on.  Any ideas?
  

<code>

while(!eof){
    long ret=ov_read(vf,pcmout,sizeof(pcmout),0,2,1,&current_section);
                                //fprintf(stderr,"Reading\n");
    if (ret == 0) {
      /* EOF */
      eof=1;
    } else if (ret < 0) {
      /* error in the stream.  Not a problem, just reporting it in
         case we (the app) cares.  In this case, we don't. */
    } else {
//      fwrite(pcmout,1,ret,dspdev);
                write(fd,pcmout,4096);  /*works partially*/
    }
  }
</code>


-- 
David St.Clair <dstclair at cs.wcu.edu>

<p><p>On Sun, 2003-07-27 at 14:29, Tom Felker wrote:
> On Sunday 27 July 2003 12:48 pm, David St.Clair wrote:
> > Hi, I'm new to writing any kind of sound program and somewhat new to C.
> > I am on linux and I've been trying to get the example code
> > (http://www.xiph.org/ogg/vorbis/doc/vorbisfile/example.html)for the
> > decoder using libvorbisfile to work.  I think my main problem is output
> > to /dev/dsp.  If I use the example where the only change I made were to
> > open a file instead of using stdin and I ouput to /dev/dsp after opening
> > it, I get a weird static noise.
> >
> > Any idea what I'm doing wrong or not doing?
> 
> >       /* we don't bother dealing with sample rate changes, etc, but
> > 	 you'll have to*/
> >       fwrite(pcmout,1,ret,dspdev);
> 
> /dev/dsp probably defaults to some weird sample size and rate, so you'll need 
> to do some ioctl()s on it before you write to it.  I'm guessing the noise you 
> hear is similar to the noise from "cat file.wav > /dev/dsp".

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.




More information about the Vorbis mailing list