A technical support community for Apple Logic Pro users.

 
ValliSoftware
Topic Author
Posts: 645
Joined: Mon May 19, 2014 10:46 am

Caf Midi Extractor - Utility Program

Mon Oct 22, 2018 11:13 am

Here's a utility program I wrote to extract MIDI from Green Apple Loops, if there's MIDI in a Green Apple Loop.



I've attached the file but watch the video to get an idea how it works.
Attachments
CafMidiExtractor.zip
(1.71 MiB) Downloaded 143 times
iMac 10.8.5 2.8 GHz Intel Core 2 Duo 4GB Ram - Logic 9.1.8 (1700.67) (32-bit)
MacBook Pro 10.8.5 2.2 GHz Intel Core 2 Duo 6GB Ram - Logic Pro X (10.2)
MacMini 10.13.6 2GHz Intel Core i7 16GB Ram - GarageBand 10.4.5 Logic Pro X (10.4.8)
iPad Mini iOS 12 - iOS GarageBand 2.0.1
Qosimo X70-A 10.13.6 Intel® Core™ i7-4700MQ Processor 32GB DDR3L 1600MHz memory, 2-500GB 7200rpm hard drives - Logic Pro X (10.4.8)
 
User avatar
vanhaze
Posts: 420
Joined: Sun May 15, 2005 3:32 am
Location: Netherlands

Re: Caf Midi Extractor - Utility Program

Tue Oct 23, 2018 11:47 am

Superb, thank you so much Vallisoftware for making this available to The World.
You make really great soft tools and Logic Scripts, highly appreciated.

Warm Regards.
Macbook Pro Retina 2015 - OSX 10.15 - Always latest version of Logic Pro X - UAD Apollo Twin.
 
Sascha Franck
Posts: 965
Joined: Sun Sep 14, 2008 5:51 am
Location: Hannover/Germany

Re: Caf Midi Extractor - Utility Program

Sun Nov 04, 2018 9:21 am

Quite neat. Don't know whether I'll actually make use of those MIDI files, but having them can't be all too wrong and might save a step or two, so thanks!
2010 MP 2x2.66GHz, 16GB, 500GB SSD System/Logic drive, Zoom UAC-2, LPX 4.2, OSX 13.6.
 
User avatar
Dewdman42
Posts: 2371
Joined: Tue Sep 09, 2014 3:01 pm
Location: Park City, UT

Re: Caf Midi Extractor - Utility Program

Tue May 19, 2020 4:25 pm

I just found this and thanks for sharing. Any chance you will put this source on GitHub? I am looking into how I can read CAF files to get not only midi out, but also other metadata that might be in there, and now with LogicPro 10.5, stepSequencer patterns can also be stored inside CAF files...
5,1 MacPro 3.46ghz x 12 128gb ram, OSX 10.14, Logic Pro 10.4.8, Mainstage3, Cubase10, StudioOne, Reaper, DP9, VEP, VSL, too many plugins to list
 
ValliSoftware
Topic Author
Posts: 645
Joined: Mon May 19, 2014 10:46 am

Re: Caf Midi Extractor - Utility Program

Tue May 19, 2020 5:25 pm

Dewdman42 wrote:
I just found this and thanks for sharing. Any chance you will put this source on GitHub? I am looking into how I can read CAF files to get not only midi out, but also other metadata that might be in there, and now with LogicPro 10.5, stepSequencer patterns can also be stored inside CAF files...



https://developer.apple.com/library/arc ... -TPXREF101

I read up on Music Mediadata section, in particular, MIDI chunk.

I think for your stepSequencer question, the Logic developers might have decided to use the Extending CAF section, since there you can define your own chunk.

Since writing that app, I've also notice there's several libraries that can read and write not only CAF files, but other audio files as well. You might want to use one of those libraries.
iMac 10.8.5 2.8 GHz Intel Core 2 Duo 4GB Ram - Logic 9.1.8 (1700.67) (32-bit)
MacBook Pro 10.8.5 2.2 GHz Intel Core 2 Duo 6GB Ram - Logic Pro X (10.2)
MacMini 10.13.6 2GHz Intel Core i7 16GB Ram - GarageBand 10.4.5 Logic Pro X (10.4.8)
iPad Mini iOS 12 - iOS GarageBand 2.0.1
Qosimo X70-A 10.13.6 Intel® Core™ i7-4700MQ Processor 32GB DDR3L 1600MHz memory, 2-500GB 7200rpm hard drives - Logic Pro X (10.4.8)
 
User avatar
Dewdman42
Posts: 2371
Joined: Tue Sep 09, 2014 3:01 pm
Location: Park City, UT

Re: Caf Midi Extractor - Utility Program

Tue May 19, 2020 5:28 pm

