Thanks for the answer. So data are stored in little-endian format on the WAVE file. But have I to encode in big endian format or little endian is ok?! Thanks ---------- Original Message ---------------------------------- From: "John Miles" <jmiles@pop.net> Date: Tue, 23 May 2006 12:15:05 -0700>You are probably reading little-endian samples on a big-endian platform, and >failing to flip the byte order. By convention, PCM samples are generally >little-endian words, and the effect of playing them with the wrong byte >order is just what you describe hearing, with the expected sound buried >under 8 bits' worth of random-sounding noise. > >-- john > > >> >> Hi, >> I'm trying to encode a raw audio file with speex. No problem if I >> normally decode it (as done in the samplenc.c, for example). >> But if I separate odd and even samples and I try to encode >> separately these two files (one is [odd odd odd odd..], the other >> [even even even even..], then when I decode and I join the >> samples in one file [odd even odd even odd even..] I heard a >> terrible white noise, and the voice in background very weak. >> Does anyone know the reason? >> Thanks >> _______________________________________________ >> Speex-dev mailing list >> Speex-dev@xiph.org >> http://lists.xiph.org/mailman/listinfo/speex-dev >> > >_______________________________________________ >Speex-dev mailing list >Speex-dev@xiph.org >http://lists.xiph.org/mailman/listinfo/speex-dev >___________________________________________________________________ >Quipo Free Internet - 2 email, 150 Mb di spazio web e molto di pi?. >ADSL, Hardware & Software Online Store > >
You'll definitely have to encode in little-endian form. PCM audio is always little-endian, to the best of my knowledge. I have never seen any big-endian audio data files. The frequency-domain transforms inside Speex are written to assume that most of the "intelligence" is carried by the MSB of a 16-bit little-endian word. If you submit big-endian data, Speex will think you're feeding it white noise. That may or may not be your actual problem, of course... just something to watch out for. -- jm> -----Original Message----- > From: speex-dev-bounces@xiph.org [mailto:speex-dev-bounces@xiph.org]On > Behalf Of Leonardi Andrea > Sent: Friday, May 26, 2006 10:35 AM > To: speex-dev@xiph.org > Subject: RE: [Speex-dev] question about coding > > > > Thanks for the answer. > So data are stored in little-endian format on the WAVE file. But > have I to encode in big endian format or little endian is ok?! > Thanks > >
John Miles wrote:> You'll definitely have to encode in little-endian form. PCM audio is always > little-endian, to the best of my knowledge. I have never seen any > big-endian audio data files.Try AIFF, AU and IFF just for starters. They are definietly not the only ones. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ "UNIX was not designed to stop you from doing stupid things, because that would also stop you from doing clever things." -- Doug Gwyn
Leonardi Andrea wrote:> > Thanks for the answer. > So data are stored in little-endian format on the WAVE file. But > have I to encode in big endian format or little endian is ok?!You need to pass the data in whatever is the native endian-ness for your platform.> >You are probably reading little-endian samples on a big-endian platform, and > >failing to flip the byte order.Using libsndfile (I am the author): http://www.mega-nerd.com/libsndfile/ will make you life easier.> >By convention, PCM samples are generally > >little-endian words,This is not right. Some file types are little endian (WAV for example) others are big endian (ie AIFF). There is hwoever also a big endian WAV variant (RIFX) and some AIFF files contain little endian data. libsndfile handles all the above variations correctly. Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo +-----------------------------------------------------------+ "Using Java as a general purpose application development language is like going big game hunting armed with Nerf weapons." -- Author Unknown
True, it depends on where the "raw audio file" that he mentioned came from. If it came from a .WAV ('WAVE'?), it's little-endian unless the converter program explicitly flipped the byte order. Either way, white noise with faint traces of the original content =mis-flipped bytes... -- jm> > >By convention, PCM samples are generally > > >little-endian words, > > This is not right. Some file types are little endian (WAV for example) > others are big endian (ie AIFF). There is hwoever also a big endian > WAV variant (RIFX) and some AIFF files contain little endian data. > > libsndfile handles all the above variations correctly. > >