On Thu, Jan 24, 2008 at 03:06:38PM -0800, Penguin Lover maxim wexler squawked: > > > > compile it, run it like > > > > ./a.out | play -t raw -s l -f s -c 1 -r 30000 - > > > > > This works, sort of. Sounds like a dentist drill going > in an out. > > [EMAIL PROTECTED] ~/docs/c-prog $ ./a.out | aplay -t > raw -f cdr > Playing raw data 'stdin' : Signed 16 bit Big Endian, > Rate 44100 Hz, Stereo
This is because the code outputs it as 32 bit signed with 30000 Hz rate. The defaults of aplay is sampling it incorrectly, which is why the file sounds off. Now, I think I know what the problem is with sox: 1) the commandline syntax changed between 12.* and 14.0, the switches I need should be play -t raw -s -4 -c 1 -r 30000 (c.f. man play). 2) Despite what the man pages say, the '-' switch for reading from stdin seems to be broken. Probably a bug. I'll test more and possibly file a bug report. On the other hand, since you have aplay installed, the right syntax should be ./a.out | aplay -t raw -f S32_LE -c 1 -r 30000 Which says to use 32 bit little endian with 1 channel at a sample rate of 30000. Unfortunately, if you do that, you won't hear a thing. Why? I got my multiplier wrong in the testing program that I send you. I missed half a byte. Change the definition for coramp (which controls the amplification) to int coramp = 0xCFFFFFFF; (The reason that I missed half a byte was that I was messing around with harmonics and multiple voicing... so each harmonic needs to be suitably rescaled in amplitude.) Hope that helps, W -- When my cats aren't happy, I'm not happy. Not because I care about their mood but because I know they're just sitting there thinking up ways to get even. ~Penny Ward Moser Sortir en Pantoufles: up 412 days, 22:00 -- gentoo-user@lists.gentoo.org mailing list