Well i can see already from your program that the CAF's for step sequencer are bundling the sequence data into the midi file section, because your program extracts the midi..its not usable midi that way, but its some information. I'm sure there must be more metadata in there to define the pattern parameters..

It could be useful to be cable to convert some of the CAF midi loops into CAF step sequencer loops.

among other things...
5,1 MacPro 3.46ghz x 12 128gb ram, OSX 10.14, Logic Pro 10.4.8, Mainstage3, Cubase10, StudioOne, Reaper, DP9, VEP, VSL, too many plugins to list
 
ValliSoftware
Topic Author
Posts: 645
Joined: Mon May 19, 2014 10:46 am

Re: Caf Midi Extractor - Utility Program

Tue May 19, 2020 5:36 pm

Dewdman42 wrote:
Well i can see already from your program that the CAF's for step sequencer are bundling the sequence data into the midi file section, because your program extracts the midi..its not usable midi that way, but its some information. I'm sure there must be more metadata in there to define the pattern parameters..

It could be useful to be cable to convert some of the CAF midi loops into CAF step sequencer loops.

among other things...


I can't upgrade to Logic 10.5 because the MACS I have, Apple won't allow past High Sierra, but I'm working on that with one of the MACS.
Can you zip and post one of the CAF files, I'm curious why the MIDI is not usable.
iMac 10.8.5 2.8 GHz Intel Core 2 Duo 4GB Ram - Logic 9.1.8 (1700.67) (32-bit)
MacBook Pro 10.8.5 2.2 GHz Intel Core 2 Duo 6GB Ram - Logic Pro X (10.2)
MacMini 10.13.6 2GHz Intel Core i7 16GB Ram - GarageBand 10.4.5 Logic Pro X (10.4.8)
iPad Mini iOS 12 - iOS GarageBand 2.0.1
Qosimo X70-A 10.13.6 Intel® Core™ i7-4700MQ Processor 32GB DDR3L 1600MHz memory, 2-500GB 7200rpm hard drives - Logic Pro X (10.4.8)
 
ValliSoftware
Topic Author
Posts: 645
Joined: Mon May 19, 2014 10:46 am

Re: Caf Midi Extractor - Utility Program

Tue May 19, 2020 9:13 pm

ValliSoftware wrote:
Dewdman42 wrote:
Well i can see already from your program that the CAF's for step sequencer are bundling the sequence data into the midi file section, because your program extracts the midi..its not usable midi that way, but its some information. I'm sure there must be more metadata in there to define the pattern parameters..

It could be useful to be cable to convert some of the CAF midi loops into CAF step sequencer loops.

among other things...


I can't upgrade to Logic 10.5 because the MACS I have, Apple won't allow past High Sierra, but I'm working on that with one of the MACS.
Can you zip and post one of the CAF files, I'm curious why the MIDI is not usable.


No need to post anything, I was able to upgrade to Mojave on a unsupported MacBook Pro, I'm downloading Logic 10.5 now. woo-hoo. :mrgreen:
iMac 10.8.5 2.8 GHz Intel Core 2 Duo 4GB Ram - Logic 9.1.8 (1700.67) (32-bit)
MacBook Pro 10.8.5 2.2 GHz Intel Core 2 Duo 6GB Ram - Logic Pro X (10.2)
MacMini 10.13.6 2GHz Intel Core i7 16GB Ram - GarageBand 10.4.5 Logic Pro X (10.4.8)
iPad Mini iOS 12 - iOS GarageBand 2.0.1
Qosimo X70-A 10.13.6 Intel® Core™ i7-4700MQ Processor 32GB DDR3L 1600MHz memory, 2-500GB 7200rpm hard drives - Logic Pro X (10.4.8)
 
User avatar
Dewdman42
Posts: 2371
Joined: Tue Sep 09, 2014 3:01 pm
Location: Park City, UT

Re: Caf Midi Extractor - Utility Program

Tue May 19, 2020 9:17 pm

well its not usable because Step sequencer data is not meant to be played that way, its meant to be manipulated.

They are storing the pattern for each "row" as a bar in the midi file. So bar 1 is the pattern for the first row, bar2 is the pattern for the second row, etc. In step sequencer those patterns will be played simultaneously..
5,1 MacPro 3.46ghz x 12 128gb ram, OSX 10.14, Logic Pro 10.4.8, Mainstage3, Cubase10, StudioOne, Reaper, DP9, VEP, VSL, too many plugins to list
 
User avatar
Dewdman42
Posts: 2371
Joined: Tue Sep 09, 2014 3:01 pm
Location: Park City, UT

Re: Caf Midi Extractor - Utility Program

Tue May 19, 2020 9:18 pm

