MusicScore - A music score library with MusicPart, Measure, Note, Pitch and Tempo representations in swift structs

Related tags

Audio MusicScore
Overview

MusicScore

Swift

A music score library with MusicPart, Measure, Note, Pitch and Tempo representations in swift structs.

Support read music score from MIDI file.

Requirements

  • Swift 5.0+
  • iOS 14.0+
  • macOS 13.0+

Install

Swift Package Manager

let package = Package(
  name: ...
  dependencies: [
    .package(url: "https://github.com/musical77/MusicScore.git")
  ],
  targets: ...
)

Usage

MusicScore supports load a score from mid file.

Create a MusicScore from a sample midf file in embedded resouce bundle

let score = MusicScore(url: ScoreSamples.sample)!  // 4tracks.mid
print(score)

Sample MIDI file (4tracks.mid)

image

Sample Output print(score) (4tracks.mid)

Score: 4tracks.mid
meta: 4tracks.mid_0, instrument: unknown
----------------
measure: 0, [0.0, 3.75), tempo: [0.000, inf) 🎼4/4 bpm:120
[0.000-0.250) 🎵A3 1/16 beats:0.250 duration:0.125 ⬇️98 ⬆️64
[0.500-0.750) 🎵C4 1/16 beats:0.250 duration:0.125 ⬇️98 ⬆️64
[1.000-1.250) 🎵D4 1/16 beats:0.250 duration:0.125 ⬇️98 ⬆️64
[1.500-1.750) 🎵E4 1/16 beats:0.250 duration:0.125 ⬇️98 ⬆️64
[2.000-2.250) 🎵A3 1/16 beats:0.250 duration:0.125 ⬇️98 ⬆️64
[2.500-2.750) 🎵C4 1/16 beats:0.250 duration:0.125 ⬇️98 ⬆️64
[3.000-3.250) 🎵D4 1/16 beats:0.250 duration:0.125 ⬇️98 ⬆️64
[3.500-3.750) 🎵E4 1/16 beats:0.250 duration:0.125 ⬇️98 ⬆️64

Access Measures and Notes

func testAccessMeasureAndNotes() {
    let score = MusicScore(url: ScoreSamples.sample)!

    XCTAssertEqual(score.musicParts[0].notes.count, 8)
    XCTAssertEqual(score.musicParts[0].notes[0].noteName, "A3")
    XCTAssertEqual(score.musicParts[0].notes[1].noteName, "C4")
        
    XCTAssertEqual(score.musicParts[0].measures.count, 1)
    XCTAssertEqual(score.musicParts[0].measures[0].notes[0].noteName, "A3")
}
You might also like...
A real-time, votable, democratized music queue on iPad and iPhone using Spotify
A real-time, votable, democratized music queue on iPad and iPhone using Spotify

Queue'd Music Queue'd is the best way to enjoy music with your friends. Add your favorite songs to a shared music queue at your favorite bars, restaur

macOS app that allows the control of Spotify and AppleMusic/iTunes music playback from the menu bar.
macOS app that allows the control of Spotify and AppleMusic/iTunes music playback from the menu bar.

PlayStatus is a simple macOS app that allows the control of Spotify, Apple Music(macOS 10.15+) and iTunes including iTunes Radio/Beats1 playback from

A charmful decade with many colors patterns, disco music, and other cultural expressions that we refer to as vintage
A charmful decade with many colors patterns, disco music, and other cultural expressions that we refer to as vintage

MontyHallProblem Welcome to the 70s! 🕺 That is a charmful decade with many colors patterns, disco music, and other cultural expressions that we refer

App for searching music and films in iTunes
App for searching music and films in iTunes

inMovies App description: This is an app for searching contnent such as films and music in iTunes. Running the app brings you to page with following c

SleepingBaby - Track your kids activity and allow them sleep soundly with relaxing music in ONE app
SleepingBaby - Track your kids activity and allow them sleep soundly with relaxing music in ONE app

