asking for how to use the madmom online mode on the raspberry pi

152 views
Skip to first unread message

yangy...@gmail.com

unread,
May 11, 2018, 5:54:46 AM5/11/18
to madmom-users
I did everything good on my own computer, but when I try to apply  DBNBeatTracker online on the raspberry pi 3, it will stuck. could I ask what is the difference about using this on raspberry pi and how to fix it ?

Sebastian Böck

unread,
May 11, 2018, 5:58:40 AM5/11/18
to madmom-users
In order to run on the Pi (with its rather limited performance), you need to limit the number of neural network models to a maximum of 2.

yangy...@gmail.com

unread,
May 11, 2018, 6:03:22 AM5/11/18
to madmom-users
Thanks, how to write the command to limit the network model….could you give me a example?…… and does it matter that raspberry pi give the message that could not connect with the jack server?

在 2018年5月11日星期五 UTC+10下午7:58:40,Sebastian Böck写道:

Sebastian Böck

unread,
May 11, 2018, 6:06:41 AM5/11/18
to madmom-users
Hi,


On Friday, 11 May 2018 12:03:22 UTC+2, yangy...@gmail.com wrote:
Thanks, how to write the command to limit the network model….could you give me a example?

Unfortunately there's no option, you need to alter models/__init__.py
 
and does it matter that raspberry pi give the message that could not connect with the jack server?

which message? I don't know if it a warning or error and I am no jack-expert, so I fear I can't help much with this issue.

yangy...@gmail.com

unread,
May 11, 2018, 6:13:56 AM5/11/18
to madmom-users
as I already install the madmom package on the raspberry pi, how to change the code of package that installed
 on the raspberry pi? use the terminal??

在 2018年5月11日星期五 UTC+10下午8:06:41,Sebastian Böck写道:

Sebastian Böck

unread,
May 11, 2018, 6:15:55 AM5/11/18
to madmom-users
Hi,


On Friday, 11 May 2018 12:13:56 UTC+2, yangy...@gmail.com wrote:
as I already install the madmom package on the raspberry pi, how to change the code of package that installed
 on the raspberry pi? use the terminal??

yes, you need to determine the location where it got installed to and then edit the files using the editor of your choice.

yangy...@gmail.com

unread,
May 11, 2018, 6:21:49 AM5/11/18
to madmom-users
thanks .... I will try to and this issue annoy me for several weeks...

在 2018年5月11日星期五 UTC+10下午8:13:56,yangy...@gmail.com写道:

yangy...@gmail.com

