🎼 swift-music

CI Chords DocMusicTheory

简介

swift-music 是一个 Swift 包,它为音乐相关的开发提供了一个易于使用的 API。

当前可用模块

乐理 (MusicTheory)

import MusicTheory

音程运算

Note.D - Note.E  // Interval.m7

创建和弦

// Create with notes contained.
let Esus4 = Chord(.E, notes: [.E, .A, .B]) 

// Create with root and quality.
let Abm = Chord(.A_flat, .minorTriad)

获取音阶中的三和弦

Scale(.B, .major).triad(degree: 6) // G#m

其他 API

安装

Xcode 项目

文件 - 添加包 - https://github.com/sh3l6orrr/swift-music.git

Swift Package Manager

在 Package.swift 中,添加以下内容

dependencies: [
    .package(url: "https://github.com/sh3l6orrr/swift-music.git", .upToNextMajor(from: "1.0.0"))
]
targets: [
    .target(
        name: "YourTarget",
        dependencies: [.product(name: "MusicTheory", package: "swift-music")]
    )
]

文档

点击本 README 前面的徽章,或在 Xcode 中构建

Product - Build Documentation (产品 - 构建文档)