{"id":321642,"date":"2021-04-18T15:00:21","date_gmt":"2021-04-18T15:00:21","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=321642"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=321642","title":{"rendered":"\u041f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u043c \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u0443 \u0432 \u043f\u0438\u0430\u043d\u0438\u043d\u043e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e python"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/532\/76b\/c89\/53276bc892635216871b4e3c35043d29.png\" width=\"500\" height=\"500\"><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u043a-\u0442\u043e \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0441\u044f \u044f \u0442\u0435\u043e\u0440\u0438\u0435\u0439 \u043c\u0443\u0437\u044b\u043a\u0438. \u041d\u043e \u043f\u0438\u0430\u043d\u0438\u043d\u043e, \u0443\u0432\u044b, \u0443 \u043c\u0435\u043d\u044f \u043d\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u0432 \u043f\u043e\u0438\u0441\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c: \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u0437\u0432\u0443\u0447\u0438\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u043d\u043e\u0442\u0430. \u0421\u043f\u0435\u0440\u0432\u0430 \u044f \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0432\u044b\u0441\u043e\u043a\u043e\u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043d\u043e \u0432 \u043d\u0438\u0445 \u0441\u043b\u0438\u0448\u043a\u043e\u043c, \u0443\u0436 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0418 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0435 \u043c\u043e\u0435\u0439 \u0436\u0438\u0437\u043d\u0438 \u043c\u043d\u0435 \u044d\u0442\u043e \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u043d\u0435\u043d\u0443\u0436\u043d\u043e. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0448\u0430\u0442\u044c \u0438 \u043e\u0442\u0432\u043b\u0435\u043a\u0430\u0442\u044c. \u0412 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0445 \u0441 \u043c\u0435\u043d\u044c\u0448\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u041f\u043e\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0441\u0430\u043c. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c.<\/p>\n<hr>\n<p><strong>\u041d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u043e MIDI.<\/strong><\/p>\n<p>MIDI &#8212; \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442&nbsp;\u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0437\u0432\u0443\u043a\u043e\u0437\u0430\u043f\u0438\u0441\u0438&nbsp;\u043d\u0430 \u0444\u043e\u0440\u043c\u0430\u0442 \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u043c\u0438 \u043c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438. \u042d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043c\u0438\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430. \u041d\u043e \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u043d\u0430\u0442\u044c \u043b\u0438\u0448\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430:<\/p>\n<p>1)&nbsp;&nbsp;&nbsp; \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u0444\u0430\u0439\u043b\u0435 midi \u0435\u0441\u0442\u044c \u043d\u0435\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0440\u0435\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e.<\/p>\n<p>2)&nbsp;&nbsp;&nbsp; \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u0442\u0440\u0435\u043a\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u0441\u0438\u043d\u0442\u0435\u0437\u0430\u0442\u043e\u0440\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, noteon \u2013 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043d\u043e\u0442\u0443; noteoff \u2013 \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043d\u043e\u0442\u0443; change_program \u2013 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, control_change \u2013 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a, \u0432\u043b\u0438\u044f\u044e\u0449\u0438\u0445 \u043d\u0430 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u043e\u0442, \u0438\u0445 \u0441\u043c\u0435\u043d\u0443, \u0438 \u0442\u043f. \u0412\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/en.wikipedia.org\/wiki\/General_MIDI\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>3)&nbsp;&nbsp;&nbsp; \u041a\u0430\u0436\u0434\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438: \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u2013 \u044d\u0442\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/thumb\/7\/7a\/NoteNamesFrequenciesAndMidiNumbers.svg\/800px-NoteNamesFrequenciesAndMidiNumbers.svg.png\" rel=\"noopener noreferrer nofollow\">\u043d\u043e\u043c\u0435\u0440 \u043d\u043e\u0442\u044b<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/General_MIDI\" rel=\"noopener noreferrer nofollow\">\u043d\u043e\u043c\u0435\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430<\/a> \u0438 \u0442.\u043f; \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443; \u043d\u043e\u043c\u0435\u0440 \u043a\u0430\u043d\u0430\u043b\u0430 (\u0432\u0441\u0435\u0433\u043e \u0438\u0445 16), \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u0433\u0440\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u0430\u044f \u043d\u043e\u0442\u0430 \u0438\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430, \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u043f\u043e\u043b\u0438\u0444\u043e\u043d\u0438\u044f, \u0442\u043e \u0432 \u043a\u0430\u043d\u0430\u043b\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0432\u0443\u0447\u0430\u0442\u044c \u0434\u0432\u0435 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u043d\u043e\u0442\u044b \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e.<\/p>\n<p><strong>\u0417\u0430\u043f\u0438\u0441\u044c MIDI-\u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Mido.<\/strong><\/p>\n<p><a href=\"https:\/\/mido.readthedocs.io\/en\/latest\/\" rel=\"noopener noreferrer nofollow\">Mido<\/a> \u2013 \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043d\u0430 python, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 MIDI-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u043f\u043e\u0440\u0442\u0430\u043c\u0438. <a href=\"https:\/\/mido.readthedocs.io\/en\/latest\/installing.html\" rel=\"noopener noreferrer nofollow\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/a>.<\/p>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"python\">from mido import MidiFile   mid = MidiFile('song.mid') for i, track in enumerate(mid.tracks):     print('Track {}: {}'.format(i, track.name))     for msg in track:         print(msg)<\/code><\/pre>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"python\">from mido import Message, MidiFile, MidiTrack, second2tick     mid = MidiFile()   track = MidiTrack() mid.tracks.append(track) time = int(second2tick(0.1, 480, 500000)) for i in range(100):     track.append(Message('program_change', program=12, time=0))     track.append(Message('note_on', note=64, velocity=64, time=time))     track.append(Message('note_off', note=64, velocity=64, time=time))   mid.save('new_song.mid')<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u00abtime\u00bb. \u041f\u043e\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/mido.readthedocs.io\/en\/latest\/midi_files.html#about-the-time-attribute\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p><strong>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b c <\/strong><a href=\"https:\/\/pypi.org\/project\/keyboard\/\" rel=\"noopener noreferrer nofollow\"><strong>keyboard<\/strong><\/a><strong>.<\/strong><\/p>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"python\">import keyboard     def hook(key):     if key.event_type == \"down\":         print(\"{} press\".format(key.name))     if key.event_type == \"up\":         print(\"{} release\".format(key.name))   keyboard.hook(hook) keyboard.wait(\"esc\")<\/code><\/pre>\n<p>\u0421\u043b\u043e\u0432\u0430\u0440\u044c {key: note} \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a (\u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043c\u0430\u043b\u043e\u0439 \u043e\u043a\u0442\u0430\u0432\u044b):<\/p>\n<pre><code class=\"python\">import keyboard     keys = {} note = 48 def hook(key):     global note      if key.event_type == \"down\":         if key.name != \"esc\":             keys.update({key.name: note})             note += 1      if key.event_type == \"up\":         if key.name == \"esc\":             print(keys)   keyboard.hook(hook) keyboard.wait()<\/code><\/pre>\n<p><strong>\u0412\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438e \u043d\u043e\u0442 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e mido.<\/strong><\/p>\n<p>\u0421\u043f\u0435\u0440\u0432\u0430 \u043d\u0430\u0434\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c <a href=\"https:\/\/mido.readthedocs.io\/en\/latest\/installing.html\" rel=\"noopener noreferrer nofollow\">python-rtmidi<\/a>.<\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0440\u0442\u043e\u0432 (\u0443 \u043c\u0435\u043d\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d):<\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; mido.get_output_names() ['Microsoft GS Wavetable Synth 0']<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043f\u043e\u0440\u0442\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0438\u043b\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043d\u043e\u0442\u044b:<\/p>\n<pre><code class=\"python\">import keyboard import mido     port = mido.open_output('Microsoft GS Wavetable Synth 0') keys = keys = {'1': 48, '2': 49, '3': 50, '4': 51, '5': 52, '6': 53, '7': 54, '8': 55, '9': 56, '0': 57, '-': 58, '=': 59, 'q': 60, 'w': 61, 'e': 62, 'r': 63, 't': 64, 'y': 65, 'u': 66, 'i': 67, 'o': 68, 'p': 69, '[': 70, ']': 71, 'a': 72, 's': 73, 'd': 74, 'f': 75, 'g': 76, 'h': 77, 'j': 78, 'k': 79, 'l': 80, ';': 81, \"'\": 82, 'enter': 83} pressed_keys = {key: False for key in keys.keys()}     def hook(key):     if key.event_type == \"down\":         if key.name in keys:             if not pressed_keys[key.name]:                 port.send(mido.Message('note_on', note=keys[key.name]))                 pressed_keys[key.name] = True       if key.event_type == \"up\":         if key.name in keys:             port.send(mido.Message('note_off', note=keys[key.name]))             pressed_keys[key.name] = False   keyboard.hook(hook) keyboard.wait()<\/code><\/pre>\n<p>\u041d\u043e \u0443 \u044d\u0442\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2013 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0432\u0443\u0447\u0430\u043d\u0438\u044f. \u0414\u0430 \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c midi \u0432 wav \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a \u043d\u0435\u043b\u044c\u0437\u044f.<\/p>\n<p><strong>\u0412\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438e \u043d\u043e\u0442 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e fluidsynth.<\/strong><\/p>\n<p><a href=\"https:\/\/github.com\/FluidSynth\/fluidsynth\/wiki\" rel=\"noopener noreferrer nofollow\">Fluidsynth<\/a> \u2013 \u044d\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0435\u0437\u0430\u0442\u043e\u0440.<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 fluidsynth (\u0432 Windows):<\/p>\n<p>1)&nbsp;&nbsp;&nbsp; <a href=\"https:\/\/github.com\/FluidSynth\/fluidsynth\/releases\" rel=\"noopener noreferrer nofollow\">\u0421\u043a\u0430\u0447\u0430\u0439\u0442\u0435 fluidsynth<\/a> \u0434\u043b\u044f Windows \u0438 \u0440\u0430\u0441\u043f\u0430\u043a\u0443\u0439\u0442\u0435 \u0432 \u043b\u044e\u0431\u043e\u0439 \u043f\u0430\u043f\u043a\u0435.<\/p>\n<p>2)&nbsp;&nbsp;&nbsp; \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043f\u043e\u0434\u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u00abfluidsynth\\bin\u00bb \u0432 \u0441\u0432\u043e\u0439 path. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u0442\u0435 \u00ab\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u044b\u00bb, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435; \u0434\u0430\u043b\u0435\u0435 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443 \u00ab\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b\u00bb, \u00abPath\u00bb, \u00ab\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c\u00bb, \u00ab\u0421\u043e\u0437\u0434\u0430\u0442\u044c\u00bb \u0438 \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043f\u0443\u0442\u044c \u043a \u043f\u043e\u0434\u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0443 \u00abfluidsynth\\bin\u00bb.<\/p>\n<p>3)&nbsp;&nbsp;&nbsp; <a href=\"https:\/\/member.keymusician.com\/Member\/FluidR3_GM\/index.html\" rel=\"noopener noreferrer nofollow\">\u0421\u043a\u0430\u0447\u0430\u0439\u0442\u0435 \u043c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0448\u0440\u0438\u0444\u0442<\/a>.<\/p>\n<p>4)&nbsp;&nbsp;&nbsp; \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c fluidsynth. <a href=\"https:\/\/www.mfiles.co.uk\/classical-midi.htm\" rel=\"noopener noreferrer nofollow\">\u0421\u043a\u0430\u0447\u0430\u0439\u0442\u0435 \u043b\u044e\u0431\u043e\u0439 midi \u0444\u0430\u0439\u043b<\/a> \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u00abfluidsynth FluidR3_GM.sf2 file_name.mid\u00bb. \u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c pyfluidsynth.<\/p>\n<p>1)&nbsp;&nbsp;&nbsp; <a href=\"https:\/\/github.com\/nwhitehead\/pyfluidsynth\" rel=\"noopener noreferrer nofollow\">\u0421\u043a\u0430\u0447\u0430\u0439\u0442\u0435 pyfluidsynth<\/a> (\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u043d\u0430 github) \u0438 \u0440\u0430\u0441\u043f\u0430\u043a\u0443\u0439\u0442\u0435.<\/p>\n<p>2)&nbsp;&nbsp;&nbsp; \u0427\u0442\u043e\u0431\u044b \u0434\u043e\u0434\u0443\u043c\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c 1.5 \u0434\u043d\u044f (\u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043d\u0430\u043c\u0435\u043a \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u044b\u0443\u0447\u0438\u0442\u044c \u044f\u0437\u044b\u043a, \u0430 \u043d\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u0442\u0435\u0439 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435). \u041f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u00abfluidsynth\\bin\u00bb \u0438 \u043d\u0430\u0439\u0434\u0438\u0442\u0435 \u0442\u0430\u043c \u0444\u0430\u0439\u043b \u00ablibfluidsynth-3.dll\u00bb (\u0411\u044b\u0442\u044c \u043c\u043e\u0436\u0435\u0442, \u0443 \u0432\u0430\u0441 \u0434\u0440\u0443\u0433\u0430\u044f \u0446\u0438\u0444\u0440\u0430). \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0444\u0430\u0439\u043b \u00abfluidsynth.py\u00bb \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u00abpyfluidsynth\u00bb, \u043d\u0430\u0439\u0434\u0438\u0442\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u00ablib = find_library(&#8216;fluidsynth&#8217;) or\u2026\u00bb (\u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0432 \u043d\u0430\u0447\u0430\u043b\u0435) \u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0439\u0442\u0435 \u00abfluidsynth\u00bb \u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043d\u0430 \u00ablibfluidsynth-3.dll\u00bb (\u0423 \u0432\u0430\u0441 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u0440\u0443\u0433\u0430\u044f \u0446\u0438\u0444\u0440\u0430).<\/p>\n<p>3)&nbsp;&nbsp;&nbsp; \u0412 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u00abpyfluidsynth\u00bb \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u00abpy setup.py install\u00bb. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c numpy.<\/p>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"python\">import time import fluidsynth   fs = fluidsynth.Synth() fs.start()   sfid = fs.sfload(\"FluidR3_GM.sf2\") fs.program_select(0, sfid, 0, 0)     for i in range(10):     fs.noteon(0, 60, 30)     fs.noteon(0, 67, 30)     fs.noteon(0, 76, 30)       time.sleep(1.0)       fs.noteoff(0, 60)     fs.noteoff(0, 67)     fs.noteoff(0, 76)   time.sleep(1.0)   fs.delete()<\/code><\/pre>\n<p>\u0421\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0441 keyboard:<\/p>\n<pre><code class=\"python\">import keyboard import mido import fluidsynth     fs = fluidsynth.Synth() fs.start() sfid = fs.sfload(\"FluidR3_GM.sf2\") fs.program_select(0, sfid, 0, 41)     keys = {'1': 48, '2': 49, '3': 50, '4': 51, '5': 52, '6': 53, '7': 54, '8': 55, '9': 56, '0': 57, '-': 58, '=': 59, 'q': 60, 'w': 61, 'e': 62, 'r': 63, 't': 64, 'y': 65, 'u': 66, 'i': 67, 'o': 68, 'p': 69, '[': 70, ']': 71, 'a': 72, 's': 73, 'd': 74, 'f': 75, 'g': 76, 'h': 77, 'j': 78, 'k': 79, 'l': 80, ';': 81, \"'\": 82, 'enter': 83} pressed_keys = {key: False for key in keys.keys()}     def hook(key):     if key.event_type == \"down\":         if key.name in keys:             if not pressed_keys[key.name]:                 fs.noteon(0, keys[key.name], 127)                 pressed_keys[key.name] = True       if key.event_type == \"up\":         if key.name in keys:             fs.noteoff(0, keys[key.name])             pressed_keys[key.name] = False   keyboard.hook(hook) keyboard.wait()<\/code><\/pre>\n<p><strong>\u0418\u0437 midi \u0432 wav.<\/strong><\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438:<\/p>\n<pre><code>fluidsynth -F melody.wav FluidR3_GM.sf2 melody.mid<\/code><\/pre>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438. \u0423\u0434\u0430\u0447\u0438!<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/553032\/\"> https:\/\/habr.com\/ru\/post\/553032\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"\"><figcaption><\/figcaption><\/figure>\n<p>\u041a\u0430\u043a-\u0442\u043e \u0437\u0430\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043e\u0432\u0430\u043b\u0441\u044f \u044f \u0442\u0435\u043e\u0440\u0438\u0435\u0439 \u043c\u0443\u0437\u044b\u043a\u0438. \u041d\u043e \u043f\u0438\u0430\u043d\u0438\u043d\u043e, \u0443\u0432\u044b, \u0443 \u043c\u0435\u043d\u044f \u043d\u0435\u0442, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u043b\u0441\u044f \u0432 \u043f\u043e\u0438\u0441\u043a\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u0441\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c: \u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0436\u0430\u0442\u0438\u044f \u043d\u0430 \u043a\u043d\u043e\u043f\u043a\u0443 \u0437\u0432\u0443\u0447\u0438\u0442 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0430\u044f \u043d\u043e\u0442\u0430. \u0421\u043f\u0435\u0440\u0432\u0430 \u044f \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u043b \u0432\u044b\u0441\u043e\u043a\u043e\u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u043d\u043e \u0432 \u043d\u0438\u0445 \u0441\u043b\u0438\u0448\u043a\u043e\u043c, \u0443\u0436 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439. \u0418 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0435 \u043c\u043e\u0435\u0439 \u0436\u0438\u0437\u043d\u0438 \u043c\u043d\u0435 \u044d\u0442\u043e \u043f\u043e\u043f\u0440\u043e\u0441\u0442\u0443 \u043d\u0435\u043d\u0443\u0436\u043d\u043e. \u042d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0442\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0448\u0430\u0442\u044c \u0438 \u043e\u0442\u0432\u043b\u0435\u043a\u0430\u0442\u044c. \u0412 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430\u0445 \u0441 \u043c\u0435\u043d\u044c\u0448\u0438\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u043e\u043c \u043c\u0430\u043a\u0441\u0438\u043c\u0430\u043b\u044c\u043d\u043e \u043d\u0435\u0443\u0434\u043e\u0431\u043d\u044b\u0439 \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441. \u041f\u043e\u0442\u043e\u043c\u0443 \u044f \u0440\u0435\u0448\u0438\u043b \u043f\u0440\u043e\u0441\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a\u0443\u044e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0441\u0430\u043c. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0441\u0442\u0438 \u043f\u043e\u0434 \u043a\u0430\u0442\u043e\u043c.<\/p>\n<hr>\n<p><strong>\u041d\u0435\u043c\u043d\u043e\u0436\u043a\u043e \u043e MIDI.<\/strong><\/p>\n<p>MIDI &#8212; \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442&nbsp;\u0446\u0438\u0444\u0440\u043e\u0432\u043e\u0439 \u0437\u0432\u0443\u043a\u043e\u0437\u0430\u043f\u0438\u0441\u0438&nbsp;\u043d\u0430 \u0444\u043e\u0440\u043c\u0430\u0442 \u043e\u0431\u043c\u0435\u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u043c\u0438 \u043c\u0435\u0436\u0434\u0443 \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u044b\u043c\u0438 \u043c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430\u043c\u0438. \u042d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043c\u0438\u0440, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u0435\u0442 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0433\u043e\u0432\u043e\u0440\u0430. \u041d\u043e \u043d\u0430\u043c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0437\u043d\u0430\u0442\u044c \u043b\u0438\u0448\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430:<\/p>\n<p>1)&nbsp;&nbsp;&nbsp; \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u0444\u0430\u0439\u043b\u0435 midi \u0435\u0441\u0442\u044c \u043d\u0435\u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0442\u0440\u0435\u043a\u043e\u0432, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e.<\/p>\n<p>2)&nbsp;&nbsp;&nbsp; \u0412 \u043a\u0430\u0436\u0434\u043e\u043c \u0442\u0440\u0435\u043a\u0435 \u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u044b\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0434\u043b\u044f \u0441\u0438\u043d\u0442\u0435\u0437\u0430\u0442\u043e\u0440\u0430. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, noteon \u2013 \u0432\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043d\u043e\u0442\u0443; noteoff \u2013 \u0432\u044b\u043a\u043b\u044e\u0447\u0438\u0442\u044c \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u0443\u044e \u043d\u043e\u0442\u0443; change_program \u2013 \u0438\u0437\u043c\u0435\u043d\u0438\u0442\u044c \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, control_change \u2013 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u043d\u0430\u0441\u0442\u0440\u043e\u0435\u043a, \u0432\u043b\u0438\u044f\u044e\u0449\u0438\u0445 \u043d\u0430 \u0432\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u043d\u043e\u0442, \u0438\u0445 \u0441\u043c\u0435\u043d\u0443, \u0438 \u0442\u043f. \u0412\u0441\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c <a href=\"https:\/\/en.wikipedia.org\/wiki\/General_MIDI\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>3)&nbsp;&nbsp;&nbsp; \u041a\u0430\u0436\u0434\u0430\u044f \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u0445\u0430\u0440\u0430\u043a\u0442\u0435\u0440\u0438\u0437\u0443\u0435\u0442\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u043c\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438: \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u2013 \u044d\u0442\u043e, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/upload.wikimedia.org\/wikipedia\/commons\/thumb\/7\/7a\/NoteNamesFrequenciesAndMidiNumbers.svg\/800px-NoteNamesFrequenciesAndMidiNumbers.svg.png\" rel=\"noopener noreferrer nofollow\">\u043d\u043e\u043c\u0435\u0440 \u043d\u043e\u0442\u044b<\/a>, <a href=\"https:\/\/en.wikipedia.org\/wiki\/General_MIDI\" rel=\"noopener noreferrer nofollow\">\u043d\u043e\u043c\u0435\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u0430<\/a> \u0438 \u0442.\u043f; \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u043a\u043e\u043c\u0430\u043d\u0434\u044b, \u0447\u0435\u0440\u0435\u0437 \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u044d\u0442\u0443 \u043a\u043e\u043c\u0430\u043d\u0434\u0443; \u043d\u043e\u043c\u0435\u0440 \u043a\u0430\u043d\u0430\u043b\u0430 (\u0432\u0441\u0435\u0433\u043e \u0438\u0445 16), \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0438\u0433\u0440\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u0430\u044f \u043d\u043e\u0442\u0430 \u0438\u043b\u0438 \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u043d\u0430\u0441\u0442\u0440\u043e\u0439\u043a\u0430, \u0438\u043b\u0438 \u0438\u0437\u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442. \u0415\u0441\u043b\u0438 \u043d\u0435 \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0430 \u043f\u043e\u043b\u0438\u0444\u043e\u043d\u0438\u044f, \u0442\u043e \u0432 \u043a\u0430\u043d\u0430\u043b\u0435 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0432\u0443\u0447\u0430\u0442\u044c \u0434\u0432\u0435 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0435 \u043d\u043e\u0442\u044b \u043e\u0434\u043d\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e.<\/p>\n<p><strong>\u0417\u0430\u043f\u0438\u0441\u044c MIDI-\u0444\u0430\u0439\u043b\u043e\u0432 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Mido.<\/strong><\/p>\n<p><a href=\"https:\/\/mido.readthedocs.io\/en\/latest\/\" rel=\"noopener noreferrer nofollow\">Mido<\/a> \u2013 \u044d\u0442\u043e \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u043d\u0430 python, \u0441\u043e\u0437\u0434\u0430\u043d\u043d\u0430\u044f \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u0441 MIDI-\u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u043f\u043e\u0440\u0442\u0430\u043c\u0438. <a href=\"https:\/\/mido.readthedocs.io\/en\/latest\/installing.html\" rel=\"noopener noreferrer nofollow\">\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430<\/a>.<\/p>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"python\">from mido import MidiFile   mid = MidiFile('song.mid') for i, track in enumerate(mid.tracks):     print('Track {}: {}'.format(i, track.name))     for msg in track:         print(msg)<\/code><\/pre>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u044f \u0444\u0430\u0439\u043b\u0430:<\/p>\n<pre><code class=\"python\">from mido import Message, MidiFile, MidiTrack, second2tick     mid = MidiFile()   track = MidiTrack() mid.tracks.append(track) time = int(second2tick(0.1, 480, 500000)) for i in range(100):     track.append(Message('program_change', program=12, time=0))     track.append(Message('note_on', note=64, velocity=64, time=time))     track.append(Message('note_off', note=64, velocity=64, time=time))   mid.save('new_song.mid')<\/code><\/pre>\n<p>\u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u043d\u0430 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440 \u00abtime\u00bb. \u041f\u043e\u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0435\u0439 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c <a href=\"https:\/\/mido.readthedocs.io\/en\/latest\/midi_files.html#about-the-time-attribute\" rel=\"noopener noreferrer nofollow\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p><strong>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u043e\u0431\u044b\u0442\u0438\u0439 \u043a\u043b\u0430\u0432\u0438\u0430\u0442\u0443\u0440\u044b c <\/strong><a href=\"https:\/\/pypi.org\/project\/keyboard\/\" rel=\"noopener noreferrer nofollow\"><strong>keyboard<\/strong><\/a><strong>.<\/strong><\/p>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"python\">import keyboard     def hook(key):     if key.event_type == \"down\":         print(\"{} press\".format(key.name))     if key.event_type == \"up\":         print(\"{} release\".format(key.name))   keyboard.hook(hook) keyboard.wait(\"esc\")<\/code><\/pre>\n<p>\u0421\u043b\u043e\u0432\u0430\u0440\u044c {key: note} \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a (\u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441 \u043c\u0430\u043b\u043e\u0439 \u043e\u043a\u0442\u0430\u0432\u044b):<\/p>\n<pre><code class=\"python\">import keyboard     keys = {} note = 48 def hook(key):     global note      if key.event_type == \"down\":         if key.name != \"esc\":             keys.update({key.name: note})             note += 1      if key.event_type == \"up\":         if key.name == \"esc\":             print(keys)   keyboard.hook(hook) keyboard.wait()<\/code><\/pre>\n<p><strong>\u0412\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438e \u043d\u043e\u0442 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e mido.<\/strong><\/p>\n<p>\u0421\u043f\u0435\u0440\u0432\u0430 \u043d\u0430\u0434\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c <a href=\"https:\/\/mido.readthedocs.io\/en\/latest\/installing.html\" rel=\"noopener noreferrer nofollow\">python-rtmidi<\/a>.<\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u043f\u043e\u0440\u0442\u043e\u0432 (\u0443 \u043c\u0435\u043d\u044f \u0432\u0441\u0435\u0433\u043e \u043e\u0434\u0438\u043d):<\/p>\n<pre><code class=\"python\">&gt;&gt;&gt; mido.get_output_names() ['Microsoft GS Wavetable Synth 0']<\/code><\/pre>\n<p>\u041f\u0440\u0438 \u043d\u0430\u0436\u0430\u0442\u0438\u0438 \u043d\u0430 \u043a\u043b\u0430\u0432\u0438\u0448\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0435\u043c \u043f\u043e\u0440\u0442\u0443 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e \u0432\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u0438\u043b\u0438 \u0432\u044b\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438 \u043d\u043e\u0442\u044b:<\/p>\n<pre><code class=\"python\">import keyboard import mido     port = mido.open_output('Microsoft GS Wavetable Synth 0') keys = keys = {'1': 48, '2': 49, '3': 50, '4': 51, '5': 52, '6': 53, '7': 54, '8': 55, '9': 56, '0': 57, '-': 58, '=': 59, 'q': 60, 'w': 61, 'e': 62, 'r': 63, 't': 64, 'y': 65, 'u': 66, 'i': 67, 'o': 68, 'p': 69, '[': 70, ']': 71, 'a': 72, 's': 73, 'd': 74, 'f': 75, 'g': 76, 'h': 77, 'j': 78, 'k': 79, 'l': 80, ';': 81, \"'\": 82, 'enter': 83} pressed_keys = {key: False for key in keys.keys()}     def hook(key):     if key.event_type == \"down\":         if key.name in keys:             if not pressed_keys[key.name]:                 port.send(mido.Message('note_on', note=keys[key.name]))                 pressed_keys[key.name] = True       if key.event_type == \"up\":         if key.name in keys:             port.send(mido.Message('note_off', note=keys[key.name]))             pressed_keys[key.name] = False   keyboard.hook(hook) keyboard.wait()<\/code><\/pre>\n<p>\u041d\u043e \u0443 \u044d\u0442\u043e\u0433\u043e \u0441\u043f\u043e\u0441\u043e\u0431\u0430 \u0435\u0441\u0442\u044c \u043e\u0434\u043d\u0430 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u2013 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0432\u0443\u0447\u0430\u043d\u0438\u044f. \u0414\u0430 \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c midi \u0432 wav \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0430\u043a \u043d\u0435\u043b\u044c\u0437\u044f.<\/p>\n<p><strong>\u0412\u043e\u0441\u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438e \u043d\u043e\u0442 \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u043c \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e fluidsynth.<\/strong><\/p>\n<p><a href=\"https:\/\/github.com\/FluidSynth\/fluidsynth\/wiki\" rel=\"noopener noreferrer nofollow\">Fluidsynth<\/a> \u2013 \u044d\u0442\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u044b\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u0439 \u0441\u0438\u043d\u0442\u0435\u0437\u0430\u0442\u043e\u0440.<\/p>\n<p>\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 fluidsynth (\u0432 Windows):<\/p>\n<p>1)&nbsp;&nbsp;&nbsp; <a href=\"https:\/\/github.com\/FluidSynth\/fluidsynth\/releases\" rel=\"noopener noreferrer nofollow\">\u0421\u043a\u0430\u0447\u0430\u0439\u0442\u0435 fluidsynth<\/a> \u0434\u043b\u044f Windows \u0438 \u0440\u0430\u0441\u043f\u0430\u043a\u0443\u0439\u0442\u0435 \u0432 \u043b\u044e\u0431\u043e\u0439 \u043f\u0430\u043f\u043a\u0435.<\/p>\n<p>2)&nbsp;&nbsp;&nbsp; \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043f\u043e\u0434\u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u00abfluidsynth\\bin\u00bb \u0432 \u0441\u0432\u043e\u0439 path. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432 \u043f\u043e\u0438\u0441\u043a\u043e\u0432\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0435 \u043d\u0430\u043f\u0438\u0448\u0435\u0442\u0435 \u00ab\u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0441\u0440\u0435\u0434\u044b\u00bb, \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435; \u0434\u0430\u043b\u0435\u0435 \u043f\u043e \u043f\u043e\u0440\u044f\u0434\u043a\u0443 \u00ab\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0441\u0440\u0435\u0434\u044b\u00bb, \u00abPath\u00bb, \u00ab\u0418\u0437\u043c\u0435\u043d\u0438\u0442\u044c\u00bb, \u00ab\u0421\u043e\u0437\u0434\u0430\u0442\u044c\u00bb \u0438 \u0432\u0432\u0435\u0434\u0438\u0442\u0435 \u043f\u0443\u0442\u044c \u043a \u043f\u043e\u0434\u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0443 \u00abfluidsynth\\bin\u00bb.<\/p>\n<p>3)&nbsp;&nbsp;&nbsp; <a href=\"https:\/\/member.keymusician.com\/Member\/FluidR3_GM\/index.html\" rel=\"noopener noreferrer nofollow\">\u0421\u043a\u0430\u0447\u0430\u0439\u0442\u0435 \u043c\u0443\u0437\u044b\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u0448\u0440\u0438\u0444\u0442<\/a>.<\/p>\n<p>4)&nbsp;&nbsp;&nbsp; \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u043e\u0441\u043f\u043e\u0441\u043e\u0431\u043d\u043e\u0441\u0442\u044c fluidsynth. <a href=\"https:\/\/www.mfiles.co.uk\/classical-midi.htm\" rel=\"noopener noreferrer nofollow\">\u0421\u043a\u0430\u0447\u0430\u0439\u0442\u0435 \u043b\u044e\u0431\u043e\u0439 midi \u0444\u0430\u0439\u043b<\/a> \u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 \u00abfluidsynth FluidR3_GM.sf2 file_name.mid\u00bb. \u041d\u0435 \u0437\u0430\u0431\u0443\u0434\u044c\u0442\u0435 \u043f\u0435\u0440\u0435\u0439\u0442\u0438 \u0432 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433.<\/p>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0443\u0436\u043d\u043e \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c pyfluidsynth.<\/p>\n<p>1)&nbsp;&nbsp;&nbsp; <a href=\"https:\/\/github.com\/nwhitehead\/pyfluidsynth\" rel=\"noopener noreferrer nofollow\">\u0421\u043a\u0430\u0447\u0430\u0439\u0442\u0435 pyfluidsynth<\/a> (\u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0435\u0434\u0435\u0442\u0441\u044f \u043d\u0430 github) \u0438 \u0440\u0430\u0441\u043f\u0430\u043a\u0443\u0439\u0442\u0435.<\/p>\n<p>2)&nbsp;&nbsp;&nbsp; \u0427\u0442\u043e\u0431\u044b \u0434\u043e\u0434\u0443\u043c\u0430\u0442\u044c\u0441\u044f \u0434\u043e \u044d\u0442\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u043c\u043d\u0435 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u043f\u043e\u0442\u0440\u0430\u0442\u0438\u0442\u044c 1.5 \u0434\u043d\u044f (\u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u043d\u0430\u043c\u0435\u043a \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e\u0431\u044b \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u0432\u044b\u0443\u0447\u0438\u0442\u044c \u044f\u0437\u044b\u043a, \u0430 \u043d\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0430\u0442\u0435\u0439 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435). \u041f\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u00abfluidsynth\\bin\u00bb \u0438 \u043d\u0430\u0439\u0434\u0438\u0442\u0435 \u0442\u0430\u043c \u0444\u0430\u0439\u043b \u00ablibfluidsynth-3.dll\u00bb (\u0411\u044b\u0442\u044c \u043c\u043e\u0436\u0435\u0442, \u0443 \u0432\u0430\u0441 \u0434\u0440\u0443\u0433\u0430\u044f \u0446\u0438\u0444\u0440\u0430). \u0422\u0435\u043f\u0435\u0440\u044c \u043e\u0442\u043a\u0440\u043e\u0439\u0442\u0435 \u0444\u0430\u0439\u043b \u00abfluidsynth.py\u00bb \u0432 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u00abpyfluidsynth\u00bb, \u043d\u0430\u0439\u0434\u0438\u0442\u0435 \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u00ablib = find_library(&#8216;fluidsynth&#8217;) or\u2026\u00bb (\u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0432 \u043d\u0430\u0447\u0430\u043b\u0435) \u0438 \u043f\u043e\u043c\u0435\u043d\u044f\u0439\u0442\u0435 \u00abfluidsynth\u00bb \u0438\u043b\u0438 \u043b\u044e\u0431\u043e\u0439 \u0434\u0440\u0443\u0433\u043e\u0439 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u043d\u0430 \u00ablibfluidsynth-3.dll\u00bb (\u0423 \u0432\u0430\u0441 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0434\u0440\u0443\u0433\u0430\u044f \u0446\u0438\u0444\u0440\u0430).<\/p>\n<p>3)&nbsp;&nbsp;&nbsp; \u0412 \u043a\u0430\u0442\u0430\u043b\u043e\u0433\u0435 \u00abpyfluidsynth\u00bb \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 \u00abpy setup.py install\u00bb. \u041f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u0430\u0442\u0430\u043b\u043e\u0433 \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c.<\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0442\u0440\u0435\u0431\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c numpy.<\/p>\n<p>\u041a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"python\">import time import fluidsynth   fs = fluidsynth.Synth() fs.start()   sfid = fs.sfload(\"FluidR3_GM.sf2\") fs.program_select(0, sfid, 0, 0)     for i in range(10):     fs.noteon(0, 60, 30)     fs.noteon(0, 67, 30)     fs.noteon(0, 76, 30)       time.sleep(1.0)       fs.noteoff(0, 60)     fs.noteoff(0, 67)     fs.noteoff(0, 76)   time.sleep(1.0)   fs.delete()<\/code><\/pre>\n<p>\u0421\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0441 keyboard:<\/p>\n<pre><code class=\"python\">import keyboard import mido import fluidsynth     fs = fluidsynth.Synth() fs.start() sfid = fs.sfload(\"FluidR3_GM.sf2\") fs.program_select(0, sfid, 0, 41)     keys = {'1': 48, '2': 49, '3': 50, '4': 51, '5': 52, '6': 53, '7': 54, '8': 55, '9': 56, '0': 57, '-': 58, '=': 59, 'q': 60, 'w': 61, 'e': 62, 'r': 63, 't': 64, 'y': 65, 'u': 66, 'i': 67, 'o': 68, 'p': 69, '[': 70, ']': 71, 'a': 72, 's': 73, 'd': 74, 'f': 75, 'g': 76, 'h': 77, 'j': 78, 'k': 79, 'l': 80, ';': 81, \"'\": 82, 'enter': 83} pressed_keys = {key: False for key in keys.keys()}     def hook(key):     if key.event_type == \"down\":         if key.name in keys:             if not pressed_keys[key.name]:                 fs.noteon(0, keys[key.name], 127)                 pressed_keys[key.name] = True       if key.event_type == \"up\":         if key.name in keys:             fs.noteoff(0, keys[key.name])             pressed_keys[key.name] = False   keyboard.hook(hook) keyboard.wait()<\/code><\/pre>\n<p><strong>\u0418\u0437 midi \u0432 wav.<\/strong><\/p>\n<p>\u0412\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438:<\/p>\n<pre><code>fluidsynth -F melody.wav FluidR3_GM.sf2 melody.mid<\/code><\/pre>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u043f\u0440\u043e\u0447\u0442\u0435\u043d\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438. \u0423\u0434\u0430\u0447\u0438!<\/p>\n<\/div>\n<p> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/post\/553032\/\"> https:\/\/habr.com\/ru\/post\/553032\/<\/a><br \/><\/br><\/br><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-321642","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/321642","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=321642"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/321642\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=321642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=321642"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=321642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}