unread,
May 16, 2018, 5:24:34 AM5/16/18
to madmom-users
is that mean I change /beats/2016/beats_lstm_[1-8].pkl' to /beats/2016/beats_lstm_[1-2].pkl'...../onsets/2013/onsets_rnn_[1-8].pkl' to /onsets/2013/onsets_rnn_[1-2].pkl'........do I need to change patterns and glob >??? /patterns/2013/ballroom_pattern_[34]_4.pkl...glob.glob('%s/key/2017/key_cnn_[1-4].pkl' I will really appreciate if you could tell me ...


在 2018年5月11日星期五 UTC+10下午8:06:41,Sebastian Böck写道:
Hi,

Sebastian Böck

unread,
May 16, 2018, 5:27:19 AM5/16/18
to madmom-users


On Wednesday, 16 May 2018 11:24:34 UTC+2, yangy...@gmail.com wrote:
is that mean I change /beats/2016/beats_lstm_[1-8].pkl' to /beats/2016/beats_lstm_[1-2].pkl'
...../onsets/2013/onsets_rnn_[1-8].pkl' to /onsets/2013/onsets_rnn_[1-2].pkl'

yes
 
........do I need to change patterns and glob >??? /patterns/2013/ballroom_pattern_[34]_4.pkl...glob.glob('%s/key/2017/key_cnn_[1-4].pkl' I will really appreciate if you could tell me ...

those models do not work in online mode anyways, so there's no need to change them.

yangy...@gmail.com

unread,
May 16, 2018, 5:30:16 AM5/16/18
to madmom-users
thank you very much.... another question is do madmom could have real-time get the music beats and automatic save to txt function... as I try to run the madmom get the real-time beats and apply to the raspberry and aruduino,  I need to get the time in the txt?? 

在 2018年5月16日星期三 UTC+10下午7:27:19,Sebastian Böck写道:

Sebastian Böck

unread,
May 16, 2018, 5:32:30 AM5/16/18
to madmom-users


On Wednesday, 16 May 2018 11:30:16 UTC+2, yangy...@gmail.com wrote:
thank you very much.... another question is do madmom could have real-time get the music beats and automatic save to txt function... as I try to run the madmom get the real-time beats and apply to the raspberry and aruduino,  I need to get the time in the txt?? 

simply pipe the output to a txt-file or supply an output file name with '-o' parameter.

yangy...@gmail.com

unread,
May 16, 2018, 5:39:33 AM5/16/18
to madmom-users
thanks very much... The madmom is already a very good algorithm...... as I am doing my final year thesis.. I also try to understand what the madmom code and maybe try to focus on one area where could improve better?? could you give me some suggestions how to begin read the code of the madmom and which area will be good for me do to a bit research ???? 

在 2018年5月16日星期三 UTC+10下午7:32:30,Sebastian Böck写道:

Sebastian Böck

unread,
May 16, 2018, 5:46:03 AM5/16/18
to madmom-users


On Wednesday, 16 May 2018 11:39:33 UTC+2, yangy...@gmail.com wrote:
The madmom is already a very good algorithm......

madmom is just another framework for audio signal processing, but it includes a collection of well performing algorithms (or the implementations thereof).
 
as I am doing my final year thesis.. I also try to understand what the madmom code and maybe try to focus on one area where could improve better?? could you give me some suggestions how to begin read the code of the madmom and which area will be good for me do to a bit research ????

I guess the best way is not to read the code, but rather read the cited papers. Most classes/functions have a reference section directing you towards the respective paper. I think all algorithms/methods could be improved considerably, but I can't tell you which one to choose, since it mostly depends on your interests and/or background.

yangy...@gmail.com

unread,
May 16, 2018, 5:57:37 AM5/16/18
to madmom-users
thanks very much..... I will try to read some of the papers.......I am quite interest in this area.....if there any internship chance in Australia research  institute for artificial intelligence ?

在 2018年5月16日星期三 UTC+10下午7:46:03,Sebastian Böck写道:

Sebastian Böck

unread,
May 16, 2018, 8:21:46 AM5/16/18
to madmom-users
it's Austria, not Australia ;)

yangy...@gmail.com

unread,
May 16, 2018, 9:21:33 PM5/16/18
to madmom-users
I try on the raspberry pi 3 and change the models to2.... but when I run the madmom which give me warning that /madmom/audio/spectrogram.py:931: runtimewarning: invalid value encountered in maximum?? and just start and stuck ...how to deal wit this 

在 2018年5月16日星期三 UTC+10下午10:21:46,Sebastian Böck写道:

Sebastian Böck

unread,
May 17, 2018, 5:10:22 AM5/17/18
to madmom-users


On Thursday, 17 May 2018 03:21:33 UTC+2, yangy...@gmail.com wrote:
I try on the raspberry pi 3 and change the models to2.... but when I run the madmom which give me warning that /madmom/audio/spectrogram.py:931: runtimewarning: invalid value encountered in maximum?? and just start and stuck ...how to deal wit this 

That's just a warning and definitely not the reason for the stuck process. Have you tried with only a single network? What does the CPU utilisation say?

yangy...@gmail.com

unread,
May 17, 2018, 9:35:38 PM5/17/18
to madmom-users
I just watch the vedio of your raspberry pi connection, and if that you use a sound bluster which connect to your mic, and your mic produce music directly to your respeberry pi????

在 2018年5月17日星期四 UTC+10下午7:10:22,Sebastian Böck写道:

Sebastian Böck

unread,
May 18, 2018, 4:00:55 AM5/18/18
to madmom-users
Hi,

On Friday, 18 May 2018 03:35:38 UTC+2, yangy...@gmail.com wrote:
I just watch the vedio of your raspberry pi connection, and if that you use a sound bluster which connect to your mic, and your mic produce music directly to your respeberry pi????

to clarify: you need an external soundcard, since the Pi doesn't have an audio input, only a PWM out (which can be used to output some sounds such as beeps, but not real audio).

yangy...@gmail.com

unread,
May 18, 2018, 9:26:47 AM5/18/18
to madmom-users
I just buy one version of the sound bluster and hopely can used in linux system..... I appreciate for you to reply me ........

在 2018年5月18日星期五 UTC+10下午6:00:55,Sebastian Böck写道:

yangy...@gmail.com

unread,
May 21, 2018, 2:09:11 AM5/21/18
to madmom-users
now I finally come run madmom in raspberry pi, but if I want run in real-time, I find a problem about if I ran mammon and make the output to txt.. I read the txt and code to Arduino.....but onlyif I stop the madmom could the output file finished and get value, so how could I make the madmom output txt save the value as soon as they get the value and under this situation could I run in real-time

在 2018年5月18日星期五 UTC+10下午11:26:47,yangy...@gmail.com写道:

Sebastian Böck

unread,
May 21, 2018, 4:33:51 AM5/21/18
to madmom-users
You probably want to pipe the output directly to your Arduino instead of saving it to file. If you want both, have a look a tee (man tee).

yangy...@gmail.com

unread,
May 21, 2018, 4:39:00 AM5/21/18
to madmom-users
how to pipe the output, I a bit confuse ,is that mean use the value from the terminal?  I saw the value is in the self.processors, ?

在 2018年5月21日星期一 UTC+10下午6:33:51,Sebastian Böck写道:

Sebastian Böck

unread,
May 21, 2018, 4:46:43 AM5/21/18
to madmom-users
Hi,


On Monday, 21 May 2018 10:39:00 UTC+2, yangy...@gmail.com wrote:
how to pipe the output, I a bit confuse ,is that mean use the value from the terminal?

yes. Pipe the output written to STDOUT (madmom's output) to your Arduino. I assume it's connected via serial/USB, so you can simply redirect madmom's output through a pipe "|".

I saw the value is in the self.processors, ?

No. It is basically the return value when calling the processor.

yangy...@gmail.com

unread,
May 21, 2018, 4:53:17 AM5/21/18
to madmom-users
is there anyway I could read the real-time value directly in respberry pi, because my code basically use the raspberry pi to control the Arduino ?

在 2018年5月21日星期一 UTC+10下午6:46:43,Sebastian Böck写道:

Sebastian Böck

unread,
May 21, 2018, 4:56:20 AM5/21/18
to madmom-users
Hi,

On Monday, 21 May 2018 10:53:17 UTC+2, yangy...@gmail.com wrote:
is there anyway I could read the real-time value directly in respberry pi, because my code basically use the raspberry pi to control the Arduino ?

which value? Which language are you using. Your questions are always a bit short of information so I can only guess what you want to accomplish...

Assuming Python, yes you can get all the values directly from within your code. Simply call any processor and the return value you get is what you want.

yangy...@gmail.com

unread,
May 21, 2018, 5:00:09 AM5/21/18
to madmom-users
yeah, I use python........could give a easy example to call one of the processor? so basiclly I need to import the processor from the madmom, and get the return value?? 

在 2018年5月21日星期一 UTC+10下午6:56:20,Sebastian Böck写道:

Sebastian Böck

unread,
May 21, 2018, 5:02:42 AM5/21/18
to madmom-users


On Monday, 21 May 2018 11:00:09 UTC+2, yangy...@gmail.com wrote:
yeah, I use python........could give a easy example to call one of the processor? so basiclly I need to import the processor from the madmom, and get the return value??

Have a look in the 'bin' directory with the example scripts. This is how the processors are imported and called. The only thing you have to change is the last processor because those usually output the computed values.

yangy...@gmail.com

unread,
May 21, 2018, 5:15:53 AM5/21/18
to madmom-users
I saw it in the bin/DBNBeattracker ..... so the thing I needed is from the out_processor ? is the value saved in is list in out_processor?? if I directly edit in this python file... .. I just run this python file will ok right? do I have to write arguments in terminal ??

在 2018年5月21日星期一 UTC+10下午7:02:42,Sebastian Böck写道:

Sebastian Böck

unread,
May 21, 2018, 5:25:19 AM5/21/18
to madmom-users


On Monday, 21 May 2018 11:15:53 UTC+2, yangy...@gmail.com wrote:
I saw it in the bin/DBNBeattracker ..... so the thing I needed is from the out_processor ? is the value saved in is list in out_processor?? if I directly edit in this python file... .. I just run this python file will ok right? do I have to write arguments in terminal ??

I am really sorry, but I can't parse this question :S

You need everything except 'write_beats'. You have to replace that with your own function that deals with the input that arrives there. It is called for every frame then.

yangy...@gmail.com

unread,
May 21, 2018, 5:36:14 AM5/21/18
to madmom-users
beat_processor = DBNBeatTrackingProcessor(**vars(args)) out_processor = [beat_processor, write_beats] so basically my understanding is every beat_time is get from the beat_processor and save in the list of the out_processor, what is the write_beat, a node??


在 2018年5月21日星期一 UTC+10下午7:25:19,Sebastian Böck写道:

Sebastian Böck

unread,
May 21, 2018, 5:42:26 AM5/21/18
to madmom-users
Hi,


On Monday, 21 May 2018 11:36:14 UTC+2, yangy...@gmail.com wrote:
beat_processor = DBNBeatTrackingProcessor(**vars(args)) out_processor = [beat_processor, write_beats] so basically my understanding is every beat_time is get from the beat_processor and save in the list of the out_processor, what is the write_beat, a node??

no, 'write_beats' is a function. That function is called 100 times per second and depending whether a beat is present or not, the value passed to this function is either the beat time or an empty array.

You can replace this function with your own function, you just have to make sure that it can handle empty arrays and act accordingly.

yangy...@gmail.com

unread,
May 21, 2018, 6:02:52 AM5/21/18
to madmom-users
I look a bit of the code...so actually the( events = np.array(events)) events is represent the each value which I am seeking for ??

在 2018年5月21日星期一 UTC+10下午7:42:26,Sebastian Böck写道:

Sebastian Böck

unread,
May 21, 2018, 6:13:57 AM5/21/18
to madmom-users


On Monday, 21 May 2018 12:02:52 UTC+2, yangy...@gmail.com wrote:
I look a bit of the code...so actually the( events = np.array(events)) events is represent the each value which I am seeking for ??

I don't know what you are seeking for since you never really posted what you actually want to accomplish.

'events' is either empty or contains a single value indicating the time of the beat. But maybe you should get yourself familiar with a debugger and try to get how the whole thing works. Debugging live input is a bit cumbersome, but you can call any suitable processor in 'online' mode with file input as well. Then you can see how the data is processed by the individual processors and so on.

yangy...@gmail.com

unread,
May 21, 2018, 6:24:34 AM5/21/18
to madmom-users


在 2018年5月21日星期一 UTC+10下午8:13:57,Sebastian Böck写道:
I am trying to get the each beat time value in real-time and calculate the time difference between the two nearby beat-time. so I think beats in (writes_beats) or events in (writes_events) is what I am seeking for? I change the each beats areay to value and calculate the difference with the nearby value to tell the Arduino run with the time delay. 

Sebastian Böck

unread,
May 22, 2018, 4:39:53 AM5/22/18
to madmom-users


On Monday, 21 May 2018 12:24:34 UTC+2, yangy...@gmail.com wrote:
I am trying to get the each beat time value in real-time and calculate the time difference between the two nearby beat-time. so I think beats in (writes_beats) or events in (writes_events) is what I am seeking for? I change the each beats areay to value and calculate the difference with the nearby value to tell the Arduino run with the time delay. 

Did you have a look at `TempoDetector`? It is probably what you want...

yangy...@gmail.com

unread,
May 22, 2018, 8:20:37 PM5/22/18
to madmom-users
but is seems TempoDetector did not  have the online mode?

在 2018年5月22日星期二 UTC+10下午6:39:53,Sebastian Böck写道:

Sebastian Böck

unread,
May 23, 2018, 4:23:42 AM5/23/18
to madmom-users


On Wednesday, 23 May 2018 02:20:37 UTC+2, yangy...@gmail.com wrote:
but is seems TempoDetector did not  have the online mode?

not until October 17. There hasn't been any new release since then, so you have to install from source. There will be a new PyPI release soon hopefully.

yangy...@gmail.com

unread,
May 24, 2018, 6:46:15 PM5/24/18
to madmom-users

import madmom

from madmom.models import BEATS_LSTM

proc = madmom.features.beats.DBNBeatTrackingProcessor(fps=100)

act = madmom.features.beats.RNNBeatProcessor(online=True, nn_files=[BEATS_LSTM[0]])

beat_times = proc(act)

print(beat_times)

I try to use the part of the function to get the beat of the time, but if the Online=Ture, why this code could not run in real time......I still could not know how you print the beat-time in terminal...maybe I just do some change before printout, and then I could give the value to make Arduino run..... could you tell me how you did to change the code to make your Arduino run???
在 2018年5月23日星期三 UTC+10下午6:23:42,Sebastian Böck写道:

Sebastian Böck

unread,
May 25, 2018, 1:53:48 PM5/25/18
to madmom-users

On Friday, 25 May 2018 00:46:15 UTC+2, yangy...@gmail.com wrote:

import madmom

from madmom.models import BEATS_LSTM

proc = madmom.features.beats.DBNBeatTrackingProcessor(fps=100)

act = madmom.features.beats.RNNBeatProcessor(online=True, nn_files=[BEATS_LSTM[0]])

beat_times = proc(act)

print(beat_times)

I try to use the part of the function to get the beat of the time, but if the Online=Ture, why this code could not run in real time......I still could not know how you print the beat-time in terminal...maybe I just do some change before printout, and then I could give the value to make Arduino run..... could you tell me how you did to change the code to make your Arduino run???

The code above can't work. Neither in online mode, nor in offline mode.

1) all Processors need to have 'online=True' set
2) `act` is an instance of `RNNBeatProcessor` and you cant call `proc` with it
3) the processors need to be called frame by frame in online real-time mode

Please, run a debugger on the script to see what's going on and how the processors in the processing chain get called. Set break points where appropriate and inspect the arguments and data when the processors get instantiated/called.

P.S. I don't have an Arduino

yangy...@gmail.com

unread,
May 25, 2018, 8:33:58 PM5/25/18
to madmom-users
thanks for your patient and help.

在 2018年5月26日星期六 UTC+10上午3:53:48,Sebastian Böck写道:
Reply all
Reply to author
Forward
0 new messages