Heart rate control while jogging through musical feedback - or “testers who like to run are looking for”

It all started with the fact that they gave me a heart rate monitor. More precisely, at first I decided that I should somehow deal with the possible consequences of sedentary work, and began to run. Like any geek who started running, he immediately set himself the appropriate application to track jogging and share them with friends. And already after that, when they gave me a heart rate monitor and ran several times, measuring my heart rate, my comrades tried to explain to me that I had to take care of myself and try to keep my heart rate from running for 180 when I was inexperienced. the faster the better. But in the process of studying the materiel, it turned out that the result of the training strongly depends on what kind of pulse you are running with - and for some purposes you need a low pulse (and, accordingly, a low pace).


In short, for each person, you can determine the range of acceptable pulse values ​​for training. The range is calculated depending on age (and, if more accurate values ​​are needed, the resting pulse). Below this range, as I understand it, training does not make much sense, above it is definitely harmful. This allowable range is divided into 5 zones, from the first, warm-up, with the calmest pulse, to the fifth - which is not recommended to be achieved during normal training (only if you are an athlete, prepare for the competition and know exactly what you are doing). Training in different zones (and their various combinations) allows you to achieve different goals. For example, training in the second zone is considered fat burning, because up to 85% of the calories spent on training in this case are spent from fat stores, in all other cases this percentage is less.The third zone to the maximum develops the respiratory and cardiovascular system, and the fourth - contributes to the growth of muscle mass and endurance.

Having learned all these details, I tried to run, controlling the pulse using the training tracking application (at that time I used runkeeper) - but it was not very convenient - the application could only report the current pulse with a certain frequency, and I constantly ran out for certain self border zone pulse. And also, at the very beginning of my training, I tried to run to the music - it turned out that it was more interesting to run with music than without - but at the same time the music has its own pace, and what is most annoying - its own in each composition - does not always coincide with at the pace at which you decided to run a specific workout. As a result of all these observations and experiments, there was an idea of ​​the ideal musical accompaniment for training - firstly, it must adapt to the current pace in order to run into the rhythm of the music,and secondly, give feedback based on the data from the heart rate monitor, prompting you to accelerate or slow down when the heart rate goes beyond the limits of the heart rate zone selected for training. Since I already had experience in developing an application for android, I decided to check whether it would be possible to translate this idea into code.

In the very first version of the application, to check the operability of the idea - whether it would be possible to adjust the pulse by giving feedback on the audio channel, the accompaniment was just a beep of different tones. The prototype was written quickly enough, the only problem was testing - the first working version was ready around February, and at this time of the year it was difficult to find a place for jogging in our northern city - so I went to ski for the very first testing in real conditions. There is a joke about the experience of extreme programming - and I had the experience of extreme QA that winter - in such a blizzard that the beaten track on the next lap was swept to a level field. But with all this, the application with a squeak in the headphones quite clearly signaled how to change the pace so that the pulse fell into the desired interval.

After confirming the efficiency of the idea, it was possible to proceed to the main development. The next stage was procedurally generated music, then a more convenient interface. During the summer, testing the application, I ran about 300 km, including two half marathons. He improved the work with the accelerometer and the melody generator, experimented with different rhythms. I found, by the way, that running slowly is harder than fast - you constantly need to restrain yourself and control the pace - the application helps, it turns out.

The following winter, I discovered that due to the fact that the rhythm and pace of skiing is completely different than when running (and also seriously different for classics and free style) - that’s why you need to organize a separate regime to support ski training. Spent a few months on it, but in the end, so far I decided to disable this functionality, as unfinished and focus on running. Around this time, the same comrades who drew my attention to the pulse advised me to do interval training to develop endurance. This is when you alternate jogging with a different pulse level (i.e., at a different pace) during one training session - for example, you run at a light pace for 10 minutes, with a pulse in the second zone, and then 2 minutes of acceleration so that the pulse is in the fourth zone - and 3-5 cycles per workout.It was decided to add support schemes for interval training. The last of the major innovations (at the moment) was the mode for those who do not have a heart rate monitor - tempo control based on only data from the accelerometer.

In total, the application currently supports 3 modes:

  1. Training in a specific zone of the heart rate - choose the specific zone in which you want to run, press "start training" - and run until you get tired, listening to music on your headphones telling you whether to accelerate or slow down
  2. Interval training - you create an interval training scheme (a few minutes - warm up in the first or second zone, then, for example, 4 times 5 minutes in the second zone, 2 minutes in the fourth, at the end of the training - another 10-15 minutes in the second zone) - the application counts the time from the beginning of the training and, upon reaching the next interval, emits a special sound signal and increases / decreases the tempo of the music to help get into the pulse zone selected for the next interval
  3. Workout at a certain pace - for those who want to use the application without connecting to a heart rate monitor. Indicate the range for the pace in which you want to run a workout - for example, no less than 140 and no more than 150 steps per minute. After the start of training, the application behaves in the same way as in the first mode, only it controls not the pulse, but the frequency of steps through the accelerometer

Also, according to the results of training in any of the modes, the application builds a graph that shows how much it managed to fit into the given ranges, and calculates the conditional coefficient of getting into the range. It now looks something like this (and this is one of the first candidates for further improvements):


Of the unresolved issues at the moment is the application’s malfunctioning if the application’s power optimization mode is turned on for the application (for example, “battery saving” on the Nexus 6P or “background activity monitoring” on Redmi). In this case, when you turn off the screen and switch the application to the background, in some situations, the accelerometer stops working. So far, I could not find a universal solution, just added a message with the need to disable such modes for the application to work correctly:


Further plans for the development of the application are, first of all, to experiment with generative neural networks to create music. Also in the plans - improving the feedback algorithm and integration with social networks - so that you can share the schedule with the result of the training.

In general, having run about 500 kilometers with this application in all possible modes, I decided that it was time to show it to the world - I posted the applicationin open beta testing on Google Play - I’d like to understand whether the approach used in the application will help to achieve results for someone else except me. Actually, the headline about testers who like to run is just about that. By the way, while preparing the application for beta testing, I found out on Google Play the possibility of conducting sales - so, regarding the publication of the article on the hub, I made the application free for the next week - from May 22 to May 29 - so if you are fond of running and want to try new ways to control your heart rate during a workout, or just run to the automatically generated music, trying to adapt to your pace - welcome. Put the application and share your impressions, I will be grateful for any feedback - this is my first experience in publishing and promoting mobile applications.And I'm also trying to find ways to tell about the application to those who may be interested in such a thing - suddenly someone knows suitable groups in social networks or other resources where people who are interested in running gather who could tell about this application - again , I will be very grateful.

All Articles