combine two .caf files
Asked Answered
B

1

2

I have used below code to combine two .caf files.

NSMutableData *datas = [NSMutableData alloc];
NSData *data1 = [NSData dataWithContentsOfFile:path1];
NSData *data2 = [NSData dataWithContentsOfFile:path2];
NSLog(@"file1 size  : %d", [data1 length]);
NSLog(@"file2 size : %d", [data2 length]);
[datas appendData:data1];
[datas appendData:data2];
NSLog(@"file3 size  : %d", [datas length]);
[[NSFileManager defaultManager] createFileAtPath:combinedPath contents:datas attributes:nil];

Problem is; I can able to combine two files. But when I try to play the combined file, it is playing only the first file content.

Please help me to resolve it.

Thanks.

Binocular answered 29/10, 2010 at 8:27 Comment(3)
Somebody help me to resolve this issue...Binocular
Is there any way to append two audio files ?Binocular
I have tried with .mp3 files. Above mention code is working fine. If it is some other format, it is not working. I don't have idea to do for some other format (eg: .mp4, .wav, etc).Binocular
B
1

I got the solution;

I have used Audio Queue Services to do this process.

Click here for documentation.

Binocular answered 4/1, 2011 at 13:36 Comment(2)
Could you please explain what you did with the Audio Queue Services?Damek
We would appreciate if you can put some sample code by which achieved this. Thanks!Clywd

© 2022 - 2024 — McMap. All rights reserved.