Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement RecordingFileObject class #82

Merged
merged 5 commits into from
Aug 26, 2023
Merged

Implement RecordingFileObject class #82

merged 5 commits into from
Aug 26, 2023

Conversation

joeweiss
Copy link
Owner

@joeweiss joeweiss commented Aug 25, 2023

Implements RecordingFileObject, which takes an audio file as an in-memory Python file object. For analyzing a array buffer, see RecordingBuffer.

Example:

import requests
import io

from datetime import datetime
from pprint import pprint
from birdnetlib import RecordingFileObject
from birdnetlib.analyzer import Analyzer

# Mississippi Kite from Xeno-Canto.
r = requests.get("https://xeno-canto.org/669899/download")
analyzer = Analyzer()

with io.BytesIO(r.content) as fileObj:
    recording = RecordingFileObject(
        analyzer,
        fileObj,
        lat=35.6,
        lon=-77.3,
        date=datetime(year=2023, month=6, day=27),  # use date or week_48
        min_conf=0.25,
    )
    recording.analyze()
    pprint(recording.detections)

@joeweiss
Copy link
Owner Author

Closes #79.

@joeweiss joeweiss merged commit 2452913 into main Aug 26, 2023
3 checks passed
@joeweiss joeweiss deleted the recording-file-object branch August 26, 2023 19:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant