---
title: SHSession
framework: shazamkit
role: symbol
role_heading: Class
path: shazamkit/shsession
---

# SHSession

An object that matches a specific audio recording when a segment of that recording is part of captured sound in the Shazam catalog or your custom catalog.

## Declaration

```swift
class SHSession
```

## Mentioned in

Matching audio using the built-in microphone

## Overview

Overview Prepare to make matches by: Creating a session for the catalog that contains the reference signatures Adding your delegate that receives the match results Search for a match in one of two ways: Generate a signature for the captured audio and call match(_:) Call matchStreamingBuffer(_:at:) with a streaming audio buffer, and ShazamKit generates the signature for you Searching the catalog is asynchronous. The session calls your delegate methods with the result. Matching audio against the Shazam catalog requires enabling your app to access the catalog. If you are using a custom catalog, you don’t need to enable ShazamKit. For more information on enabling your app, see Enable ShazamKit for an App ID. The code below shows searching for a match in the Shazam catalog using an existing audio buffer: // Set up the session. let session = SHSession()

// Create a signature from the captured audio buffer. let signatureGenerator = SHSignatureGenerator() try signatureGenerator.append(buffer, at: audioTime) let signature = signatureGenerator.signature()

// Check for a match. let result = await session.result(from: signature)

// Use the result. switch result {  case .match(let match):       // Match found.  case .noMatch(let signature):       // No match found.  case .error(let error, let signature):       // An error occurred. }

## Topics

### Creating a session object

- [init()](shazamkit/shsession/init().md)
- [init(catalog:)](shazamkit/shsession/init(catalog:).md)

### Making a match

- [match(_:)](shazamkit/shsession/match(_:).md)
- [matchStreamingBuffer(_:at:)](shazamkit/shsession/matchstreamingbuffer(_:at:).md)
- [Matching audio using the built-in microphone](shazamkit/matching-audio-using-the-built-in-microphone.md)

### Reading the session properties

- [delegate](shazamkit/shsession/delegate.md)
- [catalog](shazamkit/shsession/catalog.md)
- [results](shazamkit/shsession/results-swift.property.md)
- [SHSession.Results](shazamkit/shsession/results-swift.struct.md)

### Returning queries

- [result(from:)](shazamkit/shsession/result(from:).md)
- [SHSession.Result](shazamkit/shsession/result.md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Match audio

- [SHManagedSession](shazamkit/shmanagedsession.md)
- [SHSessionDelegate](shazamkit/shsessiondelegate.md)
- [SHMatch](shazamkit/shmatch.md)
- [SHMatchedMediaItem](shazamkit/shmatchedmediaitem.md)
- [SHMediaItem](shazamkit/shmediaitem.md)
