python audio url streaming reading and change the volume depending on "music" or "speaking"

567 views
Skip to first unread message

X Rob

unread,
Apr 6, 2022, 1:42:18 PM4/6/22
to librosa
Raspberry Pi - python - audio - url streaming VRT Radio 1
MP3: http://icecast.vrtcdn.be/radio1-high.mp3
MP3 (less data): http://icecast.vrtcdn.be/radio1-mid.mp3
AAC: http://icecast.vrtcdn.be/radio1.aac
How can I read this audio from internet and change the volume depending on "music" or "speaking".
Is Librosa a way to detect “music” ?
How can I read audio from internet with Librosa ?

(info-radio : the volume of music is always higher than the speaking)
------------------------
What I already found :
Reading :
https://github.com/librosa/librosa/issues/652
https://librosa.org/doc/main/ioformats.html
Download and read from URL:

import soundfile as sf
import io
from six.moves.urllib.request import urlopen
url = "https://raw.githubusercontent.com/librosa/librosa/master/tests/data/test1_44100.wav"
data, samplerate = sf.read(io.BytesIO(urlopen(url).read()))
---
What I don't understand in "audio", I never see a While with reading and writing "data"
The writing is at the end of the reading ?
So you had to wait the whole input ?
But if you stream from internet without ending ?
---
Analyse :
Can I determine "music" with "tempo" and "beats" ?
https://librosa.org/doc/main/generated/librosa.beat.beat_track.html
Track beats using time series input

y, sr = librosa.load(librosa.ex('choice'), duration=10)
tempo, beats = librosa.beat.beat_track(y=y, sr=sr)

tempo : 135.99917763157896

Print the frames corresponding to beats

beats : array([  3,  21,  40,  59,  78,  96, 116, 135, 154, 173, 192, 211,
       230, 249, 268, 287, 306, 325, 344, 363])

---
Modifying volume

Is it possible with Librosa ?

I'm new in sound/audio, it would be great if you could help me.
Reply all
Reply to author
Forward
0 new messages