Announcing a new public API query for accessing the cyanite audio waveform.
Library Track Waveform Query
The new cyanite API library track waveform query can be used to get a signed URL of the specific created waveform file. It will return a signed URL to the json file with an expiration time of 15 minutes.
Example query
This example queries the signed waveform url for the library track with the given id.
query LibraryTrackWaveformQuery($trackId: 123456) {
libraryTrackWaveform(trackId: $trackId) {
... on LibraryTrackWaveformError {
code
message
}
... on LibraryTrackWaveform {
waveformUrl
}
}
}
Example Result
The query result field libraryTrackWaveform.waveformUrl
can be used to download the waveform file.
{
"data": {
"libraryTrackWaveform": {
"waveformUrl": "https://api.cyanite.ai/example-signed-url.json"
}
}
}
Example Error (track not found)
{
"data": {
"libraryTrackWaveform": {
"code": "notFound",
"message": "Could not find library track."
}
}
}
Waveform file format
The waveform json file has a simple format. It contains the actual waveform data and some meta data from the audio. Here is an example how the waveform file can look like:
{
"version": 2,
"channels": 1,
"sample_rate": 44100,
"samples_per_pixel": 256,
"bits": 16,
"length": 5171,
"data": [...]
}