Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
210 views
in Technique[技术] by (71.8m points)

Read a diagram plotted with Librosa (Python) and create (e.g.) an audio file from it

I use the module Librosa in Python to make a "click-beat-diagram" to a song (.wav-file). Please read the short explanation on the Librosa-website here.

I use the following code:

import librosa
import matplotlib.pyplot as plt

#loading the music-file (wav)
y, sr = librosa.load("C://Users/Max/Downloads/example.wav", duration=30)

fig, ax = plt.subplots(nrows=2, sharex=True)

#plotting the diagram
librosa.display.waveplot(y_beat_times, sr=sr, label='Beat clicks', ax=ax[1])
ax[0].legend()
ax[0].label_outer()
ax[0].set_title(None)

This plots a diagram, which shows click-signals depending on the time. It looks like this:

diagram - plottet "clicks"

My question now is, if it is possible to read out this diagram and for example play a sound every time a click signal comes (the diagram makes a spike)? That is, to make an mp3 file from this diagram, for example.

It would be very helpful if someone could tell me an idea how to do this.

Thanks in advance

P.S.:I know there is already a similar question, but it does not relate to Librosa and is also not so well understood by me.

question from:https://stackoverflow.com/questions/65844728/read-a-diagram-plotted-with-librosa-python-and-create-e-g-an-audio-file-fro

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...