How to concatenate 2 or 3 audio files in iOS?

后端 未结 7 1541
不知归路
不知归路 2020-12-08 12:19

I am newcomer in Objective-C and have experience only 5 months in iPhone development.

What I need:
I need to concatenate 2 or more

7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-08 12:48

    The easiest way to implement multiple combinations of aac:

    - (NSString *)concatenatedAACVoicesPath{
    NSMutableData *concatenatedData = [[NSMutableData alloc] init];
    
    NSArray *aacPathArr = [self queryAAC];
    for (NSString *path in aacPathArr) {
        NSData *data = [[NSData alloc] initWithContentsOfFile:path];
        [concatenatedData appendData: data];
    }
    
    NSString *fileNamePath = [NSString stringWithFormat:@"%@/%@.aac",[NSString createPath:currRecordDocName],currRecordDocName];
    [concatenatedData writeToFile:fileNamePath atomically:YES];
    
    return fileNamePath;
    

    }

提交回复
热议问题