Advertise Books Events Forum News Social Networking Support Us

sdkIQ for iPhone ($4.99)

dotnetIQ ($4.99)

Your First iPhone App ($1.99)

iPocket Tools 9 in 1 ($0.99)

Catch-Me (Free)

Alien Strike ($0.99)

Historic Olympic Medal-Table ($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-23-2009, 02:55 PM   #1 (permalink)
New Member
 
Nitrex88's Avatar
 
Join Date: Apr 2008
Location: Long Island, NY
Age: 19
Posts: 84
Send a message via AIM to Nitrex88 Send a message via Skype™ to Nitrex88
Default Combining Audio Files...Possible?

I'm looking for a way to combine separate audio files in one audio file. The starting separate files i can have are WAV or CAF (doesnt matter to me) and I would like to stitch them together into one file such as MIDI or anything other file type thats possible. I'm not sure if this is possible on iPhone but I would be able to make a mac desktop application to export to if needed to do the stitching together there. So pretty much what I'm asking is does anybody know of a not too complex (but share anyway even if insanely complex) way on iPhone OR OS X to combine separate audio files into one file. Thanks!


Nick
Nitrex88 is offline   Reply With Quote
Old 06-23-2009, 04:00 PM   #2 (permalink)
ftm
FasterThanMonkeys.com
iPhone Dev SDK Supporter
 
Join Date: Mar 2009
Location: Southern California
Posts: 517
Send a message via AIM to ftm
Default

There is a great audio editor that is free and is compatible with several platforms (Mac, Windows, Linux). It is called Audacity, and can be found here:

Audacity: Free Audio Editor and Recorder

It can do what you are asking, and a lot more.
__________________


Website: http://fasterthanmonkeys.com

iScore Baseball Scorekeeper Top baseball scorekeeping app for iPhone
Bug Squash Reached #1 kids game in 15+ countries including USA, now with OpenFeint
Jam Packed! Fun puzzle game for all ages
Jam Packed Christmas Holiday puzzle game!
iScore Basketball Scorekeeper Best basketball scorekeeping application
ftm is offline   Reply With Quote
Old 06-23-2009, 04:04 PM   #3 (permalink)
New Member
 
Nitrex88's Avatar
 
Join Date: Apr 2008
Location: Long Island, NY
Age: 19
Posts: 84
Send a message via AIM to Nitrex88 Send a message via Skype™ to Nitrex88
Default

Oh thanks for your help but I guess i didnt convey that I need to do this programmatically in my own app I am creating. I need a framework or some classes that can combine audio files. I need to create my own app that can combine audio files, not use one that already exists.
Nitrex88 is offline   Reply With Quote
Old 06-23-2009, 04:14 PM   #4 (permalink)
Magic Hands' Daddy
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 22
Posts: 1,245
Send a message via ICQ to smithdale87 Send a message via AIM to smithdale87 Send a message via Skype™ to smithdale87
Default

Nitrex... havent seen you around here in a while... how's things been?

Anyways, I don't know about combining audio files of different types, but for same type audio files, same compression, same everything:

Could you just read in file1 using NSFileHandle's readData, write it out to another file, do the same for file2, just append it to the end of file 1. The only thing you need to determine is how many bytes are at the front of file2 that you can skip because they have unneeded file information that's not part of the audio.
__________________
Games
AppRoach - (v1.0)
7 Deaths In Nagamachi (v1.1)
Segment (v1.2)
ThumStruck Free (v1.5)
Plummet - new (v1.0)
ThumStruck 2! - Coming Soon

Apps
ArtsMemphis - (v1.0)
Elvis Mobile (v1.1)
DataLoss DB - (v1.1)
Lovers & Haters - (v1.0)
smithdale87 is offline   Reply With Quote
Old 06-23-2009, 04:18 PM   #5 (permalink)
ftm
FasterThanMonkeys.com
iPhone Dev SDK Supporter
 
Join Date: Mar 2009
Location: Southern California
Posts: 517
Send a message via AIM to ftm
Default

Ah... since you asked about OS X, I assumed you were just looking for a tool, not necessarily code.

I have seen some threads about using ffmpeg on the iphone. ffmpeg is generally used for Video, but works with audio as well. You might try searching on using ffmpeg on the iphone as the source code for that is freely available as well.
__________________


Website: http://fasterthanmonkeys.com

iScore Baseball Scorekeeper Top baseball scorekeeping app for iPhone
Bug Squash Reached #1 kids game in 15+ countries including USA, now with OpenFeint
Jam Packed! Fun puzzle game for all ages
Jam Packed Christmas Holiday puzzle game!
iScore Basketball Scorekeeper Best basketball scorekeeping application
ftm is offline   Reply With Quote
Old 06-23-2009, 04:19 PM   #6 (permalink)
New Member
 
Nitrex88's Avatar
 
Join Date: Apr 2008
Location: Long Island, NY
Age: 19
Posts: 84
Send a message via AIM to Nitrex88 Send a message via Skype™ to Nitrex88
Default

Quote:
Originally Posted by smithdale87 View Post
Nitrex... havent seen you around here in a while... how's things been?

Anyways, I don't know about combining audio files of different types, but for same type audio files, same compression, same everything:

Could you just read in file1 using NSFileHandle's readData, write it out to another file, do the same for file2, just append it to the end of file 1. The only thing you need to determine is how many bytes are at the front of file2 that you can skip because they have unneeded file information that's not part of the audio.
Yea i figured it was something like that except I don't know how to do that. Any advice on how you would go about it such as a class reference to look at or some methods you would be using. By the way all files would be of the same type, i just meant if WAV was not supported I can change all my files to CAF.

Thanks for the help.

Nick
Nitrex88 is offline   Reply With Quote
Old 06-23-2009, 04:22 PM   #7 (permalink)
New Member
 
Nitrex88's Avatar
 
Join Date: Apr 2008
Location: Long Island, NY
Age: 19
Posts: 84
Send a message via AIM to Nitrex88 Send a message via Skype™ to Nitrex88
Default

Quote:
Originally Posted by ftm View Post
Ah... since you asked about OS X, I assumed you were just looking for a tool, not necessarily code.

I have seen some threads about using ffmpeg on the iphone. ffmpeg is generally used for Video, but works with audio as well. You might try searching on using ffmpeg on the iphone as the source code for that is freely available as well.
Thanks for the info ill check that out. By asking about OS X i meant if there was no such technology on the iPhone I could make an OS X desktop application to handle this code and export data from the iPhone app to it.

Nick
Nitrex88 is offline   Reply With Quote
Old 06-23-2009, 04:56 PM   #8 (permalink)
Magic Hands' Daddy
 
Join Date: Aug 2008
Location: Memphis, TN, USA
Age: 22
Posts: 1,245
Send a message via ICQ to smithdale87 Send a message via AIM to smithdale87 Send a message via Skype™ to smithdale87
Default

This should get you on the right track. Mix and match pseudo code

Code:
-(void) concatFiles( NSString* path1, NSString* path2, NSString* combinedPath )
{
 NSFileHandle * f1Handle = [NSFileHandle fileHandleForReadingAtPath: path1];
 NSFileHandle *f2Handle = [NSFileHandle fielHandleForReadingAtPath: path2];

//might need to check if file exists first, if not create it using NSFileManager's createFileAtPath

 NSFileHandle * combinedHandle = [NSFileHandle fileHandleForWritingAtPath: combinedPath];



   // read data in small chunks to avoid hogging memory. 
   NSData* read  = [f1Handle readDataOfLength: CHUNK_SIZE] ;
      
    while( length of read != 0 )   

   {
       [combineHandle writeData: read];
       read = [f1Handle readDataOfLength: CHUNK_SIZE] ;
   }


   [f1Handle close];
   

    //now do the same for f2Handle

    //might need to ignore a few bytes in the front of file2 that isnt audio
    [f2Handle readDataOfLength: HEADER_LENGTH];


     NSData* read  = [f2Handle readDataOfLength: CHUNK_SIZE] ;
     while (... )
    {
    }
     [f2Handle close];
     [combineHandle close];
  
}
__________________
Games
AppRoach - (v1.0)
7 Deaths In Nagamachi (v1.1)
Segment (v1.2)
ThumStruck Free (v1.5)
Plummet - new (v1.0)
ThumStruck 2! - Coming Soon

Apps
ArtsMemphis - (v1.0)
Elvis Mobile (v1.1)
DataLoss DB - (v1.1)
Lovers & Haters - (v1.0)
smithdale87 is offline   Reply With Quote
Old 06-23-2009, 08:14 PM   #9 (permalink)
New Member
 
Nitrex88's Avatar
 
Join Date: Apr 2008
Location: Long Island, NY
Age: 19
Posts: 84
Send a message via AIM to Nitrex88 Send a message via Skype™ to Nitrex88
Default

Quote:
Originally Posted by smithdale87 View Post
This should get you on the right track. Mix and match pseudo code

Code:
-(void) concatFiles( NSString* path1, NSString* path2, NSString* combinedPath )
{
 NSFileHandle * f1Handle = [NSFileHandle fileHandleForReadingAtPath: path1];
 NSFileHandle *f2Handle = [NSFileHandle fielHandleForReadingAtPath: path2];

//might need to check if file exists first, if not create it using NSFileManager's createFileAtPath

 NSFileHandle * combinedHandle = [NSFileHandle fileHandleForWritingAtPath: combinedPath];



   // read data in small chunks to avoid hogging memory. 
   NSData* read  = [f1Handle readDataOfLength: CHUNK_SIZE] ;
      
    while( length of read != 0 )   

   {
       [combineHandle writeData: read];
       read = [f1Handle readDataOfLength: CHUNK_SIZE] ;
   }


   [f1Handle close];
   

    //now do the same for f2Handle

    //might need to ignore a few bytes in the front of file2 that isnt audio
    [f2Handle readDataOfLength: HEADER_LENGTH];


     NSData* read  = [f2Handle readDataOfLength: CHUNK_SIZE] ;
     while (... )
    {
    }
     [f2Handle close];
     [combineHandle close];
  
}
Wow thank you so much that will probably do it. That is so awesome! I haven't done anything with the NSFileHandle yet so I didn't know about it and it's methods. What do you recommend for the values of CHUNK_SIZE and HEADER_LENGTH?

Also in reference to me not being here for a while I have been very busy making tons of apps for the app store with various companies. I am also involved with the creation of highly developed new tutorial website that will be ready soon. Also busy finishing high school =P.

Nick
Nitrex88 is offline   Reply With Quote
Old 08-26-2009, 09:21 PM   #10 (permalink)
Registered Member
 
934texas's Avatar
 
Join Date: Jan 2009
Location: Brooklyn, NY
Posts: 18
Send a message via AIM to 934texas
Default

Very interesting. Hypothetically, if one file were video and one were audio, and both were mp4, do you think this would work?
934texas is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


» Advertisements
» Stats
Members: 21,499
Threads: 35,780
Posts: 156,754
Top Poster: smasher (2,448)
Welcome to our newest member, staticouture
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 01:51 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0