Skip to content

Commit b03923d

Browse files
committed
finish documentation
Signed-off-by: Adam Ratzman <adam@adamratzman.com>
1 parent f3cd1a4 commit b03923d

File tree

1 file changed

+69
-10
lines changed

1 file changed

+69
-10
lines changed

src/main/kotlin/com/adamratzman/spotify/utils/ResultObjects.kt

Lines changed: 69 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,12 @@ data class VideoThumbnail(val url: String?)
3333
*/
3434
data class Restrictions(val reason: String)
3535

36-
data class AudioBar(val start: Float, val duration: Float, val confidence: Float)
37-
38-
data class AudioBeat(val start: Float, val duration: Float, val confidence: Float)
39-
40-
data class AudioTatum(val start: Float, val duration: Float, val confidence: Float)
36+
/**
37+
* @property start The starting point (in seconds) of the time interval.
38+
* @property duration The duration (in seconds) of the time interval.
39+
* @property confidence The confidence, from 0.0 to 1.0, of the reliability of the interval
40+
*/
41+
data class TimeInterval(val start: Float, val duration: Float, val confidence: Float)
4142

4243
data class Context(
4344
@Json(name = "external_urls") val externalUrls: HashMap<String, String>
@@ -594,17 +595,31 @@ data class Playlist(
594595

595596
/**
596597
* @property seeds An array of recommendation seed objects.
597-
* @property An array of track object (simplified) ordered according to the parameters supplied.
598+
* @property tracks An array of track object (simplified) ordered according to the parameters supplied.
598599
*/
599600
data class RecommendationResponse(val seeds: List<RecommendationSeed>, val tracks: List<SimpleTrack>)
600601

602+
/**
603+
* @param bars The time intervals of the bars throughout the track. A bar (or measure) is a segment of time defined as
604+
* a given number of beats. Bar offsets also indicate downbeats, the first beat of the measure.
605+
* @param beats The time intervals of beats throughout the track. A beat is the basic time unit of a piece of music;
606+
* for example, each tick of a metronome. Beats are typically multiples of tatums.
607+
* @param meta Analysis meta information (limited use)
608+
* @param sections Sections are defined by large variations in rhythm or timbre, e.g. chorus, verse, bridge, guitar
609+
* solo, etc. Each section contains its own descriptions of tempo, key, mode, time_signature, and loudness.
610+
* @param segments Audio segments attempts to subdivide a song into many segments, with each segment containing
611+
* a roughly consitent sound throughout its duration.
612+
* @param tatums A tatum represents the lowest regular pulse train that a listener intuitively infers from the timing
613+
* of perceived musical events (segments).
614+
* @param track An analysis of the track as a whole. Undocumented on Spotify's side.
615+
*/
601616
data class AudioAnalysis(
602-
val bars: List<AudioBar>,
603-
val beats: List<AudioBeat>,
617+
val bars: List<TimeInterval>,
618+
val beats: List<TimeInterval>,
604619
val meta: AudioAnalysisMeta,
605620
val sections: List<AudioSection>,
606621
val segments: List<AudioSegment>,
607-
val tatums: List<AudioTatum>,
622+
val tatums: List<TimeInterval>,
608623
val track: TrackAnalysis
609624
)
610625

@@ -618,6 +633,32 @@ data class AudioAnalysisMeta(
618633
@Json(name = "input_process") val inputProcess: String
619634
)
620635

636+
/**
637+
* @param start The starting point (in seconds) of the section.
638+
* @param duration The duration (in seconds) of the section.
639+
* @param confidence The confidence, from 0.0 to 1.0, of the reliability of the section’s “designation”.
640+
* @param loudness The overall loudness of the section in decibels (dB). Loudness values are useful
641+
* for comparing relative loudness of sections within tracks.
642+
* @param tempo The overall estimated tempo of the section in beats per minute (BPM). In musical terminology, tempo
643+
* is the speed or pace of a given piece and derives directly from the average beat duration.
644+
* @param tempoConfidence The confidence, from 0.0 to 1.0, of the reliability of the tempo. Some tracks contain tempo
645+
* changes or sounds which don’t contain tempo (like pure speech) which would correspond to a low value in this field.
646+
* @param key The estimated overall key of the section. The values in this field ranging from 0 to 11 mapping to
647+
* pitches using standard Pitch Class notation (E.g. 0 = C, 1 = C♯/D♭, 2 = D, and so on). If no key was detected,
648+
* the value is -1.
649+
* @param keyConfidence The confidence, from 0.0 to 1.0, of the reliability of the key.
650+
* Songs with many key changes may correspond to low values in this field.
651+
* @param mode Indicates the modality (major or minor) of a track, the type of scale from which its melodic content is
652+
* derived. This field will contain a 0 for “minor”, a 1 for “major”, or a -1 for no result. Note that the major key
653+
* (e.g. C major) could more likely be confused with the minor key at 3 semitones lower (e.g. A minor) as both
654+
* keys carry the same pitches.
655+
* @param modeConfidence The confidence, from 0.0 to 1.0, of the reliability of the mode.
656+
* @param timeSignature An estimated overall time signature of a track. The time signature (meter) is a notational
657+
* convention to specify how many beats are in each bar (or measure). The time signature ranges from 3 to 7
658+
* indicating time signatures of “3/4”, to “7/4”.
659+
* @param timeSignatureConfidence The confidence, from 0.0 to 1.0, of the reliability of the time_signature.
660+
* Sections with time signature changes may correspond to low values in this field.
661+
*/
621662
data class AudioSection(
622663
val start: Float,
623664
val duration: Float,
@@ -629,10 +670,28 @@ data class AudioSection(
629670
@Json(name = "key_confidence") val keyConfidence: Float,
630671
val mode: Int,
631672
@Json(name = "mode_confidence") val modeConfidence: Float,
632-
val time_signature: Int,
673+
@Json(name="time_signature") val timeSignature: Int,
633674
@Json(name = "time_signature_confidence") val timeSignatureConfidence: Float
634675
)
635676

677+
/**
678+
* @param start The starting point (in seconds) of the segment.
679+
* @param duration The duration (in seconds) of the segment.
680+
* @param confidence The confidence, from 0.0 to 1.0, of the reliability of the segmentation. Segments of the song which
681+
* are difficult to logically segment (e.g: noise) may correspond to low values in this field.
682+
* @param loudnessStart The onset loudness of the segment in decibels (dB). Combined with loudness_max and
683+
* loudness_max_time, these components can be used to desctibe the “attack” of the segment.
684+
* @param loudnessMaxTime The segment-relative offset of the segment peak loudness in seconds. Combined with
685+
* loudness_start and loudness_max, these components can be used to desctibe the “attack” of the segment.
686+
* @param loudnessMax The peak loudness of the segment in decibels (dB). Combined with loudness_start and
687+
* loudness_max_time, these components can be used to desctibe the “attack” of the segment.
688+
* @param loudnessEnd The offset loudness of the segment in decibels (dB). This value should be equivalent to the
689+
* loudness_start of the following segment.
690+
* @param pitches A “chroma” vector representing the pitch content of the segment, corresponding to the 12 pitch classes
691+
* C, C#, D to B, with values ranging from 0 to 1 that describe the relative dominance of every pitch in the chromatic scale
692+
* @param timbre Timbre is the quality of a musical note or sound that distinguishes different types of musical
693+
* instruments, or voices. Timbre vectors are best used in comparison with each other.
694+
*/
636695
data class AudioSegment(
637696
val start: Float,
638697
val duration: Float,

0 commit comments

Comments
 (0)