Git Product home page Git Product logo

musickit's Introduction

MusicKit

MusicKit is a framework and DSL for creating, analyzing, and transforming music in Swift.

Examples

Functional harmony

let C5 = Pitch(midi: 72)
let neapolitan = Major.bII
print(neapolitan(C5))               // [C♯5, E♯5, G♯5]
let G4 = Chroma.G*4
let plagalCadence = [Major.IV, Major.I]
print(plagalCadence * G4)           // [[C5, E5, G5], [G4, B4, D5]]
let V7ofV = HarmonicFunction.create(Scale.Major, degree: 5, chord: Major.V7)
print(V7ofV(C5))                    // [D6, F♯6, A6, C7]

Chord recognition

let pitchSet: PitchSet = [Chroma.B*0, Chroma.Cs*2, Chroma.F*3, Chroma.G*4]
print(Chord.name(pitchSet))        // G7♭5/B
let descriptor = Chord.descriptor(pitchSet)
print(descriptor)                  // root: G, quality: 7♭5, bass: B

MIDI I/O

let midi = MIDI(name: "WholetoneClusters")
midi.noteHandler = { messages in
    if let first = messages.first {
        midi.send([first, first.transpose(2), first.transpose(3)])
    }
}

Framework Overview

musickit's People

Contributors

vprtwn avatar bg-stripe avatar mfk-ableton avatar adamnemecek avatar sealgair avatar sdooman avatar tengyifei avatar sieren avatar

Stargazers

 avatar Dora Choi avatar Alexander Lester avatar sonopictorial avatar Nick Snell avatar Evan Stanley Jones avatar Ryosuke avatar Thao Nguyen avatar Mathangy K avatar Riya Batla avatar Kiren Srinivasan avatar  avatar  avatar 路过蜻蜓 avatar Levin Eric Zimmermann avatar  avatar Lena avatar Miles Blackwood avatar zuo avatar Hadrien Boyer avatar Jacob Clayden avatar Chris avatar Fisher Lee avatar Vinh Nguyen avatar Syed Haris Ali avatar  avatar Tim Kersey avatar Marcel Molina avatar Parsa Kzr avatar Vitor Rodrigues avatar  avatar John Pusey avatar ShenYj avatar azure avatar Kuei-Jung Hu avatar Rinat Abidullin avatar Essam avatar Steffi Sturm avatar  avatar  avatar hainuo avatar Mikhail Akopov avatar Keith Mitchell avatar  avatar liuXiaoLong avatar Remi Diniz avatar Nik avatar Chris Becom avatar EkoHu avatar YuQiao Chen avatar ZhangJiewen avatar  avatar Yasin ATEŞ avatar Bokyung Seo avatar David Blue avatar MelonJack avatar devanshu bhatt avatar y_shimo avatar Qitao Yang avatar Hzx avatar Henry Moor, Jr avatar  avatar Eddy Salzmann avatar Clem avatar Jonathan Lott avatar Dmitry Starkov avatar Vishal V. Shekkar avatar Rob McKinnon avatar WangSiyuan avatar Daniel Yang avatar Troy Melhase avatar AI avatar Ferran Pujol Camins avatar  avatar Philipp Seeger avatar Grant Emerson avatar  avatar L# avatar Ahmed Nassar avatar Nyan Lin Tun avatar Almog Melamed avatar Victor Augusto Borges Dias de Almeida avatar  avatar iThanh avatar Elikem Savie avatar Ryan Rishi avatar Raymond Akornor avatar lulu avatar  avatar Shawon Ashraf avatar Clark Gunn avatar unplugandplay avatar Viren avatar Ji Qu avatar Mohammed Abunada avatar Marc Brown avatar JI LU avatar Peter C. Allport avatar Zeeshan Aamir avatar  avatar

Watchers

danigb avatar Tony Hillerson avatar Aurelius Prochazka avatar  avatar Filipe Calegario avatar  avatar James Cloos avatar  avatar Michael Anthony avatar Vinod Vishwakarma avatar Carabineiro avatar  avatar Mario Estrada avatar James Bean avatar 运筹 avatar  avatar  avatar George Leonidas avatar L Rettberg avatar  avatar DIYVERSITY. Personal avatar Andrew Struck-Marcell avatar  avatar  avatar Jean-Charles van Zuylen avatar

musickit's Issues

iOS example project with AudioKit

The flagship example project should:

  • run on iOS
  • not require a MIDI keyboard
    • keyboard on screen (use keyboard from Taptone)
  • produce sound (using AudioKit)

how to play a midi with Chord ..

the chaosHarmonizer example don't run everything..

let midi = MIDI(name: "ChaosHarmonizer")
        midi.noteHandler = { messages in
            if let first = messages.first {
                if first.on {
                    let possibleChords = [
                        ChordQuality.Major,
                        ChordQuality.Minor,
                        ChordQuality.Sus2,
                        ChordQuality.Sus4,
                    ]

'''

Improve PitchClass

Initing a pitch with PitchClass should be more concise.

Also, the correct term seems to be Chroma. a pitch class is the set of all pitches with the same chroma.

Pitch(pitchClass: .Gs, octave: 4)
or even
PitchClass.Gs_4

todos

  • Typealias gamut Set
  • * operator for Pitch * Harmonizer and Pitch * [Harmonizer]
  • Harmonizer.create should be 1-indexed
  • let V7ofV = Harmonizer.create(Scale.Major, 5, Major.V7)
  • PitchSet/ PitchClass should add pitch class at root
    PitchClass` should have sensible constants like As, A

functional refactor

Chords should be functions
Chord :: Pitch -> PitchSet
Chord.Major(c4)

Scales should be polymorphic functions
Scale.Minor(c4)
Scale.Minor([1, 3, 5]) (c4)

PitchSet should support operators:
PitchSet +/- PitchSet
PitchSet +/- Float

Sharps only

Hi,
I've been having a look at this great resource and was wondering how we would go about making sure when you print the scale like A Major it prints --> [A4, B4, C♯5, D5, E5, F♯5, A♭5]
Though A major only has sharps. So the A♭5 should be G#5. I'm looking in the Pitch.swift file and wondering would this be the place to assign the Note and Sharp type if it is a sharp key?
Thanks in advance for your help.
I look forward to talking with you.
Regards Gerard

Add Key

only Major + Minor keys
Key.Identify

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.