Giter Site home page Giter Site logo

caf's Introduction

Python module for Core Audio Format (CAF) files.
Rudá Moura <[email protected]>

INTRODUCTION

This is a very low level module to interact with Code Audio Format (CAF) files.

USAGE

Example: extracting MIDI content from CAF file using chunks.

---
import caf as caflib

caf = caflib.Reader('/Library/Audio/Apple Loops/Apple/13 Drummer/Zak - Intro.caf')

for chunk, data in caf:
    if chunk.chunk_type == b'midi': break
open('Zak - Intro.mid', 'wb').write(data)
---

Example: navigating into the parts of CAF file.

>>> import caf
>>> f = caf.open('/Library/Audio/Apple Loops/Apple/13 Drummer/Zak - Intro.caf')
>>> i = iter(f)
>>> o = next(i) ; print(o)
CAFdesc(sample_rate=44100.0, format_id=b'aac ', format_flags=0, bytes_per_packet=0, frames_per_packet=1024, channels_per_frame=2, bits_per_channel=0)
>>> print(o.sample_rate)
44100.0
>>> o = next(i) ; print(o)
CAFkuki(cookie_data=b'\x03\x80\x80\x80"\x00\x00\x00\x04\x80\x80\x80\x14@\x15\x00\x18\x00\x00\x02/\xf0\x00\x01\xf4\x00\x05\x80\x80\x80\x02\x12\x10\x06\x80\x80\x80\x01\x02')
>>> o = next(i) ; print(o)
CAFinfo(key=1, value=b'comments\x00Creator: Logic\x00')
>>> print(type(o))
<class 'caf.codec.CAFinfo'>
>>> print(type(o) == caf.codec.CAFinfo)
True

BUGS

Many, this module is incomplete.

caf's People

Contributors

ruda avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.