Skip to content

Commit

Permalink
(Build) Modify tempo and duration response formats
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabrielparizet committed Apr 3, 2023
1 parent 6dc6647 commit f7700ac
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion api/length_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def find_length(filename):
# Get the duration of our audiofile in seconds with librosa get_duration method.
duration = librosa.get_duration(y=y, sr=sr)
file_duration = seconds_to_minutes(duration)
return f'Your audio file is {file_duration} long.'
return file_duration


# The seconds_to_minutes function takes time in float as an argument and converts it to string giving its time in minutes and seconds.
Expand Down
2 changes: 1 addition & 1 deletion api/tempo_detector.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def find_tempo(filename):
# librosa.beat.beat_track is used to calculate the tempo of the audio file based on its beat frames, which are stored in beat_frames.
tempo, beat_frames = librosa.beat.beat_track(y=y, sr=sr)
file_tempo = format_tempo(tempo)
return f'Your audio file tempo is of {file_tempo} bpm.'
return file_tempo

# format_tempo takes a floating-point number and returns a string representation of that number with two decimal places.
def format_tempo(float):
Expand Down

0 comments on commit f7700ac

Please sign in to comment.