key-musicz


Namekey-musicz JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://github.com/buildCodeZ/key_musicz
Summary键盘弹钢琴,keyboard to play piano
upload_time2025-08-03 02:42:53
maintainerNone
docs_urlNone
authorZzz
requires_pythonNone
licenseApache License 2.0
keywords key_musicz
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # key_musicz
声明:
禁止将本项目代码用于ai训练
declaration:
Codes of this project are not allowed to be used for AI training or any other form of machine learning processes.

```
键盘按键弹钢琴的小程序
(
注:
    另外写了个key_musicz_res库,里面包含了sf2格式音频文件和windows下的64位的fluidsynth库,下载后不用再自己下载音频文件和在windows装fluidsynth,key_musicz_res本质上是引用的本项目的代码
    安装:
        pip install key_musicz_res
        安装key_musicz_res会自动安装本项目以及本项目依赖的python库
    运行:
        python -m key_musicz_res [可选参数]
    可选参数和本项目一样,不过加了默认值,可以不用写
)
需要以下C库或资源文件:
    fluidsynth: 读sf2音频文件(里面是各种乐器的按键音),根据指定按键生成音频数据
    FluidR3_GM.sf2: 免费的sf2音频文件,当然你也可以用其他的
    portaudio: windows下会随着pyaudio自动安装,linux需要自己安装
需要以下python库(会自动安装):
    pyfluidsynth: 在python里调用fluidsynth库的封装代码
    pyaudio: 音频数据传入声卡发音,实际调用的portaudio库
    pynput: 监听键盘按键按下和放开
    buildz: 配置文件读取

安装方式:
fluidsynth:
    ubuntu:
        apt install fluidsynth
    windows:
        https://github.com/FluidSynth/fluidsynth/releases
        windows下是压缩包,解压后要把解压路径/bin加到PATH中,注意github时不时会连不上,可以试试镜像加速之类的

FluidR3_GM.sf2音频文件下载:
    有个国内地址,是csdn的gitcode.com里的,要登录但不收费:
        https://gitcode.com/open-source-toolkit/1d145/?utm_source=tools_gitcode&index=top&type=card&
    文件大小一百多MB

pyfluidsynth:
pyaudio:
pynput:
buildz:
    pip install key_musicz
    安装本库的时候自动安装,其中linux下的pyaudio可能会报错,需要先手动安装portaudio

程序运行:
    python -m key_musicz.run 参数
    参数如下:
        [-s/--sfile=]sf2文件
        [-f/--fp=]额外配置文件(没啥用)
        [-t/--default=]主要配置文件(默认预制的play.js)
        [-l/--libpath=]windows下fluidsynth库的bin的路径
        [-h/--help]
    例:
        python -m key_musicz.run -s./FluidR3Mono_GM.sf2 -l./lib -tplayrb.js
    默认配置文件(key_music/conf目录下):
        通用配置:
            按住shift+主键盘的数字键盘调整基调,~退出,空格切音
        play.js:
            从左到右从下到上音调依次升高
            音调从低到高顺序: 
                    zxcvbnm,./`alt_l``alt_r` (该组受基调影响:shift+1,3,5,7,9)
                    asdfghjkl;'`enter` (该组受基调影响:shift+1,3,5,7,9)
                    qwertyuiop[] (该组受基调影响:shift+2,4,6,8,0)
                    1234567890-= (该组受基调影响:shift+2,4,6,8,0)
        playblk.js:
            主要2*6作为一组,组内大体从左到右,上到下升高音调
            音调从低到高顺序: 
                12345qwert6y (该组受基调影响:shift+1,3,5,7,9)
                asdfgzxcvb`alt_l`h (该组受基调影响:shift+1,3,5,7,9)
                jkl;'nm,./`alt_r``enter` (该组受基调影响:shift+2,4,6,8,0)
                7890-uiop[=] (该组受基调影响:shift+2,4,6,8,0)
        playrb.js
            主要2*6作为一组,组内大体从左到右,下到上升高音调
            音调从低到高顺序: : 
                qwert12345y6 (该组受基调影响:shift+1,3,5,7,9)
                zxcvbasdfg`alt_l`h (该组受基调影响:shift+1,3,5,7,9)
                nm,./jkl;'`alt_r``enter` (该组受基调影响:shift+2,4,6,8,0)
                uiop[7890-]= (该组受基调影响:shift+2,4,6,8,0)
        playbb.js
            主要2*6作为一组,组内大体从左到右升高音调,左边从上到下升高,右边从下到上升高
            音调从低到高顺序: : 
                12345qwert6y (该组受基调影响:shift+1,3,5,7,9)
                asdfgzxcvb`alt_l`h (该组受基调影响:shift+1,3,5,7,9)
                nm,./jkl;'`alt_r``enter` (该组受基调影响:shift+2,4,6,8,0)
                uiop[7890-]= (该组受基调影响:shift+2,4,6,8,0)

        
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/buildCodeZ/key_musicz",
    "name": "key-musicz",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "key_musicz",
    "author": "Zzz",
    "author_email": "1309458652@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/d9/01/f2f10d7ae3c0f784eea4ec7a9651b3d1824cb0f9f45d40aeb32c1b3933fd/key_musicz-0.2.1.tar.gz",
    "platform": "any",
    "description": "# key_musicz\r\n\u58f0\u660e:\r\n\u7981\u6b62\u5c06\u672c\u9879\u76ee\u4ee3\u7801\u7528\u4e8eai\u8bad\u7ec3\r\ndeclaration:\r\nCodes of this project are not allowed to be used for AI training or any other form of machine learning processes.\r\n\r\n```\r\n\u952e\u76d8\u6309\u952e\u5f39\u94a2\u7434\u7684\u5c0f\u7a0b\u5e8f\r\n(\r\n\u6ce8\uff1a\r\n    \u53e6\u5916\u5199\u4e86\u4e2akey_musicz_res\u5e93\uff0c\u91cc\u9762\u5305\u542b\u4e86sf2\u683c\u5f0f\u97f3\u9891\u6587\u4ef6\u548cwindows\u4e0b\u768464\u4f4d\u7684fluidsynth\u5e93\uff0c\u4e0b\u8f7d\u540e\u4e0d\u7528\u518d\u81ea\u5df1\u4e0b\u8f7d\u97f3\u9891\u6587\u4ef6\u548c\u5728windows\u88c5fluidsynth\uff0ckey_musicz_res\u672c\u8d28\u4e0a\u662f\u5f15\u7528\u7684\u672c\u9879\u76ee\u7684\u4ee3\u7801\r\n    \u5b89\u88c5:\r\n        pip install key_musicz_res\r\n        \u5b89\u88c5key_musicz_res\u4f1a\u81ea\u52a8\u5b89\u88c5\u672c\u9879\u76ee\u4ee5\u53ca\u672c\u9879\u76ee\u4f9d\u8d56\u7684python\u5e93\r\n    \u8fd0\u884c:\r\n        python -m key_musicz_res [\u53ef\u9009\u53c2\u6570]\r\n    \u53ef\u9009\u53c2\u6570\u548c\u672c\u9879\u76ee\u4e00\u6837\uff0c\u4e0d\u8fc7\u52a0\u4e86\u9ed8\u8ba4\u503c\uff0c\u53ef\u4ee5\u4e0d\u7528\u5199\r\n)\r\n\u9700\u8981\u4ee5\u4e0bC\u5e93\u6216\u8d44\u6e90\u6587\u4ef6:\r\n    fluidsynth: \u8bfbsf2\u97f3\u9891\u6587\u4ef6\uff08\u91cc\u9762\u662f\u5404\u79cd\u4e50\u5668\u7684\u6309\u952e\u97f3\uff09\uff0c\u6839\u636e\u6307\u5b9a\u6309\u952e\u751f\u6210\u97f3\u9891\u6570\u636e\r\n    FluidR3_GM.sf2: \u514d\u8d39\u7684sf2\u97f3\u9891\u6587\u4ef6\uff0c\u5f53\u7136\u4f60\u4e5f\u53ef\u4ee5\u7528\u5176\u4ed6\u7684\r\n    portaudio: windows\u4e0b\u4f1a\u968f\u7740pyaudio\u81ea\u52a8\u5b89\u88c5\uff0clinux\u9700\u8981\u81ea\u5df1\u5b89\u88c5\r\n\u9700\u8981\u4ee5\u4e0bpython\u5e93(\u4f1a\u81ea\u52a8\u5b89\u88c5)\uff1a\r\n    pyfluidsynth: \u5728python\u91cc\u8c03\u7528fluidsynth\u5e93\u7684\u5c01\u88c5\u4ee3\u7801\r\n    pyaudio: \u97f3\u9891\u6570\u636e\u4f20\u5165\u58f0\u5361\u53d1\u97f3\uff0c\u5b9e\u9645\u8c03\u7528\u7684portaudio\u5e93\r\n    pynput: \u76d1\u542c\u952e\u76d8\u6309\u952e\u6309\u4e0b\u548c\u653e\u5f00\r\n    buildz: \u914d\u7f6e\u6587\u4ef6\u8bfb\u53d6\r\n\r\n\u5b89\u88c5\u65b9\u5f0f\uff1a\r\nfluidsynth:\r\n    ubuntu:\r\n        apt install fluidsynth\r\n    windows:\r\n        https://github.com/FluidSynth/fluidsynth/releases\r\n        windows\u4e0b\u662f\u538b\u7f29\u5305\uff0c\u89e3\u538b\u540e\u8981\u628a\u89e3\u538b\u8def\u5f84/bin\u52a0\u5230PATH\u4e2d\uff0c\u6ce8\u610fgithub\u65f6\u4e0d\u65f6\u4f1a\u8fde\u4e0d\u4e0a\uff0c\u53ef\u4ee5\u8bd5\u8bd5\u955c\u50cf\u52a0\u901f\u4e4b\u7c7b\u7684\r\n\r\nFluidR3_GM.sf2\u97f3\u9891\u6587\u4ef6\u4e0b\u8f7d\uff1a\r\n    \u6709\u4e2a\u56fd\u5185\u5730\u5740\uff0c\u662fcsdn\u7684gitcode.com\u91cc\u7684\uff0c\u8981\u767b\u5f55\u4f46\u4e0d\u6536\u8d39\uff1a\r\n        https://gitcode.com/open-source-toolkit/1d145/?utm_source=tools_gitcode&index=top&type=card&\r\n    \u6587\u4ef6\u5927\u5c0f\u4e00\u767e\u591aMB\r\n\r\npyfluidsynth:\r\npyaudio:\r\npynput:\r\nbuildz:\r\n    pip install key_musicz\r\n    \u5b89\u88c5\u672c\u5e93\u7684\u65f6\u5019\u81ea\u52a8\u5b89\u88c5\uff0c\u5176\u4e2dlinux\u4e0b\u7684pyaudio\u53ef\u80fd\u4f1a\u62a5\u9519\uff0c\u9700\u8981\u5148\u624b\u52a8\u5b89\u88c5portaudio\r\n\r\n\u7a0b\u5e8f\u8fd0\u884c:\r\n    python -m key_musicz.run \u53c2\u6570\r\n    \u53c2\u6570\u5982\u4e0b:\r\n        [-s/--sfile=]sf2\u6587\u4ef6\r\n        [-f/--fp=]\u989d\u5916\u914d\u7f6e\u6587\u4ef6(\u6ca1\u5565\u7528)\r\n        [-t/--default=]\u4e3b\u8981\u914d\u7f6e\u6587\u4ef6(\u9ed8\u8ba4\u9884\u5236\u7684play.js)\r\n        [-l/--libpath=]windows\u4e0bfluidsynth\u5e93\u7684bin\u7684\u8def\u5f84\r\n        [-h/--help]\r\n    \u4f8b\uff1a\r\n        python -m key_musicz.run -s./FluidR3Mono_GM.sf2 -l./lib -tplayrb.js\r\n    \u9ed8\u8ba4\u914d\u7f6e\u6587\u4ef6\uff08key_music/conf\u76ee\u5f55\u4e0b\uff09\uff1a\r\n        \u901a\u7528\u914d\u7f6e\uff1a\r\n            \u6309\u4f4fshift+\u4e3b\u952e\u76d8\u7684\u6570\u5b57\u952e\u76d8\u8c03\u6574\u57fa\u8c03\uff0c~\u9000\u51fa\uff0c\u7a7a\u683c\u5207\u97f3\r\n        play.js:\r\n            \u4ece\u5de6\u5230\u53f3\u4ece\u4e0b\u5230\u4e0a\u97f3\u8c03\u4f9d\u6b21\u5347\u9ad8\r\n            \u97f3\u8c03\u4ece\u4f4e\u5230\u9ad8\u987a\u5e8f: \r\n                    zxcvbnm,./`alt_l``alt_r` (\u8be5\u7ec4\u53d7\u57fa\u8c03\u5f71\u54cd\uff1ashift+1,3,5,7,9)\r\n                    asdfghjkl;'`enter` (\u8be5\u7ec4\u53d7\u57fa\u8c03\u5f71\u54cd\uff1ashift+1,3,5,7,9)\r\n                    qwertyuiop[] (\u8be5\u7ec4\u53d7\u57fa\u8c03\u5f71\u54cd\uff1ashift+2,4,6,8,0)\r\n                    1234567890-= (\u8be5\u7ec4\u53d7\u57fa\u8c03\u5f71\u54cd\uff1ashift+2,4,6,8,0)\r\n        playblk.js:\r\n            \u4e3b\u89812*6\u4f5c\u4e3a\u4e00\u7ec4\uff0c\u7ec4\u5185\u5927\u4f53\u4ece\u5de6\u5230\u53f3\uff0c\u4e0a\u5230\u4e0b\u5347\u9ad8\u97f3\u8c03\r\n            \u97f3\u8c03\u4ece\u4f4e\u5230\u9ad8\u987a\u5e8f: \r\n                12345qwert6y (\u8be5\u7ec4\u53d7\u57fa\u8c03\u5f71\u54cd\uff1ashift+1,3,5,7,9)\r\n                asdfgzxcvb`alt_l`h (\u8be5\u7ec4\u53d7\u57fa\u8c03\u5f71\u54cd\uff1ashift+1,3,5,7,9)\r\n                jkl;'nm,./`alt_r``enter` (\u8be5\u7ec4\u53d7\u57fa\u8c03\u5f71\u54cd\uff1ashift+2,4,6,8,0)\r\n                7890-uiop[=] (\u8be5\u7ec4\u53d7\u57fa\u8c03\u5f71\u54cd\uff1ashift+2,4,6,8,0)\r\n        playrb.js\r\n            \u4e3b\u89812*6\u4f5c\u4e3a\u4e00\u7ec4\uff0c\u7ec4\u5185\u5927\u4f53\u4ece\u5de6\u5230\u53f3\uff0c\u4e0b\u5230\u4e0a\u5347\u9ad8\u97f3\u8c03\r\n            \u97f3\u8c03\u4ece\u4f4e\u5230\u9ad8\u987a\u5e8f: : \r\n                qwert12345y6 (\u8be5\u7ec4\u53d7\u57fa\u8c03\u5f71\u54cd\uff1ashift+1,3,5,7,9)\r\n                zxcvbasdfg`alt_l`h (\u8be5\u7ec4\u53d7\u57fa\u8c03\u5f71\u54cd\uff1ashift+1,3,5,7,9)\r\n                nm,./jkl;'`alt_r``enter` (\u8be5\u7ec4\u53d7\u57fa\u8c03\u5f71\u54cd\uff1ashift+2,4,6,8,0)\r\n                uiop[7890-]= (\u8be5\u7ec4\u53d7\u57fa\u8c03\u5f71\u54cd\uff1ashift+2,4,6,8,0)\r\n        playbb.js\r\n            \u4e3b\u89812*6\u4f5c\u4e3a\u4e00\u7ec4\uff0c\u7ec4\u5185\u5927\u4f53\u4ece\u5de6\u5230\u53f3\u5347\u9ad8\u97f3\u8c03\uff0c\u5de6\u8fb9\u4ece\u4e0a\u5230\u4e0b\u5347\u9ad8\uff0c\u53f3\u8fb9\u4ece\u4e0b\u5230\u4e0a\u5347\u9ad8\r\n            \u97f3\u8c03\u4ece\u4f4e\u5230\u9ad8\u987a\u5e8f: : \r\n                12345qwert6y (\u8be5\u7ec4\u53d7\u57fa\u8c03\u5f71\u54cd\uff1ashift+1,3,5,7,9)\r\n                asdfgzxcvb`alt_l`h (\u8be5\u7ec4\u53d7\u57fa\u8c03\u5f71\u54cd\uff1ashift+1,3,5,7,9)\r\n                nm,./jkl;'`alt_r``enter` (\u8be5\u7ec4\u53d7\u57fa\u8c03\u5f71\u54cd\uff1ashift+2,4,6,8,0)\r\n                uiop[7890-]= (\u8be5\u7ec4\u53d7\u57fa\u8c03\u5f71\u54cd\uff1ashift+2,4,6,8,0)\r\n\r\n        \r\n```\r\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "\u952e\u76d8\u5f39\u94a2\u7434\uff0ckeyboard to play piano",
    "version": "0.2.1",
    "project_urls": {
        "Homepage": "https://github.com/buildCodeZ/key_musicz"
    },
    "split_keywords": [
        "key_musicz"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d901f2f10d7ae3c0f784eea4ec7a9651b3d1824cb0f9f45d40aeb32c1b3933fd",
                "md5": "d923eea97ec185573697d55194d14208",
                "sha256": "86d7a673acd9b775ff37c09605513179f8f8500fc257b3e61030a9265478590f"
            },
            "downloads": -1,
            "filename": "key_musicz-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "d923eea97ec185573697d55194d14208",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 37207,
            "upload_time": "2025-08-03T02:42:53",
            "upload_time_iso_8601": "2025-08-03T02:42:53.802184Z",
            "url": "https://files.pythonhosted.org/packages/d9/01/f2f10d7ae3c0f784eea4ec7a9651b3d1824cb0f9f45d40aeb32c1b3933fd/key_musicz-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-08-03 02:42:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "buildCodeZ",
    "github_project": "key_musicz",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "key-musicz"
}
        
Zzz
Elapsed time: 0.43797s