{"id":32143182,"url":"https://github.com/wallisch/chromaswift","last_synced_at":"2025-10-21T07:54:03.946Z","repository":{"id":107295024,"uuid":"376166104","full_name":"wallisch/ChromaSwift","owner":"wallisch","description":"Swift wrapper for Chromaprint, the audio fingerprint library of the AcoustID project","archived":false,"fork":false,"pushed_at":"2025-09-18T21:08:34.000Z","size":7338,"stargazers_count":20,"open_issues_count":0,"forks_count":5,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-21T07:53:58.294Z","etag":null,"topics":["acoustid","audio","audio-analysis","audio-fingerprinting","audio-processing","chromaprint","music","spm","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wallisch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-06-11T23:53:47.000Z","updated_at":"2025-10-17T15:20:52.000Z","dependencies_parsed_at":"2024-03-27T00:31:59.821Z","dependency_job_id":"d6ae6f5e-607f-4c76-8ce1-f9e18ccb21cc","html_url":"https://github.com/wallisch/ChromaSwift","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/wallisch/ChromaSwift","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallisch%2FChromaSwift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallisch%2FChromaSwift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallisch%2FChromaSwift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallisch%2FChromaSwift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wallisch","download_url":"https://codeload.github.com/wallisch/ChromaSwift/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wallisch%2FChromaSwift/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280225806,"owners_count":26293888,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["acoustid","audio","audio-analysis","audio-fingerprinting","audio-processing","chromaprint","music","spm","swift"],"created_at":"2025-10-21T07:54:02.168Z","updated_at":"2025-10-21T07:54:03.938Z","avatar_url":"https://github.com/wallisch.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ChromaSwift\n\n![Platform](https://img.shields.io/badge/Platform-macOS%20%7C%20iOS%20%7C%20tvOS-inactive)\n[![Swift](https://img.shields.io/badge/Swift-6-orange)](https://swift.org/)\n[![SPM](https://img.shields.io/badge/SPM-compatible-success)](https://swift.org/package-manager/)\n[![Unit Tests](https://github.com/wallisch/ChromaSwift/actions/workflows/unit_tests.yml/badge.svg)](https://github.com/wallisch/ChromaSwift/actions/workflows/unit_tests.yml)\n[![codecov](https://codecov.io/gh/wallisch/ChromaSwift/branch/master/graph/badge.svg?token=Y9IMV4347N)](https://codecov.io/gh/wallisch/ChromaSwift)\n\nSwift wrapper for [Chromaprint](https://github.com/acoustid/chromaprint), the audio fingerprint library of the [AcoustID](https://acoustid.org/) project\n\n## Installation\n\nAdd `https://github.com/wallisch/ChromaSwift` as SwiftPM dependency and `import ChromaSwift`\n\n## Usage\n\n### Generating fingerprints\n\nGenerate fingerprint of a file containing an audio track by URL. This also works for video files (e.g. music videos)\n\n``` swift\nlet fileURL = URL(fileURLWithPath: \"Test.mp3\")\nlet testFingerprint = try AudioFingerprint(from: fileURL)\n```\n\nOptionally, specify the AudioFingerprintAlgorithm (Default: `.test2`)\n\nYou can remove leading silence with`.test4`\n\n*Warning: Only `.test2` fingerprints can be looked up at the AcoustID service*\n\n``` swift\nlet testFingerprint = try AudioFingerprint(from: fileURL, algorithm: .test4)\n```\n\nAnd / Or the maximum duration to sample in seconds (Default: `120`). Pass `nil` to sample the entire file\n\n``` swift\nlet testFingerprint = try AudioFingerprint(from: fileURL, maxSampleDuration: 10.0)\n```\n\n### Handling fingerprints\n\nGet the algorithm that was used to generate the fingerprint\n\n``` swift\nlet algorithm = testFingerprint.algorithm // AudioFingerprint.Algorithm.test2\n```\n\nGet the duration of the entire file in seconds\n\n``` swift\nlet duration = testFingerprint.duration // 46.0\n```\n\nGet the fingerprint in its raw form as an array of unsigned 32 bit integers\n\n``` swift\nlet rawFingerprint = testFingerprint.raw // [4107342261, 4107276695, ... ]\n```\n\nGet the fingerprint as base64 representation\n\n``` swift\nlet base64FingerprintString = testFingerprint.base64 // \"AQABYJGikFSmJBCPijt6Hq...\"\n```\n\nGet the fingerprints hash as binary string\n\n``` swift\nlet binaryHashString = testFingerprint.hash // \"01110100010011101010100110100100\"\n```\n\nInstantiate a fingerprint object from its raw form, algorithm and and entire file duration\n\n``` swift\nlet newFingerprint = AudioFingerprint(from: rawFingerprint, algorithm: .test2, duration: duration)\n```\n\nInstantiate a fingerprint object from its base64 representation and entire file duration\n\n``` swift\nlet newFingerprint = try AudioFingerprint(from: base64FingerprintString, duration: duration)\n```\n\nGet similarity to other fingerprint object (`0.0` to `1.0`)\n\n``` swift\nlet similarity = try newFingerprint.similarity(to: testFingerprint) // 1.0\n```\n\nOptionally, ignore sample duration differences greater than 20% between fingerprints (Default: `false`)\n\nThis is useful if you want to e.g. check if a a longer mix contains a specific track\n\n*Warning: This can lead to wrong results when comparing with Fingerprints sampled for a very short duration*\n\n``` swift\ntry newFingerprint.similarity(to: testFingerprint, ignoreSampleDuration: true) // 1.0\n```\n\nYou can also get the similarity to a fingerprint hash\n\n*Warning: This is less accurate than comparing fingerprint objects, especially if the algorithms don't match*\n\n``` swift\ntry newFingerprint.similarity(to: binaryHashString) // 1.0\n```\n\n### Looking up fingerprints\n\nInit the service with your AcoustID API key\n\n``` swift\nlet acoustID = AcoustID(apiKey: \"zfkYWDrOqAk\")\n```\n\nOptionally, specify a timeout in seconds (Default: `3.0`)\n\n``` swift\nlet acoustID = AcoustID(apiKey: \"zfkYWDrOqAk\", timeout: 10.0)\n```\n\nLookup an AudioFingerprint object\n\n``` swift\ndo {\n    let results = try await acoustID.lookup(newFingerprint)\n    // [AcoustID.APIResult]\n    for result in results {\n        // Matching score (0.0 to 1.0)\n        let score = result.score\n        for recording in result.recordings! {\n            // Song title\n            let title = recording.title\n            // Song artists\n            let artists = recording.artists\n            // Song release groups (Albums, Singles, etc.)\n            let releasegroups = recording.releasegroups\n        }\n    }\n} catch {\n    // AcoustID.Error\n}\n```\n\n### Handling errors\n\nThe `AudioFingerprint` class throws either `AudioDecoder.Error` or `AudioFingerprint.Error` errors, the `AcoustID` class throws `AcoustID.Error` errors.\n\n### Accessing Chromaprints C API\n\nYou can also `import CChromaprint` to directly interact with Chromaprints C interface. Please refer to the official documentation for further information.\n\n*Note: To avoid licensing issues, CChromaprint has internal input resampling disabled and thus requires that input audio for the fingerprinter is already at the configured fingerprint sample rate.*\n\n### Licensing\n\nThis package is distributed under the MIT license, see the LICENSE file for details.\n\nThe chromaprint project by default includes resampling code from the ffmpeg library, which is licensed under LGPL 2.1. ChromaSwift however uses Apples AVFoundation for resampling and removes all ffmpeg code from the build, making the package fully MIT compliant.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwallisch%2Fchromaswift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwallisch%2Fchromaswift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwallisch%2Fchromaswift/lists"}