I need to create a dummy .m4a file of a certain length programatically under iOS...
Asked
Active
Viewed 2,083 times
1
-
I presume you mean "filled with silence"? – John Fricker Aug 10 '11 at 22:52
-
yep "filled with silence" is what I need; I would like to know if tehre is a simple way to create it without writing a normal file filling the buffers with silence... – Stone Alessandro Aug 11 '11 at 11:38
1 Answers
0
try this
NSError *error = nil;
path = [path stringByAppendingPathComponent:@"tempfile"];
NSURL *URL = [NSURL fileURLWithPath:path];
[[NSFileManager defaultManager]createFileAtPath:path contents:nil attributes:nil]
NSFileHandle *writeFile = [NSFileHandle fileHandleForWritingToURL:URL error:&error];
[writeFile truncateFileAtOffset:4000000000*sizeof(Byte)];

user698333
- 78
- 1