[Asterisk-Dev] Mixing 2 or more audioframes...(ast_frame)

Alexandru Coseru alex_spam at distinctgroup.net
Tue Sep 14 10:49:11 MST 2004


 Hello..

I'm trying to develop an application and I need to mix 2 or more audio frames..

I have 

struct ast_frame *frame1;
struct ast_frame *frame2;
struct ast_frame *frame3;


Now , I want to put in frame3 the mixed content of frame1  and frame2..


I managed to do that using this:


                        unsigned char *data1=(char*)malloc(frame1->datalen);
                        unsigned char *data2=(char*)malloc(frame2->datalen);
                        memcpy(data1,frame1>data,frame1->datalen);
                        memcpy(data2,frame2->data,frame2->datalen);
                        for(kl1=0;kl1<user_chan_f->datalen;kl1++){
                                data1[kl1] = ( kl1 & 1  ?  data1[kl1] : data2[kl1] );
                       memcpy(frame3->data,data1,frame1->datalen);

but the sound quality is not so good.. With a very little effort , you can recognize the voices..

Is there a better way to do this ?


Thanks
    Alex

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-dev/attachments/20040914/d4c8082b/attachment.htm


More information about the asterisk-dev mailing list