View in English

  • Apple Developer
    • Get Started

    Explore Get Started

    • Overview
    • Learn
    • Apple Developer Program

    Stay Updated

    • Latest News
    • Hello Developer
    • Platforms

    Explore Platforms

    • Apple Platforms
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store

    Featured

    • Design
    • Distribution
    • Games
    • Accessories
    • Web
    • Home
    • CarPlay
    • Technologies

    Explore Technologies

    • Overview
    • Xcode
    • Swift
    • SwiftUI

    Featured

    • Accessibility
    • App Intents
    • Apple Intelligence
    • Games
    • Machine Learning & AI
    • Security
    • Xcode Cloud
    • Community

    Explore Community

    • Overview
    • Meet with Apple events
    • Community-driven events
    • Developer Forums
    • Open Source

    Featured

    • WWDC
    • Swift Student Challenge
    • Developer Stories
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Centers
    • Documentation

    Explore Documentation

    • Documentation Library
    • Technology Overviews
    • Sample Code
    • Human Interface Guidelines
    • Videos

    Release Notes

    • Featured Updates
    • iOS
    • iPadOS
    • macOS
    • watchOS
    • visionOS
    • tvOS
    • Xcode
    • Downloads

    Explore Downloads

    • All Downloads
    • Operating Systems
    • Applications
    • Design Resources

    Featured

    • Xcode
    • TestFlight
    • Fonts
    • SF Symbols
    • Icon Composer
    • Support

    Explore Support

    • Overview
    • Help Guides
    • Developer Forums
    • Feedback Assistant
    • Contact Us

    Featured

    • Account Help
    • App Review Guidelines
    • App Store Connect Help
    • Upcoming Requirements
    • Agreements and Guidelines
    • System Status
  • Quick Links

    • Events
    • News
    • Forums
    • Sample Code
    • Videos
 

Videos

Abrir menú Cerrar menú
  • Colecciones
  • Todos los videos
  • Información

