Skip to content

Commit 73cf6d1

Browse files
committed
Add new example for audio descriptor aribtrary target sorting
1 parent 0170a83 commit 73cf6d1

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

examples.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,17 @@
105105
print("\t-", similar_sound.name, "by", similar_sound.username)
106106
print()
107107

108+
# Search sounds and sort them by distance to a given audio descriptors target
109+
print("Sort sounds by distance to audio descriptors target:")
110+
print("---------------")
111+
results_pager = freesound_client.search(
112+
filter="pitch_var:[* TO 20]",
113+
sort='pitch_salience:1.0,pitch:440'
114+
)
115+
116+
for sound in results_pager:
117+
print("\t-", sound.name, "by", sound.username, "distance:", sound.distance_to_target)
118+
print()
108119

109120
# Getting sounds from a user example
110121
print("User sounds:")

0 commit comments

Comments
 (0)