Sleeping Baby Скачать в AppStore. Ключевые используемые технологии: UIKit, MVVM,

MusicPlayer - Beautiful Music Player app built using SwiftUI to demonstrate Neumorphic design pattern and MVVM architecture
MusicPlayer - Beautiful Music Player app built using SwiftUI to demonstrate Neumorphic design pattern and MVVM architecture

Skailer 🎧 Beautiful Music Player app built using SwiftUI to demonstrate Neumorp

Cool Animated music indicator view written in Swift
Cool Animated music indicator view written in Swift

Cool Animated music indicator view written in Swift. ESTMusicIndicator is an implementation of NAKPlaybackIndicatorView in Swift for iOS 8. 本人著作的书籍《La

Analyser BPM in Swift for your music/sounds/records, whatever..
Analyser BPM in Swift for your music/sounds/records, whatever..

BPM-Analyser Analyser BPM in Swift for your music/sounds/records, whatever.. Powered with Superpowered Preview: How To: Copy theese files to your proj

Music Player NBC With Swift

MusicPlayer Xcode command + shift + Y - Debug 창 띄우기 command + R - App 실행 command + . - App 중지 ctrl + option + commadn + return(enter) - Assistant

Owner
null
Swift-music - swift-music is a swift package that provides an easy-to-use API for music related developments.

?? swift-music Introduction swift-music is a swift package that provides an easy-to-use API for music related developments. Currently available module

Jin Zhang 4 Feb 8, 2022
TuningFork is a simple utility for processing microphone input and interpreting pitch, frequency, amplitude, etc.

Overview TuningFork is a simple utility for processing microphone input and interpreting pitch, frequency, amplitude, etc. TuningFork powers the Parti

Comyar Zaheri 419 Dec 23, 2022
A pure Swift Spotify Music App in Apple Music style

HBMusic A pure Swift Spotify Music App in Apple Music style. How to run pod inst

haoboxuxu 6 Dec 29, 2021
Classical music front-end for Apple Music: iOS app

concertino_ios Concertino is a classical music front-end for Apple Music. It's splitted in several projects. This one provides only the iOS app. (Ther

Open Opus 107 Dec 22, 2022
iOS music player app that downloads music from the internet, even YouTube

About YouTag is an iOS music player app that downloads music from the internet, even YouTube, and manages it in a local library. Music videos can also

null 263 Jan 8, 2023
A note source and a rhythm source to create a new virtual MIDI instrument

MidiCombiner for Mac Combines inputs from 2 different MIDI sources: A note source and a rhythm source to create a new virtual MIDI instrument. The not

null 2 Jul 6, 2022
YiVideoEditor is a library for rotating, cropping, adding layers (watermark) and as well as adding audio (music) to the videos.

YiVideoEditor YiVideoEditor is a library for rotating, cropping, adding layers (watermark) and as well as adding audio (music) to the videos. YiVideoE

coderyi 97 Dec 14, 2022
MusicKit is a framework and DSL for creating, analyzing, and transforming music in Swift.

MusicKit MusicKit is a framework and DSL for creating, analyzing, and transforming music in Swift. Examples Functional harmony let C5 = Pitch(midi: 72

Ben Guo 591 Oct 18, 2022
🅿️ PandoraPlayer is a lightweight music player for iOS, based on AudioKit and completely written in Swift.

Made by Applikey Solutions Find this project on Dribbble Table of Contents Purpose Features Supported OS & SDK Versions Installation Usage Demo Releas

Applikey Solutions 1.1k Dec 26, 2022
Beautiful Music Player app built using SwiftUI to demonstrate Neumorphic design pattern and MVVM architecture.

Beautiful Music Player app built using SwiftUI to demonstrate Neumorphic design pattern ?? and MVVM architecture ?? . Made with love ❤️ by Sameer Nawaz

Sameer Nawaz 120 Jan 4, 2023