Cochlea allows users to annotate audio files on the internet. Segments or time intervals of audio can be annotated with text tags or arbitrary structured data hosted on another server.
Basic Auth is currently the only form of authentication supported.
Requests for most resources will return a 401 Unauthorized
response if
the Authorization
header is missing.
There are three types of users possible:
dataset
- can create both sounds and annotations, typically representing a related group of sounds on the internet, e.g the MusicNet dataset, the NSynth dataset, or some other collection of sound. Seensynth_dataset.py
for an example implementation.featurebot
- an auotmated user that will compute features for some or all sounds, e.g., a user that computes short-time fourier transforms for each sound and stores the data as serialized numpy arrays in an S3 bucket. Seefft_bot.py
for an example implementation.human
- a human user who is likely to interact with the API via a web-based GUI and may create annotations for sounds, likely adding textual tags to audio segments.
Sounds are typically created by dataset
users, and annotations simply
designate a segment or interval of the sound, along with optional text
tags or a pointer to an external resource that contains some structured
data (e.g., JSON or a serialized numpy array representing dense feature
vectors) that pertain to or describe that segment of audio.
Return some high-level stats about users, sounds and annotations
Successfully fetched stats
{
"totalSounds": 100,
"totalAnnotations": 1000,
"totalUsers": 3
}
Get a list of users
Name | Description |
---|---|
page_size |
The number of results per page |
page_number |
The page of results to view |
low_id |
Only return identifiers occurring later in the series than this one |
order |
If desc , return results from most to least recent, if asc return results from least to most recent. |
user_type |
Only return users with this type |
user_name |
Only return users matching this name |
Successfully fetched a list of users
{
"items": [
{
"id": "59341daa97551cf8e80b69ca98cb5",
"date_created": "2019-09-24T00:45:34.249316Z",
"user_name": "HalIncandenza",
"user_type": "human",
"email": "[email protected]",
"about_me": "Tennis 4 Life",
"info_url": "https://halation.com"
},
{
"id": "59341daa9759dbbe390b4b557fbd9",
"date_created": "2019-09-24T00:45:34.249381Z",
"user_name": "MikePemulis",
"user_type": "human",
"about_me": "Tennis 4 Life",
"info_url": "https://peemster.com"
},
{
"id": "59341daa975e9b1db1f21f1bd867e",
"date_created": "2019-09-24T00:45:34.249456Z",
"user_name": "MarioIncandenza",
"user_type": "human",
"about_me": "Movies 4 Life",
"info_url": "https://mario.com"
}
],
"total_count": 200,
"next": "/users?user_type=human&page_size=3&page_number=2"
}
Unauthorized request
User is not permitted to access this sound
Create a new user
{
"user_name": "HalIncandenza",
"password": "password",
"user_type": "human",
"email": "[email protected]",
"about_me": "Up and coming tennis star",
"info_url": "https://hal.eta.net"
}
Successful user creation
Input model validation error
Delete a user with the specified id. Users may only delete themselves.
Name | Description |
---|---|
user_id |
the identifier of the user to delete |
The user was deleted
The user id does not exist
Unauthorized request
User is not permitted to delete this user
Fetch an individual user by id. Some details, such as email, are only included when users fetch their own record
Name | Description |
---|---|
user_id |
the identifier of the user to fetch |
Successfully fetched a user
{
"id": "59341daa997dd70baa79b4a49ce04",
"date_created": "2019-09-24T00:45:34.258156Z",
"user_name": "HalIncandenza",
"user_type": "human",
"email": "[email protected]",
"about_me": "Tennis 4 Life",
"info_url": null,
"links": [
{
"href": "sounds",
"rel": "sounds",
"type": "GET"
},
{
"href": "annotations",
"rel": "annotations",
"type": "GET"
}
]
}
Provided an invalid user id
Unauthorized request
User is not permitted to access this user
Check if a user exists by id
Name | Description |
---|---|
user_id |
check if the user with user_id exists |
The requested user exists
The requested user does not exist
Unauthorized request
User is not permitted to access this user
Update information about the user
Name | Description |
---|---|
user_id |
the identifier of the user to update |
{
"about_me": "Here is some updated about me text",
"password": "Here|sANewPa$$w0rd"
}
The user was successfully updated
Input model validation error
Unauthorized request
User is not permitted to update this user
Get a list of sounds
Name | Description |
---|---|
page_size |
The number of results per page |
page_number |
The page of results to view |
low_id |
Only return identifiers occurring later in the series than this one |
created_by |
Only return sounds created by the user with this id |
Successfully fetched a list of sounds
{
"items": [
{
"id": "59341daa9bf5bd366c891fbd34ac5",
"date_created": "2019-09-24T00:45:34.268260Z",
"created_by": "/users/59341daa9bee6e288602685bf651b",
"created_by_user_name": "HalIncandenza",
"info_url": "https://example.com/sound1",
"audio_url": "https://example.com/sound1/file.wav",
"low_quality_audio_url": "https://example.com/sound1/file.mp3",
"license_type": "https://creativecommons.org/licenses/by/4.0",
"title": "First sound",
"duration_seconds": 12.3,
"tags": [
"test"
]
},
{
"id": "59341daa9bfa050c09c5e36563a91",
"date_created": "2019-09-24T00:45:34.268327Z",
"created_by": "/users/59341daa9bee6e288602685bf651b",
"created_by_user_name": "HalIncandenza",
"info_url": "https://example.com/sound2",
"audio_url": "https://example.com/sound2/file.wav",
"low_quality_audio_url": "https://example.com/sound2/file.mp3",
"license_type": "https://creativecommons.org/licenses/by/4.0",
"title": "Second sound",
"duration_seconds": 1.3,
"tags": [
"test"
]
},
{
"id": "59341daa9bfe020d60f4b2a64569d",
"date_created": "2019-09-24T00:45:34.268391Z",
"created_by": "/users/59341daa9bee6e288602685bf651b",
"created_by_user_name": "HalIncandenza",
"info_url": "https://example.com/sound3",
"audio_url": "https://example.com/sound3/file.wav",
"low_quality_audio_url": "https://example.com/sound3/file.mp3",
"license_type": "https://creativecommons.org/licenses/by/4.0",
"title": "Third sound",
"duration_seconds": 30.4,
"tags": [
"test"
]
}
],
"total_count": 100,
"next": "/sounds?page_number=2&page_size=3"
}
Unauthorized request
User is not permitted to access this sound
Create a new sound
{
"info_url": "https://archive.org/details/Greatest_Speeches_of_the_20th_Century",
"audio_url": "https://archive.org/download/Greatest_Speeches_of_the_20th_Century/AbdicationAddress.ogg",
"license_type": "https://creativecommons.org/licenses/by/4.0",
"title": "Abdication Address - King Edward VIII",
"duration_seconds": 402,
"tags": [
"speech"
]
}
Successful sound creation
Input model validation error
Unauthorized request
User is not permitted to create sounds
Fetch an individual sound
Name | Description |
---|---|
sound_id |
The identifier of the sound to fetch |
Successfully fetched sound
{
"id": "59341daa9d5e399a5f4e1feece82d",
"date_created": "2019-09-24T00:45:34.274034Z",
"created_by": "/users/59341daa9d5696a44cb43c7621dc8",
"created_by_user_name": "HalIncandenza",
"info_url": "https://example.com/sound",
"audio_url": "https://example.com/sound/file.wav",
"low_quality_audio_url": "https://example.com/sound/file.mp3",
"license_type": "https://creativecommons.org/licenses/by/4.0",
"title": "A sound",
"duration_seconds": 12.3,
"tags": [
"test"
],
"links": [
{
"href": "annotations",
"rel": "annotations",
"type": "GET"
}
]
}
The sound identifier supplied does not exist
Check if a sound exists by id
Name | Description |
---|---|
sound_id |
The identifier of the sound to fetch |
The sound identifier exists
The sound identifier does not exist
Get a list of annotations for the sound with id sound_id
Name | Description |
---|---|
sound_id |
The sound to list annotations for |
Name | Description |
---|---|
page_size |
The number of results per page |
page_number |
The page of results to view |
order |
If desc , return results from most to least recent, if asc return results from least to most recent. |
low_id |
Only return identifiers occurring later in the series than this one |
time_range |
Only return annotations overlapping with the specified time range |
Successfully fetched a list of annotations
{
"items": [
{
"id": "59341daa9eef8d7d36326fc308f8c",
"date_created": "2019-09-24T00:45:34.280446Z",
"created_by": "/users/59341daa9ee54ceacf56c0eeadaff",
"created_by_user_name": "HalIncandenza",
"sound": "/sounds/59341daa9eecf7cad5306a497b545",
"start_seconds": 1.0,
"duration_seconds": 1.0,
"end_seconds": 2.0,
"data_url": null,
"tags": [
"kick"
]
},
{
"id": "59341daa9ef1b30920d5d326bbf9d",
"date_created": "2019-09-24T00:45:34.280480Z",
"created_by": "/users/59341daa9ee54ceacf56c0eeadaff",
"created_by_user_name": "HalIncandenza",
"sound": "/sounds/59341daa9eecf7cad5306a497b545",
"start_seconds": 2.0,
"duration_seconds": 1.0,
"end_seconds": 3.0,
"data_url": null,
"tags": [
"snare"
]
},
{
"id": "59341daa9ef4bb71f85460b6dec2e",
"date_created": "2019-09-24T00:45:34.280530Z",
"created_by": "/users/59341daa9ee8caa596e54fb1d880b",
"created_by_user_name": "FFTBot",
"sound": "/sounds/59341daa9eecf7cad5306a497b545",
"start_seconds": 0.0,
"duration_seconds": 12.3,
"end_seconds": 12.3,
"data_url": "https://s3/fft-data/file.dat",
"tags": []
}
],
"total_count": 100,
"next": "/sounds/59341daa9eecf7cad5306a497b545/annotations?page_size=3&page_number=2"
}
Provided an unknown sound identifier
Unauthorized request
User is not permitted to access annotations for this sound
Create a new annotation for the sound with identifier sound_id
. Text tags can be added directly to the resource via the tags
field, or arbitrary binary or other structured data may be pointed to via the data_url
parameter.
Name | Description |
---|---|
sound_id |
The identifier of the sound to annotate |
{
"start_seconds": 1.2,
"duration_seconds": 0.5,
"tags": [
"snare",
"hi-hat"
],
"data_url": "https://s3/data/numpy-fft-feature.dat"
}
Successful annotation creation
Input model validation error
Provided an invalid sound_id
Unauthorized request
User is not permitted to create annotations
Get a list of sounds belonging to a user with id user_id
Name | Description |
---|---|
user_id |
The user who created the sounds |
Name | Description |
---|---|
page_size |
The number of results per page |
page_number |
The page of results to view |
low_id |
Only return identifiers occurring later in the series than this one |
order |
If desc , return results from most to least recent, if asc return results from least to most recent. |
tags |
Only return sounds with all tags specified |
Successfully fetched a list of sounds
{
"items": [
{
"id": "59341daaa11699827218fc98307ec",
"date_created": "2019-09-24T00:45:34.289265Z",
"created_by": "/users/59341daaa1115835d1b9118b3e53f",
"created_by_user_name": "HalIncandenza",
"info_url": "https://example.com/sound1",
"audio_url": "https://example.com/sound1/file.wav",
"low_quality_audio_url": "https://example.com/sound1/file.mp3",
"license_type": "https://creativecommons.org/licenses/by/4.0",
"title": "First sound",
"duration_seconds": 12.3,
"tags": [
"test"
]
},
{
"id": "59341daaa11b4c143c2b768914dcb",
"date_created": "2019-09-24T00:45:34.289339Z",
"created_by": "/users/59341daaa1115835d1b9118b3e53f",
"created_by_user_name": "HalIncandenza",
"info_url": "https://example.com/sound2",
"audio_url": "https://example.com/sound2/file.wav",
"low_quality_audio_url": "https://example.com/sound2/file.mp3",
"license_type": "https://creativecommons.org/licenses/by/4.0",
"title": "Second sound",
"duration_seconds": 1.3,
"tags": [
"test"
]
},
{
"id": "59341daaa11e7e96e145d9f46f945",
"date_created": "2019-09-24T00:45:34.289389Z",
"created_by": "/users/59341daaa1115835d1b9118b3e53f",
"created_by_user_name": "HalIncandenza",
"info_url": "https://example.com/sound3",
"audio_url": "https://example.com/sound3/file.wav",
"low_quality_audio_url": "https://example.com/sound3/file.mp3",
"license_type": "https://creativecommons.org/licenses/by/4.0",
"title": "Third sound",
"duration_seconds": 30.4,
"tags": [
"test"
]
}
],
"total_count": 100,
"next": "/users/59341daaa1115835d1b9118b3e53f/sounds?page_number=2&page_size=3"
}
Provided an unknown user identifier
Unauthorized request
User is not permitted to access sounds from this user
List annotations created by a user with id user_id
Name | Description |
---|---|
user_id |
The user who created the annotations |
Name | Description |
---|---|
page_size |
The number of results per page |
page_number |
The current page |
order |
If desc , return results from most to least recent, if asc return results from least to most recent. |
Successfully fetched a list of annotations
{
"items": [
{
"id": "59341daaa1ed76d5306987eb82b23",
"date_created": "2019-09-24T00:45:34.292701Z",
"created_by": "/users/59341daaa1e6015de9ec9d58362c6",
"created_by_user_name": "HalIncandenza",
"sound": "/sounds/59341daaa1eacf428a0ae07844068",
"start_seconds": 1.0,
"duration_seconds": 1.0,
"end_seconds": 2.0,
"data_url": null,
"tags": [
"kick"
]
},
{
"id": "59341daaa1efd825699fad93b5eb2",
"date_created": "2019-09-24T00:45:34.292738Z",
"created_by": "/users/59341daaa1e6015de9ec9d58362c6",
"created_by_user_name": "HalIncandenza",
"sound": "/sounds/59341daaa1eacf428a0ae07844068",
"start_seconds": 2.0,
"duration_seconds": 1.0,
"end_seconds": 3.0,
"data_url": null,
"tags": [
"snare"
]
}
],
"total_count": 100,
"next": "/users/59341daaa1e6015de9ec9d58362c6/annotations?page_size=2&page_number=2"
}
Provided an unknown user identifier
Unauthorized request
User is not permitted to access annotationsfrom this user
Get a list of annotations
Name | Description |
---|---|
page_size |
The number of results per page |
page_number |
The page of results to view |
low_id |
Only return identifiers occurring later in the series than this one |
order |
If desc , return results from most to least recent, if asc return results from least to most recent. |
tags |
Only return annotations with all specified tags |
with_tags |
Only return annotations that have at least one tag, generally excluding dense features computed by featurebots. This parameter is mutually exclusive with tags and will be ignored if it is present. |
Successfully fetched an annotation
{
"items": [
{
"id": "59341daaa2c86401514e5c5f456bb",
"date_created": "2019-09-24T00:45:34.296203Z",
"created_by": "/users/59341daaa2be88d098d24fcb16704",
"created_by_user_name": "HalIncandenza",
"sound": "/sounds/59341daaa2c2e9233a321e1d724ff",
"start_seconds": 1.0,
"duration_seconds": 1.0,
"end_seconds": 2.0,
"data_url": null,
"tags": [
"snare"
]
},
{
"id": "59341daaa2ca70196373aa3837f19",
"date_created": "2019-09-24T00:45:34.296236Z",
"created_by": "/users/59341daaa2be88d098d24fcb16704",
"created_by_user_name": "HalIncandenza",
"sound": "/sounds/59341daaa2c2e9233a321e1d724ff",
"start_seconds": 2.0,
"duration_seconds": 1.0,
"end_seconds": 3.0,
"data_url": null,
"tags": [
"snare"
]
},
{
"id": "59341daaa2cc7aae5533badcd00ea",
"date_created": "2019-09-24T00:45:34.296268Z",
"created_by": "/users/59341daaa2be88d098d24fcb16704",
"created_by_user_name": "HalIncandenza",
"sound": "/sounds/59341daaa2c635b9eabb9427e208f",
"start_seconds": 10.0,
"duration_seconds": 5.0,
"end_seconds": 15.0,
"data_url": null,
"tags": [
"snare"
]
}
],
"total_count": 100,
"next": "/annotations?page_size=3&page_number=2&tags=snare"
}
Unauthorized request
User is not permitted to access this annotation