Ben Stanley
2004-Aug-06 15:01 UTC
[speex-dev] Decoding .spx with 1.0 on ppc produces noise!
Hi, I got my hands on the LCA 2003 CD today and I tried to listen to it on my powerbook running Linux. Instead of getting speech, I got an earfull of noise! Attempting the same experiment on an i386 with the same CD produced understandable speech. It seems that the output routine in speexdec converts the output data to little endian short format, which is incorrect on the ppc architecture. The data written to the sound device should be in native endian format (this may be different from what is required if the data is being written to a file). However, removing the endian conversion does not fix the problem, and speexdec continues to play noise. Ben. <p>--- >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 'speex-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Kaveh Goudarzi
2004-Aug-06 15:01 UTC
[speex-dev] Decoding .spx with 1.0 on ppc produces noise!
Hi, I had a similar question ... is the endian-ness of the encoded speex file, system dependent? or is it always little endian? If it's always little endian (like the header seems to be) then big endian machines (or java) will need to map everything to bigendian before decoding ... thanks in advance, Kaveh. <p>Ben Stanley wrote:> Hi, > > I got my hands on the LCA 2003 CD today and I tried to listen to it on > my powerbook running Linux. Instead of getting speech, I got an earfull > of noise! Attempting the same experiment on an i386 with the same CD > produced understandable speech. > > It seems that the output routine in speexdec converts the output data to > little endian short format, which is incorrect on the ppc architecture. > The data written to the sound device should be in native endian format > (this may be different from what is required if the data is being > written to a file). However, removing the endian conversion does not fix > the problem, and speexdec continues to play noise. > > Ben. > > > --- >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 'speex-dev-request@xiph.org' > containing only the word 'unsubscribe' in the body. No subject is needed. > Unsubscribe messages sent to the list will be ignored/filtered. > ><p>--- >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 'speex-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Jean-Marc Valin
2004-Aug-06 15:01 UTC
[speex-dev] Decoding .spx with 1.0 on ppc produces noise!
> I got my hands on the LCA 2003 CD today and I tried to listen to it on > my powerbook running Linux. Instead of getting speech, I got an earfull > of noise! Attempting the same experiment on an i386 with the same CD > produced understandable speech.Looks like an endianness problem. I don't have access to a big endian machine, so you'll have to help me on this one.> It seems that the output routine in speexdec converts the output data to > little endian short format, which is incorrect on the ppc architecture. > The data written to the sound device should be in native endian format > (this may be different from what is required if the data is being > written to a file). However, removing the endian conversion does not fix > the problem, and speexdec continues to play noise.First thing, could you check that WORDS_BIGENDIAN is set (by configure). Also, try decoding to wave and see if it works. With wave output, you should leave the little-endian conversion on. If it doesn't work, could you send me the file (or just the beginning if it's long). Jean-Marc -- Jean-Marc Valin, M.Sc.A. LABORIUS (http://www.gel.usherb.ca/laborius) Université de Sherbrooke, Québec, Canada <p> -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 190 bytes Desc: Ceci est une partie de message numériquement signée Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20030416/a601fc79/signature-0001.pgp
Ben Stanley
2004-Aug-06 15:01 UTC
[PATCH] Re: [speex-dev] Decoding .spx with 1.0 on ppc produces noise!
On Thu, 2003-04-17 at 07:48, Kaveh Goudarzi wrote:> Hi, > > I had a similar question ... is the endian-ness of the encoded > speex file, system dependent? or is it always little endian? If it's > always little endian (like the header seems to be) then big endian > machines (or java) will need to map everything to bigendian before > decoding ... >I have spent some time looking into this now... The file only has 'endianness' in the header, as that is the only place it stores multi-byte quantities directly. All other numerical quantities are un-packed bit-by-bit by speex_bits_unpack_unsigned, which will be guaranteed to work OK on any host platform. Thus the input to the decoder is OK. However, what happens to the output is another problem. The speexdec decoder tells the OSS output driver that the data format is Little Endian. It also converts the data from native endian to little endian before writing the data to the driver. While this should work in theory, in practice there seems to be a problem with the driver on my PowerBook, so this produces *nasty hissing noise*. It's also inefficient, as we should just open the driver in native endian mode and output native endian directly. (Native endian is just a convenient notation for whatever the endian of the host platform is. Of course, we can only have big endian or little endian systems.) I have attached a couple of patches which sort out this issue, and a typo I found (there were others I didn't fix too...). I have only tested it on my powerbook, and not on my i386! I'll leave that to you guys for now. Ben. <p>> thanks in advance,> > Kaveh. > > > Ben Stanley wrote: > > Hi, > > > > I got my hands on the LCA 2003 CD today and I tried to listen to it on > > my powerbook running Linux. Instead of getting speech, I got an earfull > > of noise! Attempting the same experiment on an i386 with the same CD > > produced understandable speech. > > > > It seems that the output routine in speexdec converts the output data to > > little endian short format, which is incorrect on the ppc architecture. > > The data written to the sound device should be in native endian format > > (this may be different from what is required if the data is being > > written to a file). However, removing the endian conversion does not fix > > the problem, and speexdec continues to play noise. > > > > Ben. > > > > > > --- >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 'speex-dev-request@xiph.org' > > containing only the word 'unsubscribe' in the body. No subject is needed. > > Unsubscribe messages sent to the list will be ignored/filtered. > > > > > > > --- >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 'speex-dev-request@xiph.org' > containing only the word 'unsubscribe' in the body. No subject is needed. > Unsubscribe messages sent to the list will be ignored/filtered.-- Ben Stanley <bds02@uow.edu.au> University of Wollongong --- speex-1.0/src/speexdec.c Fri Mar 21 08:52:39 2003 +++ speex-1.0-works/src/speexdec.c Thu Apr 17 06:39:23 2003 @@ -136,7 +136,7 @@ exit(1); } - format=AFMT_S16_LE; + format=AFMT_S16_NE; if (ioctl(audio_fd, SNDCTL_DSP_SETFMT, &format)==-1) { perror("SNDCTL_DSP_SETFMT"); @@ -612,7 +612,7 @@ } /*Convert to short and save to output file*/ for (i=0;i<frame_size*channels;i++) - out[i]=(short)le_short((short)floor(.5+output[i])); + out[i]=(short)floor(.5+output[i]); #if defined WIN32 || defined _WIN32 if (strlen(outFile)==0) WIN_Play_Samples (out, sizeof(short) * frame_size*channels); --- speex-1.0-works/libspeex/nb_celp.c.orig Thu Apr 17 06:13:47 2003 +++ speex-1.0-works/libspeex/nb_celp.c Thu Apr 17 06:13:52 2003 @@ -1067,7 +1067,7 @@ wideband = speex_bits_unpack_unsigned(bits, 1); if (wideband) { - speex_warning ("More than to wideband layers found: corrupted stream?"); + speex_warning ("More than two wideband layers found: corrupted stream?"); return -2; } <p>--- >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 'speex-dev-request@xiph.org' containing only the word 'unsubscribe' in the body. No subject is needed. Unsubscribe messages sent to the list will be ignored/filtered.
Jean-Marc Valin
2004-Aug-06 15:01 UTC
[speex-dev] Decoding .spx with 1.0 on ppc produces noise!
> I had a similar question ... is the endian-ness of the encoded > speex file, system dependent? or is it always little endian? If it's > always little endian (like the header seems to be) then big endian > machines (or java) will need to map everything to bigendian before > decoding ...Well, wav's are considered little endian but for raw files, there's a command-like switch to specify either little-endian or big-endian (--le and --be). Jean-Marc -- Jean-Marc Valin, M.Sc.A. LABORIUS (http://www.gel.usherb.ca/laborius) Université de Sherbrooke, Québec, Canada <p> -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 190 bytes Desc: Ceci est une partie de message numériquement signée Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20030416/79966762/signature-0001.pgp