But like I said, if you can figure out the step sequencer meta data, you could write a program that can convert simple apple midi loop CAF's into the step sequencer form...by filling in the meta data and populating the midi as noted above.
5,1 MacPro 3.46ghz x 12 128gb ram, OSX 10.14, Logic Pro 10.4.8, Mainstage3, Cubase10, StudioOne, Reaper, DP9, VEP, VSL, too many plugins to list
 
ValliSoftware
Topic Author
Posts: 645
Joined: Mon May 19, 2014 10:46 am

Re: Caf Midi Extractor - Utility Program

Wed May 20, 2020 4:30 pm

Dewdman42 wrote:
They are storing the pattern for each "row" as a bar in the midi file. So bar 1 is the pattern for the first row, bar2 is the pattern for the second row, etc. In step sequencer those

Now that I have Logic 10.5, can you point to an exact file that your looking at. Give me the full path including the file name.
I did a quick look at this and the information is being stored in a plist file, that's why I'm asking for an exact file to look at in your case.
iMac 10.8.5 2.8 GHz Intel Core 2 Duo 4GB Ram - Logic 9.1.8 (1700.67) (32-bit)
MacBook Pro 10.8.5 2.2 GHz Intel Core 2 Duo 6GB Ram - Logic Pro X (10.2)
MacMini 10.13.6 2GHz Intel Core i7 16GB Ram - GarageBand 10.4.5 Logic Pro X (10.4.8)
iPad Mini iOS 12 - iOS GarageBand 2.0.1
Qosimo X70-A 10.13.6 Intel® Core™ i7-4700MQ Processor 32GB DDR3L 1600MHz memory, 2-500GB 7200rpm hard drives - Logic Pro X (10.4.8)
 
User avatar
Dewdman42
Posts: 2371
Joined: Tue Sep 09, 2014 3:01 pm
Location: Park City, UT

Re: Caf Midi Extractor - Utility Program

Wed May 20, 2020 4:33 pm

after you update all the LogicPro 10.5 content, look in the Apple Loops Folder. There is one folder called "Step Sequencer" which has a bunch of Step Sequencer patterns stored in CAF files...I guess the audio preview must be in there also, along with channel preset information, etc.similar as a midi loop CAF, but with a step sequencer pattern instead of regular midi
5,1 MacPro 3.46ghz x 12 128gb ram, OSX 10.14, Logic Pro 10.4.8, Mainstage3, Cubase10, StudioOne, Reaper, DP9, VEP, VSL, too many plugins to list
 
ValliSoftware
Topic Author
Posts: 645
Joined: Mon May 19, 2014 10:46 am

Re: Caf Midi Extractor - Utility Program

Thu May 21, 2020 10:08 am

So those MIDI files are usable MIDI files.
Obviously, use a drum MIDI with a drum instrument, etc...
The only thing I did was add a Transposer and set it to E Minor, otherwise its the same MIDI file from the CAF file.


For your goal of creating new patterns, there is a "pattern" file and it's in the form of a plist.
I'm sure that information isn't documented anywhere, so you'd have to examine the plist file while looking at it in the Step Sequence to get an idea how the plist is being laid out.

Look for a folder called Step Sequencer Settings in Logic Pro X in the Resources folder.
There you'll see all the default patterns for the Step Sequencer.

I changed the extension to .plist just so I can view it easier with Xcode.
1800s Improvisation.png
1800s Improvisation.png (207.86 KiB) Viewed 186 times
iMac 10.8.5 2.8 GHz Intel Core 2 Duo 4GB Ram - Logic 9.1.8 (1700.67) (32-bit)
MacBook Pro 10.8.5 2.2 GHz Intel Core 2 Duo 6GB Ram - Logic Pro X (10.2)
MacMini 10.13.6 2GHz Intel Core i7 16GB Ram - GarageBand 10.4.5 Logic Pro X (10.4.8)
iPad Mini iOS 12 - iOS GarageBand 2.0.1
Qosimo X70-A 10.13.6 Intel® Core™ i7-4700MQ Processor 32GB DDR3L 1600MHz memory, 2-500GB 7200rpm hard drives - Logic Pro X (10.4.8)
 
User avatar
Dewdman42
Posts: 2371
Joined: Tue Sep 09, 2014 3:01 pm
Location: Park City, UT

Re: Caf Midi Extractor - Utility Program

Thu May 21, 2020 12:27 pm

Logic appears to have two sets of factory step sequencer patterns. There are the plist files you mention here now....but these are separate from the provided CAF apple loops which are an additional set of patterns that also happen to have plugins assigned, etc.. as configured in the CAF.

So I am somewhat interested in parsing the CAF to obtain not only the midi but all the rest of the pattern oriented meta data that must be in those CAF files. As you can see from the plist patterns, there it much more then just raw midi data. I'm even more interested in converting midi CAF apple looks into step sequencer apple loops. This would convert the simple midi sequence into a more sophisticated step sequencer midi loop, adding the extra meta data...and keeping the channel preset information as well...so that it can function as an apple loop still...but in the step sequencer. That's why I asked about the CAF file format or any information you may have about parsing it.

