Re: [LAD] Regarding amplifying a PCM frame

2009-10-27 Thread Drip Stone
Thank you for the reply. Finally I figure out the problem. The code is OK, but I thought it should be louder. So when I was multiplying t by 2, I could not hear the difference from my laptop speaker. But after multiplying PCM data by 20, I heard a significant difference. Best, Dripsotne On Tue, O

Re: [LAD] Regarding amplifying a PCM frame

2009-10-27 Thread Jens M Andreasen
On Mon, 2009-10-26 at 17:53 -0700, Drip Stone wrote: > > I pasted all the code at http://pastebin.com/m7fdf0957. OK! Aside from the C++ style of declaring iterators, I just made this change in (or around) line 126 to raise left channel by 6 dB: -8<---

Re: [LAD] Regarding amplifying a PCM frame

2009-10-26 Thread Drip Stone
and test .wav file is at http://gamma.cs.unc.edu/SOUNDC/Assignments/clapping!_2.wav On Mon, Oct 26, 2009 at 5:50 PM, Drip Stone wrote: > Hello again, > > I obtain data for fbuffer in following way: > char *fbuffer = ( char * ) malloc ( 1024 ); //10M bytes > long length = fread ( fbuff

Re: [LAD] Regarding amplifying a PCM frame

2009-10-26 Thread Drip Stone
Hello again, I obtain data for fbuffer in following way: char *fbuffer = ( char * ) malloc ( 1024 ); //10M bytes long length = fread ( fbuffer, 1, 1024, file ); I also set alsa in float mode: snd_pcm_hw_params_set_format ( handle, params, SND_PCM_FORMAT_FLOAT_LE ); I pa

Re: [LAD] Regarding amplifying a PCM frame

2009-10-26 Thread Jens M Andreasen
Nothing in the posted code fragment suggests that neither in nor out is remotely related to floats. Where do you get yor in-data from? Why is fbuffer[] a bytearray (if that is what it is?) How was ALSA opened? /j On Mon, 2009-10-26 at 15:05 -0700, Drip Stone wrote: > while ( 1 ) > { >

Re: [LAD] Regarding amplifying a PCM frame

2009-10-26 Thread Peter Nelson
On Mon, 2009-10-26 at 15:05 -0700, Drip Stone wrote: > Hi, > > Thank you for providing valuable information. I will put some code > here: > > while ( 1 ) > { > for ( int i = 0; i < frames; i++ ) > { > float t = 0; > if ( left )//for left channel

Re: [LAD] Regarding amplifying a PCM frame

2009-10-26 Thread Drip Stone
Hi, Thank you for providing valuable information. I will put some code here: while ( 1 ) { for ( int i = 0; i < frames; i++ ) { float t = 0; if ( left )//for left channel { t = *((float*)&(fbuffer[pos+i*4]));//4 b

Re: [LAD] Regarding amplifying a PCM frame

2009-10-26 Thread Jörn Nettingsmeier
On 10/26/2009 11:38 AM, Victor Lazzarini wrote: > Well if the audio was clipped, there would probably be some audible > distortion. > Perhaps if a code fragment was posted we could give a more informed > opinion. i was thinking of operating on files, where clamping can be done with perfect fideli

Re: [LAD] Regarding amplifying a PCM frame

2009-10-26 Thread Victor Lazzarini
Well if the audio was clipped, there would probably be some audible distortion. Perhaps if a code fragment was posted we could give a more informed opinion. Victor On 26 Oct 2009, at 09:08, Jörn Nettingsmeier wrote: > On 10/26/2009 07:33 AM, Drip Stone wrote: >> Hi everybody, >> >> I have a qu

Re: [LAD] Regarding amplifying a PCM frame

2009-10-26 Thread Jörn Nettingsmeier
On 10/26/2009 07:33 AM, Drip Stone wrote: > Hi everybody, > > I have a question regarding amplifying a PCM frame. For each frame, I > get a float number, and multiply this number by 2, and then output > frames to alsa one by one using function snd_pcm_writei. But the wav > file sounds the same to m

[LAD] Regarding amplifying a PCM frame

2009-10-25 Thread Drip Stone
Hi everybody, I have a question regarding amplifying a PCM frame. For each frame, I get a float number, and multiply this number by 2, and then output frames to alsa one by one using function snd_pcm_writei. But the wav file sounds the same to me, nothing gets amplified. Could anyone explain this