Más videos

  • Información
  • Código
  • Create custom catalogs at scale with ShazamKit

    Learn how ShazamKit can help you build custom catalogs and support exact matching of any audio source within your app — all on-device. Find out how you can easily generate audio signatures and build catalogs at scale through the new ShazamKit CLI. We'll also show you how you can quickly update your app to sync with large amounts of audio content like multiple seasons of a TV show or multiple episodes of a podcast, and we'll share updates to the ShazamKit API and SHMediaItems to help your apps respond precisely to key moments in audio sources using time ranges.

    For more on ShazamKit, we recommend watching "Explore ShazamKit" and "Create custom audio experiences with ShazamKit" from WWDC21.

    Recursos

    • ShazamKit
      • Video HD
      • Video SD

    Videos relacionados

    WWDC23

    • Create a great ShazamKit experience

    WWDC21

    • Create custom audio experiences with ShazamKit
    • Explore ShazamKit
  • Buscar este video…
    • 4:26 - Food Math Matcher

      /*
      See LICENSE folder for this sample’s licensing information.
      
      Abstract:
      The model that is responsible for matching against the catalog and update the SwiftUI Views.
      */
      
      import ShazamKit
      import AVFAudio
      
      struct MatchResult {
          var title: String?
          var equation: Equation?
          var episode: Episode?
          var answerRange: ClosedRange<Int>?
          
          var hasContent: Bool {
              equation != nil || title != nil || answerRange != nil
          }
      }
      
      class Matcher: NSObject, ObservableObject, SHSessionDelegate {
          @Published var matchResult: MatchResult?
          
          private var session: SHSession!
          private let audioEngine = AVAudioEngine()
          private var matchingTask: Task<Void, Never>? = nil
          
          func match(catalog: SHCustomCatalog) throws {
              
              session = SHSession(catalog: catalog)
              session.delegate = self
              
              let audioFormat = AVAudioFormat(standardFormatWithSampleRate: audioEngine.inputNode.outputFormat(forBus: 0).sampleRate,
                                              channels: 1)
              audioEngine.inputNode.installTap(onBus: 0, bufferSize: 2048, format: audioFormat) { [weak session] buffer, audioTime in
                  session?.matchStreamingBuffer(buffer, at: audioTime)
              }
              
              try AVAudioSession.sharedInstance().setCategory(.record)
              AVAudioSession.sharedInstance().requestRecordPermission { [weak self] success in
                  guard success, let self = self else { return }
                  
                  Task.detached {
                      try? self.audioEngine.start()
                  }
              }
              
              Task { @MainActor in
                  for await case .match(let match) in session.results {
                      self.matchResult = match.matchResult
                  }
              }
          }
      }
      
      extension SHMatch {
      
          var matchResult: MatchResult {
              mediaItems.reduce(into: MatchResult()) { result, mediaItem in
                  result.title = result.title ?? mediaItem.title
                  result.episode = result.episode ?? mediaItem.episode
                  result.equation = result.equation ?? mediaItem.equation
                  result.answerRange = result.answerRange ?? mediaItem.answerRange
              }
          }
      }
    • 13:51 - Timed Media Items

      // Restrict this media item to only describe the first 5 seconds
      
       let mediaItem = SHMediaItem(properties: [
                  .title: "Title",
                  .timeRanges:[0.0..<5.0]
              ])
      
       let timeRanges: [Range<TimeInterval>] = mediaItem.timeRanges
    • 16:02 - Combine Catalogs

      let parentCatalog = SHCustomCatalog()
      
      parentCatalog.add(from: URL(fileURLWithPath: "/path/to/Episode1.shazamcatalog"))
      parentCatalog.add(from: URL(fileURLWithPath: "/path/to/Episode2.shazamcatalog"))
      parentCatalog.add(from: URL(fileURLWithPath: "/path/to/Episode3.shazamcatalog"))
    • 16:58 - Frequency Skew

      func within(range: Range<Float>, for matchedMediaItem: SHMatchedMediaItem) -> Bool {
              
      	range.contains(matchedMediaItem.frequencySkew)
      }
    • 17:21 - Frequency Skew Ranges

      // Restrict this media item to only describe the first 5 seconds
      
       let mediaItem = SHMediaItem(properties: [
                  .title: “Frequency Skewed Audio”,
                  .frequencySkewRanges:[0.01..<0.02]
              ])
      
       let frequencySkewRanges: [Range<Float>] = mediaItem.frequencySkewRanges

Developer Footer

  • Videos
  • WWDC22
  • Create custom catalogs at scale with ShazamKit
  • Open Menu Close Menu
    • iOS
    • iPadOS
    • macOS
    • tvOS
    • visionOS
    • watchOS
    • App Store
    Open Menu Close Menu
    • Swift
    • SwiftUI
    • Swift Playground
    • TestFlight
    • Xcode
    • Xcode Cloud
    • Icon Composer
    • SF Symbols
    Open Menu Close Menu
    • Accessibility
    • Accessories
    • Apple Intelligence
    • Audio & Video
    • Augmented Reality
    • Business
    • Design
    • Distribution
    • Education
    • Games
    • Health & Fitness
    • In-App Purchase
    • Localization
    • Maps & Location
    • Machine Learning & AI
    • Security
    • Safari & Web
    Open Menu Close Menu
    • Documentation
    • Downloads
    • Sample Code
    • Videos
    Open Menu Close Menu
    • Help Guides & Articles
    • Contact Us
    • Forums
    • Feedback & Bug Reporting
    • System Status
    Open Menu Close Menu
    • Apple Developer
    • App Store Connect
    • Certificates, IDs, & Profiles
    • Feedback Assistant
    Open Menu Close Menu
    • Apple Developer Program
    • Apple Developer Enterprise Program
    • App Store Small Business Program
    • MFi Program
    • Mini Apps Partner Program
    • News Partner Program
    • Video Partner Program
    • Security Bounty Program
    • Security Research Device Program
    Open Menu Close Menu
    • Meet with Apple
    • Apple Developer Centers
    • App Store Awards
    • Apple Design Awards
    • Apple Developer Academies
    • WWDC
    Read the latest news.
    Get the Apple Developer app.
    Copyright © 2026 Apple Inc. All rights reserved.
    Terms of Use Privacy Policy Agreements and Guidelines