How to download a audio file programmatically?

Well you could write something like this:

//Download data
NSData *data = [NSData dataWithContentsOfURL:<YOUR URL>];

//Find a cache directory. You could consider using documenets dir instead (depends on the data you are fetching)
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *path = [paths  objectAtIndex:0];

//Save the data    
NSString *dataPath = [path stringByAppendingPathComponent:@"filename"];
dataPath = [dataPath stringByStandardizingPath];
BOOL success = [data writeToFile:dataPath atomically:YES];