I'd also like to convert the factory CAF step sequencer patterns into plist versions...so that I have them all accessible from the step sequencer pattern browser.

Converting a step sequencer pattern to midi is actually not all that interesting because you can already do that inside logicPro easily. LogicPro, however, does not provide a way to convert midi into step sequencer patterns, which is what I'm more interested in.
5,1 MacPro 3.46ghz x 12 128gb ram, OSX 10.14, Logic Pro 10.4.8, Mainstage3, Cubase10, StudioOne, Reaper, DP9, VEP, VSL, too many plugins to list
 
ValliSoftware
Topic Author
Posts: 645
Joined: Mon May 19, 2014 10:46 am

Re: Caf Midi Extractor - Utility Program

Fri May 22, 2020 8:15 am

Dewdman42 wrote:
That's why I asked about the CAF file format or any information you may have about parsing it.

Did you not read the link I posted above?
https://developer.apple.com/library/arc ... -TPXREF101

In that link, it also has this link (Core Audio File Specifications)
https://developer.apple.com/library/arc ... -CH210-SW1

The Core Audio File Specifications lays out the structure, to which you can read and extract the information your looking for, if it's there of course.
iMac 10.8.5 2.8 GHz Intel Core 2 Duo 4GB Ram - Logic 9.1.8 (1700.67) (32-bit)
MacBook Pro 10.8.5 2.2 GHz Intel Core 2 Duo 6GB Ram - Logic Pro X (10.2)
MacMini 10.13.6 2GHz Intel Core i7 16GB Ram - GarageBand 10.4.5 Logic Pro X (10.4.8)
iPad Mini iOS 12 - iOS GarageBand 2.0.1
Qosimo X70-A 10.13.6 Intel® Core™ i7-4700MQ Processor 32GB DDR3L 1600MHz memory, 2-500GB 7200rpm hard drives - Logic Pro X (10.4.8)
 
User avatar
Dewdman42
Posts: 2371
Joined: Tue Sep 09, 2014 3:01 pm
Location: Park City, UT

Re: Caf Midi Extractor - Utility Program

Fri May 22, 2020 10:58 am

I already had read apple’s document before you posted it. I was hoping we could have a colaboratove discusion but it appears not.
5,1 MacPro 3.46ghz x 12 128gb ram, OSX 10.14, Logic Pro 10.4.8, Mainstage3, Cubase10, StudioOne, Reaper, DP9, VEP, VSL, too many plugins to list
 
ValliSoftware
Topic Author
Posts: 645
Joined: Mon May 19, 2014 10:46 am

Re: Caf Midi Extractor - Utility Program

Fri May 22, 2020 12:13 pm

Dewdman42 wrote:
I already had read apple’s document before you posted it. I was hoping we could have a colaboratove discusion but it appears not.

Image
Without documentation to the the above plist file, what you want to try to do is impossible since you don't know every defined keyword in that plist file.

Not sure why you think that the settings file is in the CAF file, I already point out the settings files and not sure if you know this but you create your own "user" settings, which then you can share with others but that doesn't require creating CAF files but SETTINGS files (plist).

You'd want to create a SETTINGS file because that doesn't get tied to a CAF file, which is the whole purpose of the SETTINGS file.
iMac 10.8.5 2.8 GHz Intel Core 2 Duo 4GB Ram - Logic 9.1.8 (1700.67) (32-bit)
MacBook Pro 10.8.5 2.2 GHz Intel Core 2 Duo 6GB Ram - Logic Pro X (10.2)
MacMini 10.13.6 2GHz Intel Core i7 16GB Ram - GarageBand 10.4.5 Logic Pro X (10.4.8)
iPad Mini iOS 12 - iOS GarageBand 2.0.1
Qosimo X70-A 10.13.6 Intel® Core™ i7-4700MQ Processor 32GB DDR3L 1600MHz memory, 2-500GB 7200rpm hard drives - Logic Pro X (10.4.8)
 
User avatar
Dewdman42
Posts: 2371
Joined: Tue Sep 09, 2014 3:01 pm
Location: Park City, UT

Re: Caf Midi Extractor - Utility Program

Fri May 22, 2020 12:17 pm

The plist files are entirely seperate from the caf Apple loops.

I have already deciphered most of the plist tags and plan to write a converter that can convert midi files to plist pattern files.

My interest in this thread is about the caf files not the plist. Never mind, you’re making the discussion too hard mate. Good luck
5,1 MacPro 3.46ghz x 12 128gb ram, OSX 10.14, Logic Pro 10.4.8, Mainstage3, Cubase10, StudioOne, Reaper, DP9, VEP, VSL, too many plugins to list