{"id":16545008,"url":"https://github.com/kenyony/guang","last_synced_at":"2025-08-08T17:22:59.313Z","repository":{"id":57436310,"uuid":"217702621","full_name":"KenyonY/guang","owner":"KenyonY","description":" Universal Function Library of Scientific Calculation","archived":false,"fork":false,"pushed_at":"2021-05-24T03:47:30.000Z","size":92708,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-08T16:45:59.666Z","etag":null,"topics":["deep-learning","machine-learning","tts","utility-library","voice-processing"],"latest_commit_sha":null,"homepage":"https://beidongjiedeguang.github.io/guang","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KenyonY.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-10-26T12:03:04.000Z","updated_at":"2021-08-16T16:24:52.000Z","dependencies_parsed_at":"2022-09-06T03:12:15.021Z","dependency_job_id":null,"html_url":"https://github.com/KenyonY/guang","commit_stats":null,"previous_names":["kenyony/guang","beidongjiedeguang/guang"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KenyonY%2Fguang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KenyonY%2Fguang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KenyonY%2Fguang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KenyonY%2Fguang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KenyonY","download_url":"https://codeload.github.com/KenyonY/guang/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241809609,"owners_count":20023787,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","machine-learning","tts","utility-library","voice-processing"],"created_at":"2024-10-11T19:05:29.589Z","updated_at":"2025-03-04T08:17:10.769Z","avatar_url":"https://github.com/KenyonY.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Guang\n\n[![image](https://img.shields.io/badge/Pypi-0.0.8.1.0-green.svg)](https://pypi.org/project/guang)\n[![image](https://img.shields.io/badge/python-3.6+-blue.svg)](https://www.python.org/)\n[![image](https://img.shields.io/badge/license-GNU_GPL--v3-blue.svg)](LICENSE)\n[![image](https://img.shields.io/badge/author-K.y-orange.svg?style=flat-square\u0026logo=appveyor)](https://github.com/beidongjiedeguang)\n\n\n\n\nUniversal function library of scientific calculation.\n\n## Requirements\n\n```python\nPython 3\nCUDA \u003e= 10.0\nPyTorch \u003e= 1.0\nTensorflow \u003e= 1.12.0\nopencv-python\npydub\nlibrosa\npyworld\nsoundfile\npypinyin\npomegranate\npython-Levenshtein\nstreamlit\npyprobar\nfire\n```\n\n\n\n## Installation\n\n```python\n# Before install `guang`, you need to have all the requirements installed.\npip install guang\n```\n\n​\t*Nightly* Build\n\n```bash\ngit clone https://github.com/beidongjiedeguang/guang.git\ncd guang\npython ./night_workflow.py\n```\n\n\n\n## Examples\n\n- Convert audio in .mp3/ .wav format to (sample rate=16k, single channel) .wav format\n\n  **Use in bash/shell**\n\n  ```bash\n  guang cvt2wav INPUT OUTPUT\n  ```\n\n  **Use as function**\n\n  ```python\n  from guang.Voice.convert import cvt2wav\n  cvt2wav(input_name, output_name, sr=16000)\n  \n  # Multi-process\n  from guang.Voice.convert import multi_cvt2wav \n  multi_cvt2wav(PATH1, PATH2,sr=16000, n_cpu=None)\n  ```\n  \n\n\n\n* **Let the video play at N times speed** (install ffmpeg first)\n\n  ```bash\n  guang av_speed inputname outputname N --cut_frame=False\n  ```\n\n  \n\n* **Fourier visualization** \n\n  ```bash\n  guang fourier\n  ```\n\n* **Fourier draw anything**\n\n  \u003cimg src=\"docs/picture/fourier1.gif\" width = \"400\" height = \"300\"/\u003e\n\n  \n\n  \u003cimg src=\"docs/picture/fourier0.gif\" width = \"400\" height = \"300\"/\u003e\n\n* **FFT  convolution**\n\n  ```python\n  from guang.sci import fft\n  A = np.random.rand(100, 100)\n  B = np.random.rand(100, 100)\n  fft.fft_conv2d(A, B)\n  ```\n\n  \n\n* Use `dict_dotable` to convert a dictionary to dot-able dictionary:\n\n  ```python\n  from guang.Utils.toolsFunc import dict_dotable\n  a = {'a':{'b':1}}\n  a = dict_dotable(a)\n  print(a.a.b)\n  \n  \u003e\u003e 1\n  ```\n\n  \n\n* ~~Use `probar` to display current progress~~   has separated to  [pyprobar](https://github.com/beidongjiedeguang/python-progress-bar)\n\n  ```python\n  from guang.Utils.bar import bar, probar\n  for idx, x in probar(range(10)):\n      time.sleep(0.8)\n  \n  \u003e\u003e 100.00% |█████████████████████████████| 0'7.2\"|0'7.2\" ETC: 12-2 23:59:8\n  \n  N = 1024\n  a = np.linspace(2, 5, N)\n  for idx, i in enumerate(a):\n      time.sleep(0.01)\n      bar(idx, N)\n  \u003e\u003e 100.00% |█████████████████████████████| 0:00:00|0:00:10  ETC: 02-19 20:33:34 \n  ```\n\n  \n\n* `@broadcast`  broadcast a non-broadcast function.\n\n  ```python\n  from guang.Utils.toolsFunc import broadcast\n  \n  @broadcast\n  def f(x):\n      # A function that can map only a single element\n      if x==1 or x==0:\n          return x\n      else:\n          return f(x-1)+f(x-2)\n  \n  \u003e\u003e f([2,4,10])\n  \u003e\u003e array([1, 3, 832040], dtype=object)\n  ```\n\n  \n\n* `download` download files from google drive.\n\n  ```python\n  from guang.Utils.google import download\n  url = \"https://drive.google.com/open?id=1eU57Fkv1DBEOqi-iOs1AebD02FqVDY23\"\n  outname = \"filename.zip\"\n  download(url, outname)\n  ```\n\n  \n\n* `txt2ph` Convert Chinese characters to phoneme.\n\n  ```python\n  from guang.Voice.txt2pinyin import txt2ph\n  txt2ph('你好，我是光')\n  \n  \u003e\u003e [('n', 'i3'), ('h', 'ao3'), ('sp1',), ('uo3',), ('sh', 'ii4'), ('g', 'uang1')]\n  ```\n\n\n\n\n* `reduce_from_duration` Remove files with duration less than `least_time` seconds. \n  Note that this function does not work in the interactive interpreter because it uses [`multiprocessing.pool.Pool`](https://docs.python.org/zh-cn/3/library/multiprocessing.html#multiprocessing.pool.Pool)\n\n  ```python\n  from guang.Voice.reduce import reduce_from_duration\n  \n  reduced_list = reduce_from_duration(path_list, least_time=2)\n  print(len(path_list), len(reduced_list))\n  \n  \u003e\u003e (6889, 6714)\n  ```\n\n\n\n* Find NOT silence part of a sound file: `find_no_silence`\n\n  ```python\n  from guang.Voice.reduce import find_no_silence\n  start, end, arg_start, arg_end = find_no_silence(filename)\n  ```\n\n  \n\n* Download wechat files.\n\n  ```python\n  from guang.wechat.Utils.download import downloads\n  downloads(nickName='caloi', fileType='mp3', d_t=60)\n  ```\n\n  \n\n* Plots 3D Scatter:\n\n  ```python\n  from guang.Utils.plotly import Scatter3d\n  from guang.Utils.interesting import Lorenz\n  trace = Lorenz.Trace()\n  x,y,z = trace[:,0], trace[:,1], trace[:,2]\n  \n  fig = Scatter3d()\n  fig.scatter3d(x,y,z,mode=\"lines+markers\",color_line=z,color_marker=None,marker_size=2)\n  fig.show()\n  ```\n\n  \u003cimg src=\"docs/picture/Lorenz.gif\" width = \"400\" height = \"300\"/\u003e\n\n\n\n* Data dimension reduction:\n\n  ```bash\n  cd guang/ML/manifold\n  python test_digits.py\n  ```\n\n  \u003cimg src=\"docs/picture/digits_dimension_reduction.PNG\" width = \"800\" height = \"400\" /\u003e\n\n  ```bash\n  python test_s_curve\n  ```\n\n  \n\n  \u003cimg src=\"docs/picture/s_curve.gif\" width = \"500\" height = \"500\" /\u003e\n\n  \u003cimg src=\"docs/picture/s_curve_dimension_reduction.PNG\" width = \"1000\" height = \"400\"/\u003e\n\n\n\n\n\n\n\n\n\n\n\n* :smiley: \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenyony%2Fguang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkenyony%2Fguang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkenyony%2Fguang/lists"}