├── .gitattributes ├── .github └── workflows │ ├── linux.python-app.yml │ └── windows.python-app.yml ├── .gitignore ├── HappyLighting-py_logo.png ├── LEDStripController.sln ├── LEDStripController ├── BLEClass.py ├── ExternalAudio.py ├── Flower.gif ├── GUI_designer.ui ├── HappyLighting-py_icon.png ├── PyHL.pyproj ├── Utils.py ├── dsp.py ├── gamma_table.npy ├── melbank.py ├── pyhl.py ├── pyhl.spec └── requirements.txt ├── LICENSE └── README.md /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.github/workflows/linux.python-app.yml: -------------------------------------------------------------------------------- 1 | # This workflow will install Python dependencies, run tests and lint with a single version of Python 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python 3 | 4 | name: HappyLighting-py Action 5 | 6 | on: 7 | push: 8 | branches: [ "master" ] 9 | pull_request: 10 | branches: [ "master" ] 11 | 12 | permissions: 13 | contents: read 14 | 15 | jobs: 16 | build: 17 | 18 | runs-on: ubuntu-latest 19 | 20 | steps: 21 | - uses: actions/checkout@v3 22 | - name: Install dependencies 23 | run: | 24 | sudo apt update 25 | sudo apt install libasound-dev portaudio19-dev -y 26 | 27 | - uses: actions/checkout@v3 28 | - name: Set up Python 3.10 29 | uses: actions/setup-python@v3 30 | with: 31 | python-version: "3.10" 32 | - name: Install dependencies 33 | run: | 34 | python -m pip install --upgrade pip 35 | pip install flake8 pytest 36 | if [ -f LEDStripController/requirements.txt ]; then pip install -r LEDStripController/requirements.txt; fi 37 | - name: Compile and generate exe 38 | run: | 39 | python -m pip install pyinstaller 40 | pyinstaller LEDStripController/pyhl.spec 41 | 42 | - name: Upload build 43 | uses: actions/upload-artifact@v3 44 | with: 45 | name: PyHL - Linux Release generated 46 | path: dist/PyHL - GUI 47 | 48 | -------------------------------------------------------------------------------- /.github/workflows/windows.python-app.yml: -------------------------------------------------------------------------------- 1 | # This workflow will install Python dependencies, run tests and lint with a single version of Python 2 | # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python 3 | 4 | name: HappyLighting-py Action 5 | 6 | on: 7 | push: 8 | branches: [ "master" ] 9 | pull_request: 10 | branches: [ "master" ] 11 | 12 | permissions: 13 | contents: read 14 | 15 | jobs: 16 | build: 17 | 18 | runs-on: windows-latest 19 | 20 | steps: 21 | - uses: actions/checkout@v3 22 | - name: Set up Python 3.10 23 | uses: actions/setup-python@v3 24 | with: 25 | architecture: 'x64' 26 | python-version: "3.10" 27 | - name: Install dependencies 28 | run: | 29 | pip install -r LEDStripController/requirements.txt 30 | - name: Compile and generate exe 31 | run: | 32 | python -m pip install pyinstaller 33 | pyinstaller LEDStripController/pyhl.spec 34 | 35 | - name: Upload build 36 | uses: actions/upload-artifact@v2 37 | with: 38 | name: PyHL - Windows Release generated 39 | path: dist/PyHL - GUI.exe 40 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | ## 4 | ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore 5 | 6 | # User-specific files 7 | *.rsuser 8 | *.suo 9 | *.user 10 | *.userosscache 11 | *.sln.docstates 12 | 13 | # User-specific files (MonoDevelop/Xamarin Studio) 14 | *.userprefs 15 | 16 | # Mono auto generated files 17 | mono_crash.* 18 | 19 | # Build results 20 | [Dd]ebug/ 21 | [Dd]ebugPublic/ 22 | [Rr]elease/ 23 | [Rr]eleases/ 24 | x64/ 25 | x86/ 26 | [Ww][Ii][Nn]32/ 27 | [Aa][Rr][Mm]/ 28 | [Aa][Rr][Mm]64/ 29 | bld/ 30 | [Bb]in/ 31 | [Oo]bj/ 32 | [Oo]ut/ 33 | [Ll]og/ 34 | [Ll]ogs/ 35 | 36 | # Visual Studio 2015/2017 cache/options directory 37 | .vs/ 38 | .Arts/ 39 | # Uncomment if you have tasks that create the project's static files in wwwroot 40 | #wwwroot/ 41 | 42 | # Visual Studio 2017 auto generated files 43 | Generated\ Files/ 44 | 45 | # MSTest test Results 46 | [Tt]est[Rr]esult*/ 47 | [Bb]uild[Ll]og.* 48 | 49 | # NUnit 50 | *.VisualState.xml 51 | TestResult.xml 52 | nunit-*.xml 53 | 54 | # Build Results of an ATL Project 55 | [Dd]ebugPS/ 56 | [Rr]eleasePS/ 57 | dlldata.c 58 | 59 | # Benchmark Results 60 | BenchmarkDotNet.Artifacts/ 61 | 62 | # .NET Core 63 | project.lock.json 64 | project.fragment.lock.json 65 | artifacts/ 66 | 67 | # ASP.NET Scaffolding 68 | ScaffoldingReadMe.txt 69 | 70 | # StyleCop 71 | StyleCopReport.xml 72 | 73 | # Files built by Visual Studio 74 | *_i.c 75 | *_p.c 76 | *_h.h 77 | *.ilk 78 | *.meta 79 | *.obj 80 | *.iobj 81 | *.pch 82 | *.pdb 83 | *.ipdb 84 | *.pgc 85 | *.pgd 86 | *.rsp 87 | *.sbr 88 | *.tlb 89 | *.tli 90 | *.tlh 91 | *.tmp 92 | *.tmp_proj 93 | *_wpftmp.csproj 94 | *.log 95 | *.vspscc 96 | *.vssscc 97 | .builds 98 | *.pidb 99 | *.svclog 100 | *.scc 101 | 102 | # Chutzpah Test files 103 | _Chutzpah* 104 | 105 | # Visual C++ cache files 106 | ipch/ 107 | *.aps 108 | *.ncb 109 | *.opendb 110 | *.opensdf 111 | *.sdf 112 | *.cachefile 113 | *.VC.db 114 | *.VC.VC.opendb 115 | 116 | # Visual Studio profiler 117 | *.psess 118 | *.vsp 119 | *.vspx 120 | *.sap 121 | 122 | # Visual Studio Trace Files 123 | *.e2e 124 | 125 | # TFS 2012 Local Workspace 126 | $tf/ 127 | 128 | # Guidance Automation Toolkit 129 | *.gpState 130 | 131 | # ReSharper is a .NET coding add-in 132 | _ReSharper*/ 133 | *.[Rr]e[Ss]harper 134 | *.DotSettings.user 135 | 136 | # TeamCity is a build add-in 137 | _TeamCity* 138 | 139 | # DotCover is a Code Coverage Tool 140 | *.dotCover 141 | 142 | # AxoCover is a Code Coverage Tool 143 | .axoCover/* 144 | !.axoCover/settings.json 145 | 146 | # Coverlet is a free, cross platform Code Coverage Tool 147 | coverage*.json 148 | coverage*.xml 149 | coverage*.info 150 | 151 | # Visual Studio code coverage results 152 | *.coverage 153 | *.coveragexml 154 | 155 | # NCrunch 156 | _NCrunch_* 157 | .*crunch*.local.xml 158 | nCrunchTemp_* 159 | 160 | # MightyMoose 161 | *.mm.* 162 | AutoTest.Net/ 163 | 164 | # Web workbench (sass) 165 | .sass-cache/ 166 | 167 | # Installshield output folder 168 | [Ee]xpress/ 169 | 170 | # DocProject is a documentation generator add-in 171 | DocProject/buildhelp/ 172 | DocProject/Help/*.HxT 173 | DocProject/Help/*.HxC 174 | DocProject/Help/*.hhc 175 | DocProject/Help/*.hhk 176 | DocProject/Help/*.hhp 177 | DocProject/Help/Html2 178 | DocProject/Help/html 179 | 180 | # Click-Once directory 181 | publish/ 182 | 183 | # Publish Web Output 184 | *.[Pp]ublish.xml 185 | *.azurePubxml 186 | # Note: Comment the next line if you want to checkin your web deploy settings, 187 | # but database connection strings (with potential passwords) will be unencrypted 188 | *.pubxml 189 | *.publishproj 190 | 191 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 192 | # checkin your Azure Web App publish settings, but sensitive information contained 193 | # in these scripts will be unencrypted 194 | PublishScripts/ 195 | 196 | # NuGet Packages 197 | *.nupkg 198 | # NuGet Symbol Packages 199 | *.snupkg 200 | # The packages folder can be ignored because of Package Restore 201 | **/[Pp]ackages/* 202 | # except build/, which is used as an MSBuild target. 203 | !**/[Pp]ackages/build/ 204 | # Uncomment if necessary however generally it will be regenerated when needed 205 | #!**/[Pp]ackages/repositories.config 206 | # NuGet v3's project.json files produces more ignorable files 207 | *.nuget.props 208 | *.nuget.targets 209 | 210 | # Microsoft Azure Build Output 211 | csx/ 212 | *.build.csdef 213 | 214 | # Microsoft Azure Emulator 215 | ecf/ 216 | rcf/ 217 | 218 | # Windows Store app package directories and files 219 | AppPackages/ 220 | BundleArtifacts/ 221 | Package.StoreAssociation.xml 222 | _pkginfo.txt 223 | *.appx 224 | *.appxbundle 225 | *.appxupload 226 | 227 | # Visual Studio cache files 228 | # files ending in .cache can be ignored 229 | *.[Cc]ache 230 | # but keep track of directories ending in .cache 231 | !?*.[Cc]ache/ 232 | 233 | # Others 234 | ClientBin/ 235 | ~$* 236 | *~ 237 | *.dbmdl 238 | *.dbproj.schemaview 239 | *.jfm 240 | *.pfx 241 | *.publishsettings 242 | orleans.codegen.cs 243 | 244 | # Including strong name files can present a security risk 245 | # (https://github.com/github/gitignore/pull/2483#issue-259490424) 246 | #*.snk 247 | 248 | # Since there are multiple workflows, uncomment next line to ignore bower_components 249 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 250 | #bower_components/ 251 | 252 | # RIA/Silverlight projects 253 | Generated_Code/ 254 | 255 | # Backup & report files from converting an old project file 256 | # to a newer Visual Studio version. Backup files are not needed, 257 | # because we have git ;-) 258 | _UpgradeReport_Files/ 259 | Backup*/ 260 | UpgradeLog*.XML 261 | UpgradeLog*.htm 262 | ServiceFabricBackup/ 263 | *.rptproj.bak 264 | 265 | # SQL Server files 266 | *.mdf 267 | *.ldf 268 | *.ndf 269 | 270 | # Business Intelligence projects 271 | *.rdl.data 272 | *.bim.layout 273 | *.bim_*.settings 274 | *.rptproj.rsuser 275 | *- [Bb]ackup.rdl 276 | *- [Bb]ackup ([0-9]).rdl 277 | *- [Bb]ackup ([0-9][0-9]).rdl 278 | 279 | # Microsoft Fakes 280 | FakesAssemblies/ 281 | 282 | # GhostDoc plugin setting file 283 | *.GhostDoc.xml 284 | 285 | # Node.js Tools for Visual Studio 286 | .ntvs_analysis.dat 287 | node_modules/ 288 | 289 | # Visual Studio 6 build log 290 | *.plg 291 | 292 | # Visual Studio 6 workspace options file 293 | *.opt 294 | 295 | # Visual Studio 6 auto-generated workspace file (contains which files were open etc.) 296 | *.vbw 297 | 298 | # Visual Studio LightSwitch build output 299 | **/*.HTMLClient/GeneratedArtifacts 300 | **/*.DesktopClient/GeneratedArtifacts 301 | **/*.DesktopClient/ModelManifest.xml 302 | **/*.Server/GeneratedArtifacts 303 | **/*.Server/ModelManifest.xml 304 | _Pvt_Extensions 305 | 306 | # Paket dependency manager 307 | .paket/paket.exe 308 | paket-files/ 309 | 310 | # FAKE - F# Make 311 | .fake/ 312 | 313 | # CodeRush personal settings 314 | .cr/personal 315 | 316 | # Python Tools for Visual Studio (PTVS) 317 | __pycache__/ 318 | *.pyc 319 | 320 | # Cake - Uncomment if you are using it 321 | # tools/** 322 | # !tools/packages.config 323 | 324 | # Tabs Studio 325 | *.tss 326 | 327 | # Telerik's JustMock configuration file 328 | *.jmconfig 329 | 330 | # BizTalk build output 331 | *.btp.cs 332 | *.btm.cs 333 | *.odx.cs 334 | *.xsd.cs 335 | 336 | # OpenCover UI analysis results 337 | OpenCover/ 338 | 339 | # Azure Stream Analytics local run output 340 | ASALocalRun/ 341 | 342 | # MSBuild Binary and Structured Log 343 | *.binlog 344 | 345 | # NVidia Nsight GPU debugger configuration file 346 | *.nvuser 347 | 348 | # MFractors (Xamarin productivity tool) working folder 349 | .mfractor/ 350 | 351 | # Local History for Visual Studio 352 | .localhistory/ 353 | 354 | # BeatPulse healthcheck temp database 355 | healthchecksdb 356 | 357 | # Backup folder for Package Reference Convert tool in Visual Studio 2017 358 | MigrationBackup/ 359 | 360 | # Ionide (cross platform F# VS Code tools) working folder 361 | .ionide/ 362 | 363 | # Fody - auto-generated XML schema 364 | FodyWeavers.xsd 365 | /LEDStripController/env 366 | /Arts 367 | /LEDStripController/build/pyhl 368 | -------------------------------------------------------------------------------- /HappyLighting-py_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikeCoder96/HappyLighting-py/82fdd49742486d27410fad2b526853c849d07207/HappyLighting-py_logo.png -------------------------------------------------------------------------------- /LEDStripController.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio Version 16 4 | VisualStudioVersion = 16.0.31105.61 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{888888A0-9F3D-457C-B088-3A5042F75D52}") = "PyHL", "LEDStripController\PyHL.pyproj", "{D0BF8EF8-8392-49ED-8774-4462A5237E86}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Debug|x86 = Debug|x86 13 | Release|Any CPU = Release|Any CPU 14 | Release|x64 = Release|x64 15 | Release|x86 = Release|x86 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {D0BF8EF8-8392-49ED-8774-4462A5237E86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {D0BF8EF8-8392-49ED-8774-4462A5237E86}.Debug|x64.ActiveCfg = Debug|Any CPU 20 | {D0BF8EF8-8392-49ED-8774-4462A5237E86}.Debug|x86.ActiveCfg = Debug|Any CPU 21 | {D0BF8EF8-8392-49ED-8774-4462A5237E86}.Release|Any CPU.ActiveCfg = Release|Any CPU 22 | {D0BF8EF8-8392-49ED-8774-4462A5237E86}.Release|x64.ActiveCfg = Release|Any CPU 23 | {D0BF8EF8-8392-49ED-8774-4462A5237E86}.Release|x86.ActiveCfg = Release|Any CPU 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {06369621-603F-44EC-A403-434C3D7ABF1C} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /LEDStripController/BLEClass.py: -------------------------------------------------------------------------------- 1 | import Utils 2 | import asyncio 3 | from dataclasses import dataclass 4 | from functools import cached_property 5 | from bleak import BleakScanner, BleakClient 6 | from bleak.backends.device import BLEDevice 7 | from PyQt5.QtCore import QObject, pyqtSignal 8 | 9 | UART_SERVICE_UUID = "" 10 | UART_RX_CHAR_UUID = "" 11 | UART_TX_CHAR_UUID = "" 12 | UART_SAFE_SIZE = 20 13 | 14 | @dataclass 15 | class QBleakClient(QObject): 16 | device : BLEDevice 17 | 18 | messageChanged = pyqtSignal(bytes) 19 | 20 | def __post_init__(self): 21 | global UART_SERVICE_UUID, UART_RX_CHAR_UUID, UART_TX_CHAR_UUID, UART_SAFE_SIZE 22 | super().__init__() 23 | 24 | @cached_property 25 | def client(self) -> BleakClient: 26 | return BleakClient(self.device, disconnected_callback=self._handle_disconnect) 27 | 28 | async def start(self): 29 | global UART_TX_CHAR_UUID, UART_RX_CHAR_UUID 30 | try: 31 | await self.client.connect() 32 | for service in self.client.services: 33 | if service.description == "Generic Access Profile": 34 | for char in service.characteristics: 35 | Utils.printLog("Set UART_RX_CHAR_UUID with {}".format(char.uuid)) 36 | UART_RX_CHAR_UUID = char.uuid 37 | 38 | elif service.description == "Vendor specific": 39 | for char in service.characteristics: 40 | if (','.join(char.properties) == "write-without-response,write") and UART_TX_CHAR_UUID == "": 41 | Utils.printLog("Set UART_TX_CHAR_UUID with {}".format(char.uuid)) 42 | UART_TX_CHAR_UUID = char.uuid 43 | 44 | except asyncio.CancelledError as ex: 45 | print(ex) 46 | 47 | async def stop(self): 48 | try: 49 | await self.client.disconnect() 50 | except asyncio.CancelledError as ex: 51 | pass 52 | 53 | async def writeColor(self, R=0, G=0, B=0): 54 | lista = [86, R, G, B, (int(10 * 255 / 100) & 0xFF), 256-16, 256-86] 55 | values = bytearray(lista) 56 | try: 57 | Utils.printLog("Change Color called R:{} G:{} B:{} ".format(R, G, B)) 58 | await self.client.write_gatt_char(UART_TX_CHAR_UUID, values, False) 59 | except Exception as inst: 60 | print(inst) 61 | 62 | async def writePower(self, state): 63 | lista = [204, 35, 51] 64 | if state == "Off": 65 | lista = [204, 36, 51] 66 | 67 | values = bytearray(lista) 68 | try: 69 | Utils.printLog("Change Power called Power : {}".format(state)) 70 | await self.client.write_gatt_char(UART_TX_CHAR_UUID, values, False) 71 | except Exception as inst: 72 | print(inst) 73 | 74 | async def writeMode(self, idx): 75 | 76 | #new byte[] { 256 - 69, mode, (byte)(speed & 0xFF), 68 }; 77 | i_mode = Utils.Modes[idx] 78 | lista = [256 - 69, i_mode, (Utils.Speed & 0xFF), 68] 79 | values = bytearray(lista) 80 | try: 81 | Utils.printLog("Change Mode with ID {} Speed {}".format(i_mode, Utils.Speed)) 82 | await self.client.write_gatt_char(UART_TX_CHAR_UUID, values, False) 83 | except Exception as inst: 84 | print(inst) 85 | 86 | async def writeMicState(self, enable): 87 | 88 | var_1 = -1 89 | var_2 = -1 90 | if enable: 91 | var_1 = 256 - 16 92 | var_2 = 50 93 | else: 94 | var_1 = 15 95 | var_2 = 30 96 | lista = [1, var_1, var_2,0 ,0, 24] 97 | values = bytearray(lista) 98 | try: 99 | #Utils.printLog("Change Mode with ID {} ".format(i_mode)) 100 | await self.client.write_gatt_char(UART_TX_CHAR_UUID, values, False) 101 | except Exception as inst: 102 | print(inst) 103 | 104 | #TODO: Implement disconnect function 105 | def _handle_disconnect(self, device) -> None: 106 | Utils.printLog("Device was disconnected") 107 | # cancelling all tasks effectively ends the program 108 | for task in asyncio.all_tasks(): 109 | task.cancel() 110 | -------------------------------------------------------------------------------- /LEDStripController/ExternalAudio.py: -------------------------------------------------------------------------------- 1 | from __future__ import print_function 2 | from __future__ import division 3 | import time 4 | import qasync 5 | import pyaudio 6 | import numpy as np 7 | from scipy.ndimage.filters import gaussian_filter1d 8 | import Utils 9 | import dsp 10 | #import led 11 | 12 | # Number of audio samples to read every time frame 13 | samples_per_frame = int(Utils.MIC_RATE / Utils.FPS) 14 | 15 | # Array containing the rolling audio sample window 16 | y_roll = np.random.rand(Utils.N_ROLLING_HISTORY, samples_per_frame) / 1e16 17 | 18 | fft_plot_filter = dsp.ExpFilter(np.tile(1e-1, Utils.N_FFT_BINS), 19 | alpha_decay=0.5, alpha_rise=0.99) 20 | mel_gain = dsp.ExpFilter(np.tile(1e-1, Utils.N_FFT_BINS), 21 | alpha_decay=0.01, alpha_rise=0.99) 22 | mel_smoothing = dsp.ExpFilter(np.tile(1e-1, Utils.N_FFT_BINS), 23 | alpha_decay=0.5, alpha_rise=0.99) 24 | volume = dsp.ExpFilter(Utils.MIN_VOLUME_THRESHOLD, 25 | alpha_decay=0.02, alpha_rise=0.02) 26 | fft_window = np.hamming(int(Utils.MIC_RATE / Utils.FPS) * Utils.N_ROLLING_HISTORY) 27 | prev_fps_update = time.time() 28 | 29 | r_filt = dsp.ExpFilter(np.tile(0.01, Utils.N_PIXELS // 2), 30 | alpha_decay=0.2, alpha_rise=0.99) 31 | g_filt = dsp.ExpFilter(np.tile(0.01, Utils.N_PIXELS // 2), 32 | alpha_decay=0.05, alpha_rise=0.3) 33 | b_filt = dsp.ExpFilter(np.tile(0.01, Utils.N_PIXELS // 2), 34 | alpha_decay=0.1, alpha_rise=0.5) 35 | common_mode = dsp.ExpFilter(np.tile(0.01, Utils.N_PIXELS // 2), 36 | alpha_decay=0.99, alpha_rise=0.01) 37 | p_filt = dsp.ExpFilter(np.tile(1, (3, Utils.N_PIXELS // 2)), 38 | alpha_decay=0.1, alpha_rise=0.99) 39 | p = np.tile(1.0, (3, Utils.N_PIXELS // 2)) 40 | gain = dsp.ExpFilter(np.tile(0.01, Utils.N_FFT_BINS), 41 | alpha_decay=0.001, alpha_rise=0.99) 42 | 43 | _prev_spectrum = np.tile(0.01, Utils.N_PIXELS // 2) 44 | 45 | pixels = np.tile(1, (3, Utils.N_PIXELS)) 46 | 47 | _gamma = np.load(Utils.GAMMA_TABLE_PATH) 48 | 49 | def memoize(function): 50 | """Provides a decorator for memoizing functions""" 51 | from functools import wraps 52 | memo = {} 53 | 54 | @wraps(function) 55 | def wrapper(*args): 56 | if args in memo: 57 | return memo[args] 58 | else: 59 | rv = function(*args) 60 | memo[args] = rv 61 | return rv 62 | return wrapper 63 | 64 | @memoize 65 | def _normalized_linspace(size): 66 | return np.linspace(0, 1, size) 67 | 68 | 69 | def interpolate(y, new_length): 70 | """Intelligently resizes the array by linearly interpolating the values 71 | 72 | Parameters 73 | ---------- 74 | y : np.array 75 | Array that should be resized 76 | 77 | new_length : int 78 | The length of the new interpolated array 79 | 80 | Returns 81 | ------- 82 | z : np.array 83 | New array with length of new_length that contains the interpolated 84 | values of y. 85 | """ 86 | if len(y) == new_length: 87 | return y 88 | x_old = _normalized_linspace(len(y)) 89 | x_new = _normalized_linspace(new_length) 90 | z = np.interp(x_new, x_old, y) 91 | return z 92 | 93 | def visualize_spectrum(y): 94 | """Effect that maps the Mel filterbank frequencies onto the LED strip""" 95 | global _prev_spectrum 96 | y = np.copy(interpolate(y, Utils.N_PIXELS // 2)) 97 | common_mode.update(y) 98 | diff = y - _prev_spectrum 99 | _prev_spectrum = np.copy(y) 100 | # Color channel mappings 101 | r = r_filt.update(y - common_mode.value) 102 | g = np.abs(diff) 103 | b = b_filt.update(np.copy(y)) 104 | # Mirror the color channels for symmetric output 105 | #r = np.concatenate((r[::-1], r)) 106 | #g = np.concatenate((g[::-1], g)) 107 | #b = np.concatenate((b[::-1], b)) 108 | output = np.array([r, g,b]) * 255 109 | return output 110 | 111 | 112 | async def updateLedColor(red, green, blue): 113 | 114 | if Utils.RedMic: 115 | if red >= 256: 116 | red = 255 117 | else: 118 | red = 0 119 | 120 | if Utils.GreenMic: 121 | if green >= 256: 122 | green = 255 123 | else: 124 | green = 0 125 | 126 | if Utils.BlueMic: 127 | if blue >= 256: 128 | blue = 255 129 | else: 130 | blue = 0 131 | 132 | await Utils.client.writeColor(red, green, blue) 133 | 134 | async def updateLed(): 135 | """Writes new LED values to the Blinkstick. 136 | This function updates the LED strip with new values. 137 | """ 138 | global pixels 139 | 140 | # Truncate values and cast to integer 141 | pixels = np.clip(pixels, 0, 255).astype(int) 142 | # Optional gamma correction 143 | p = _gamma[pixels] 144 | np.copy(pixels) 145 | # Read the rgb values 146 | r = p[0][:].astype(int) 147 | g = p[1][:].astype(int) 148 | b = p[2][:].astype(int) 149 | 150 | 151 | medianRed = max(r) 152 | medianGreen = max(g) 153 | medianBlue= max(b) 154 | 155 | await updateLedColor(int(medianRed), int(medianGreen), int(medianBlue)) 156 | 157 | async def start_stream(): 158 | frames_per_buffer = int(Utils.MIC_RATE / Utils.FPS) 159 | stream = Utils.p.open(format=pyaudio.paInt16, 160 | channels=1, 161 | input_device_index=Utils.selectedInputDevice, 162 | rate=Utils.MIC_RATE, 163 | input=True, 164 | frames_per_buffer=frames_per_buffer) 165 | overflows = 0 166 | prev_ovf_time = time.time() 167 | while True: 168 | try: 169 | if Utils.localAudio: 170 | y = np.fromstring(stream.read(frames_per_buffer, exception_on_overflow=False), dtype=np.int16) 171 | y = y.astype(np.float32) 172 | stream.read(stream.get_read_available(), exception_on_overflow=False) 173 | await microphone_update(y) 174 | else: 175 | break 176 | except IOError: 177 | overflows += 1 178 | if time.time() > prev_ovf_time + 1: 179 | prev_ovf_time = time.time() 180 | print('Audio buffer has overflowed {} times'.format(overflows)) 181 | 182 | stream.stop_stream() 183 | stream.close() 184 | Utils.p.terminate() 185 | Utils.p = pyaudio.PyAudio() 186 | 187 | async def microphone_update(y): 188 | global y_roll, prev_rms, prev_exp, prev_fps_update, pixels 189 | # Normalize samples between 0 and 1 190 | y = y / 2.0**15 191 | # Construct a rolling window of audio samples 192 | y_roll[:-1] = y_roll[1:] 193 | y_roll[-1, :] = np.copy(y) 194 | y_data = np.concatenate(y_roll, axis=0).astype(np.float32) 195 | 196 | vol = np.max(np.abs(y_data)) 197 | if False: 198 | #print('No audio input. Volume below threshold. Volume:', vol) 199 | #led.pixels = np.tile(0, (3, Utils.N_PIXELS)) 200 | #led.update() 201 | pass 202 | else: 203 | # Transform audio input into the frequency domain 204 | N = len(y_data) 205 | N_zeros = 2**int(np.ceil(np.log2(N))) - N 206 | # Pad with zeros until the next power of two 207 | y_data *= fft_window 208 | y_padded = np.pad(y_data, (0, N_zeros), mode='constant') 209 | YS = np.abs(np.fft.rfft(y_padded)[:N // 2]) 210 | # Construct a Mel filterbank from the FFT data 211 | mel = np.atleast_2d(YS).T * dsp.mel_y.T 212 | # Scale data to values more suitable for visualization 213 | # mel = np.sum(mel, axis=0) 214 | mel = np.sum(mel, axis=0) 215 | mel = mel**2.0 216 | # Gain normalization 217 | mel_gain.update(np.max(gaussian_filter1d(mel, sigma=1.0))) 218 | mel /= mel_gain.value 219 | mel = mel_smoothing.update(mel) 220 | # Map filterbank output onto LED strip 221 | pixels = visualize_spectrum(mel) 222 | await updateLed() 223 | -------------------------------------------------------------------------------- /LEDStripController/Flower.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikeCoder96/HappyLighting-py/82fdd49742486d27410fad2b526853c849d07207/LEDStripController/Flower.gif -------------------------------------------------------------------------------- /LEDStripController/GUI_designer.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 400 10 | 300 11 | 12 | 13 | 14 | MainWindow 15 | 16 | 17 | 18 | 19 | 20 | 210 21 | 110 22 | 180 23 | 180 24 | 25 | 26 | 27 | 28 | 29 | 30 | 250 31 | 80 32 | 131 33 | 22 34 | 35 | 36 | 37 | Qt::Horizontal 38 | 39 | 40 | 41 | 42 | 43 | 10 44 | 210 45 | 191 46 | 22 47 | 48 | 49 | 50 | 51 | 52 | 53 | 290 54 | 60 55 | 101 56 | 20 57 | 58 | 59 | 60 | Start Caoture 61 | 62 | 63 | 64 | 65 | 66 | 10 67 | 10 68 | 75 69 | 23 70 | 71 | 72 | 73 | Scan 74 | 75 | 76 | 77 | 78 | 79 | 10 80 | 65 81 | 75 82 | 23 83 | 84 | 85 | 86 | Power On 87 | 88 | 89 | 90 | 91 | 92 | 85 93 | 65 94 | 75 95 | 23 96 | 97 | 98 | 99 | Power Off 100 | 101 | 102 | 103 | 104 | 105 | 10 106 | 40 107 | 75 108 | 23 109 | 110 | 111 | 112 | Connect 113 | 114 | 115 | 116 | 117 | 118 | 90 119 | 10 120 | 121 121 | 22 122 | 123 | 124 | 125 | 126 | 127 | 128 | 220 129 | 11 130 | 20 131 | 20 132 | 133 | 134 | 135 | IMG 136 | 137 | 138 | 139 | 140 | 141 | 160 142 | 40 143 | 121 144 | 22 145 | 146 | 147 | 148 | 149 | 150 | 151 | 10 152 | 190 153 | 71 154 | 20 155 | 156 | 157 | 158 | Input Devices 159 | 160 | 161 | 162 | 163 | 164 | 310 165 | 10 166 | 80 167 | 23 168 | 169 | 170 | 171 | Color 172 | 173 | 174 | 175 | 176 | 177 | 150 178 | 230 179 | 51 180 | 23 181 | 182 | 183 | 184 | High 185 | 186 | 187 | 188 | 189 | 190 | 80 191 | 230 192 | 51 193 | 23 194 | 195 | 196 | 197 | Middle 198 | 199 | 200 | 201 | 202 | 203 | 10 204 | 230 205 | 51 206 | 23 207 | 208 | 209 | 210 | Bass 211 | 212 | 213 | 214 | 215 | 216 | 90 217 | 40 218 | 71 219 | 20 220 | 221 | 222 | 223 | Disconnected 224 | 225 | 226 | 227 | 228 | 229 | 10 230 | 170 231 | 82 232 | 17 233 | 234 | 235 | 236 | RadioButton 237 | 238 | 239 | 240 | 241 | 242 | 100 243 | 170 244 | 82 245 | 17 246 | 247 | 248 | 249 | RadioButton 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | -------------------------------------------------------------------------------- /LEDStripController/HappyLighting-py_icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikeCoder96/HappyLighting-py/82fdd49742486d27410fad2b526853c849d07207/LEDStripController/HappyLighting-py_icon.png -------------------------------------------------------------------------------- /LEDStripController/PyHL.pyproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Debug 4 | 2.0 5 | d0bf8ef8-8392-49ed-8774-4462a5237e86 6 | 7 | 8 | PyHL.py 9 | 10 | 11 | . 12 | . 13 | PyHL 14 | LEDStripController 15 | MSBuild|env|$(MSBuildProjectFullPath) 16 | 17 | 18 | true 19 | false 20 | 21 | 22 | true 23 | false 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | env 36 | 3.8 37 | env (Python 3.8 (64-bit)) 38 | Scripts\python.exe 39 | Scripts\pythonw.exe 40 | PYTHONPATH 41 | X64 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /LEDStripController/Utils.py: -------------------------------------------------------------------------------- 1 | import os 2 | import pyaudio 3 | 4 | DEBUG_LOGS = False 5 | Modes = [37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 6 | 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 7 | 97, 98, 99] 8 | 9 | InputDevices = {} 10 | p = pyaudio.PyAudio() 11 | selectedInputDevice = -1 12 | app = None 13 | captureMode = False 14 | 15 | Speed = 0 16 | isModeUsed = False 17 | client = None 18 | 19 | localAudio = False 20 | GreenMic = True 21 | RedMic = True 22 | BlueMic = True 23 | 24 | N_PIXELS = 60 25 | """Number of pixels in the LED strip (must match ESP8266 firmware)""" 26 | 27 | GAMMA_TABLE_PATH = os.path.join(os.path.dirname(__file__), 'gamma_table.npy') 28 | """Location of the gamma correction table""" 29 | 30 | MIC_RATE = 44100 31 | """Sampling frequency of the microphone in Hz""" 32 | 33 | FPS = 60 34 | """Desired refresh rate of the visualization (frames per second) 35 | 36 | FPS indicates the desired refresh rate, or frames-per-second, of the audio 37 | visualization. The actual refresh rate may be lower if the computer cannot keep 38 | up with desired FPS value. 39 | 40 | Higher framerates improve "responsiveness" and reduce the latency of the 41 | visualization but are more computationally expensive. 42 | 43 | Low framerates are less computationally expensive, but the visualization may 44 | appear "sluggish" or out of sync with the audio being played if it is too low. 45 | 46 | The FPS should not exceed the maximum refresh rate of the LED strip, which 47 | depends on how long the LED strip is. 48 | """ 49 | _max_led_FPS = int(((N_PIXELS * 30e-6) + 50e-6)**-1.0) 50 | assert FPS <= _max_led_FPS, 'FPS must be <= {}'.format(_max_led_FPS) 51 | 52 | MIN_FREQUENCY = 60 53 | """Frequencies below this value will be removed during audio processing""" 54 | 55 | MAX_FREQUENCY = 120 56 | """Frequencies above this value will be removed during audio processing""" 57 | 58 | N_FFT_BINS = 24 59 | """Number of frequency bins to use when transforming audio to frequency domain 60 | 61 | Fast Fourier transforms are used to transform time-domain audio data to the 62 | frequency domain. The frequencies present in the audio signal are assigned 63 | to their respective frequency bins. This value indicates the number of 64 | frequency bins to use. 65 | 66 | A small number of bins reduces the frequency resolution of the visualization 67 | but improves amplitude resolution. The opposite is true when using a large 68 | number of bins. More bins is not always better! 69 | 70 | There is no point using more bins than there are pixels on the LED strip. 71 | """ 72 | 73 | N_ROLLING_HISTORY = 2 74 | """Number of past audio frames to include in the rolling window""" 75 | 76 | MIN_VOLUME_THRESHOLD = 1e-7 77 | """No music visualization displayed if recorded audio volume below threshold""" 78 | 79 | 80 | def printLog(text): 81 | if DEBUG_LOGS: 82 | print("[+] {}".format(text)) 83 | -------------------------------------------------------------------------------- /LEDStripController/dsp.py: -------------------------------------------------------------------------------- 1 | 2 | from __future__ import print_function 3 | import numpy as np 4 | import Utils 5 | import melbank 6 | 7 | 8 | class ExpFilter: 9 | """Simple exponential smoothing filter""" 10 | def __init__(self, val=0.0, alpha_decay=0.5, alpha_rise=0.5): 11 | """Small rise / decay factors = more smoothing""" 12 | assert 0.0 < alpha_decay < 1.0, 'Invalid decay smoothing factor' 13 | assert 0.0 < alpha_rise < 1.0, 'Invalid rise smoothing factor' 14 | self.alpha_decay = alpha_decay 15 | self.alpha_rise = alpha_rise 16 | self.value = val 17 | 18 | def update(self, value): 19 | if isinstance(self.value, (list, np.ndarray, tuple)): 20 | alpha = value - self.value 21 | alpha[alpha > 0.0] = self.alpha_rise 22 | alpha[alpha <= 0.0] = self.alpha_decay 23 | else: 24 | alpha = self.alpha_rise if value > self.value else self.alpha_decay 25 | self.value = alpha * value + (1.0 - alpha) * self.value 26 | return self.value 27 | 28 | 29 | def rfft(data, window=None): 30 | window = 1.0 if window is None else window(len(data)) 31 | ys = np.abs(np.fft.rfft(data * window)) 32 | xs = np.fft.rfftfreq(len(data), 1.0 / config.MIC_RATE) 33 | return xs, ys 34 | 35 | 36 | def fft(data, window=None): 37 | window = 1.0 if window is None else window(len(data)) 38 | ys = np.fft.fft(data * window) 39 | xs = np.fft.fftfreq(len(data), 1.0 / Utils.MIC_RATE) 40 | return xs, ys 41 | 42 | 43 | def create_mel_bank(): 44 | global samples, mel_y, mel_x 45 | samples = int(Utils.MIC_RATE * Utils.N_ROLLING_HISTORY / (2.0 * Utils.FPS)) 46 | mel_y, (_, mel_x) = melbank.compute_melmat(num_mel_bands=Utils.N_FFT_BINS, 47 | freq_min=Utils.MIN_FREQUENCY, 48 | freq_max=Utils.MAX_FREQUENCY, 49 | num_fft_bands=samples, 50 | sample_rate=Utils.MIC_RATE) 51 | samples = None 52 | mel_y = None 53 | mel_x = None 54 | create_mel_bank() -------------------------------------------------------------------------------- /LEDStripController/gamma_table.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MikeCoder96/HappyLighting-py/82fdd49742486d27410fad2b526853c849d07207/LEDStripController/gamma_table.npy -------------------------------------------------------------------------------- /LEDStripController/melbank.py: -------------------------------------------------------------------------------- 1 | """This module implements a Mel Filter Bank. 2 | In other words it is a filter bank with triangular shaped bands 3 | arnged on the mel frequency scale. 4 | An example ist shown in the following figure: 5 | .. plot:: 6 | from pylab import plt 7 | import melbank 8 | f1, f2 = 1000, 8000 9 | melmat, (melfreq, fftfreq) = melbank.compute_melmat(6, f1, f2, num_fft_bands=4097) 10 | fig, ax = plt.subplots(figsize=(8, 3)) 11 | ax.plot(fftfreq, melmat.T) 12 | ax.grid(True) 13 | ax.set_ylabel('Weight') 14 | ax.set_xlabel('Frequency / Hz') 15 | ax.set_xlim((f1, f2)) 16 | ax2 = ax.twiny() 17 | ax2.xaxis.set_ticks_position('top') 18 | ax2.set_xlim((f1, f2)) 19 | ax2.xaxis.set_ticks(melbank.mel_to_hertz(melfreq)) 20 | ax2.xaxis.set_ticklabels(['{:.0f}'.format(mf) for mf in melfreq]) 21 | ax2.set_xlabel('Frequency / mel') 22 | plt.tight_layout() 23 | fig, ax = plt.subplots() 24 | ax.matshow(melmat) 25 | plt.axis('equal') 26 | plt.axis('tight') 27 | plt.title('Mel Matrix') 28 | plt.tight_layout() 29 | Functions 30 | --------- 31 | """ 32 | 33 | from numpy import abs, append, arange, insert, linspace, log10, round, zeros 34 | 35 | 36 | def hertz_to_mel(freq): 37 | """Returns mel-frequency from linear frequency input. 38 | Parameter 39 | --------- 40 | freq : scalar or ndarray 41 | Frequency value or array in Hz. 42 | Returns 43 | ------- 44 | mel : scalar or ndarray 45 | Mel-frequency value or ndarray in Mel 46 | """ 47 | return 2595.0 * log10(1 + (freq / 700.0)) 48 | 49 | 50 | def mel_to_hertz(mel): 51 | """Returns frequency from mel-frequency input. 52 | Parameter 53 | --------- 54 | mel : scalar or ndarray 55 | Mel-frequency value or ndarray in Mel 56 | Returns 57 | ------- 58 | freq : scalar or ndarray 59 | Frequency value or array in Hz. 60 | """ 61 | return 700.0 * (10**(mel / 2595.0)) - 700.0 62 | 63 | 64 | def melfrequencies_mel_filterbank(num_bands, freq_min, freq_max, num_fft_bands): 65 | """Returns centerfrequencies and band edges for a mel filter bank 66 | Parameters 67 | ---------- 68 | num_bands : int 69 | Number of mel bands. 70 | freq_min : scalar 71 | Minimum frequency for the first band. 72 | freq_max : scalar 73 | Maximum frequency for the last band. 74 | num_fft_bands : int 75 | Number of fft bands. 76 | Returns 77 | ------- 78 | center_frequencies_mel : ndarray 79 | lower_edges_mel : ndarray 80 | upper_edges_mel : ndarray 81 | """ 82 | 83 | mel_max = hertz_to_mel(freq_max) 84 | mel_min = hertz_to_mel(freq_min) 85 | delta_mel = abs(mel_max - mel_min) / (num_bands + 1.0) 86 | frequencies_mel = mel_min + delta_mel * arange(0, num_bands + 2) 87 | lower_edges_mel = frequencies_mel[:-2] 88 | upper_edges_mel = frequencies_mel[2:] 89 | center_frequencies_mel = frequencies_mel[1:-1] 90 | return center_frequencies_mel, lower_edges_mel, upper_edges_mel 91 | 92 | 93 | def compute_melmat(num_mel_bands=12, freq_min=64, freq_max=8000, 94 | num_fft_bands=513, sample_rate=16000): 95 | """Returns tranformation matrix for mel spectrum. 96 | Parameters 97 | ---------- 98 | num_mel_bands : int 99 | Number of mel bands. Number of rows in melmat. 100 | Default: 24 101 | freq_min : scalar 102 | Minimum frequency for the first band. 103 | Default: 64 104 | freq_max : scalar 105 | Maximum frequency for the last band. 106 | Default: 8000 107 | num_fft_bands : int 108 | Number of fft-frequenc bands. This ist NFFT/2+1 ! 109 | number of columns in melmat. 110 | Default: 513 (this means NFFT=1024) 111 | sample_rate : scalar 112 | Sample rate for the signals that will be used. 113 | Default: 44100 114 | Returns 115 | ------- 116 | melmat : ndarray 117 | Transformation matrix for the mel spectrum. 118 | Use this with fft spectra of num_fft_bands_bands length 119 | and multiply the spectrum with the melmat 120 | this will tranform your fft-spectrum 121 | to a mel-spectrum. 122 | frequencies : tuple (ndarray , ndarray ) 123 | Center frequencies of the mel bands, center frequencies of fft spectrum. 124 | """ 125 | center_frequencies_mel, lower_edges_mel, upper_edges_mel = \ 126 | melfrequencies_mel_filterbank( 127 | num_mel_bands, 128 | freq_min, 129 | freq_max, 130 | num_fft_bands 131 | ) 132 | 133 | center_frequencies_hz = mel_to_hertz(center_frequencies_mel) 134 | lower_edges_hz = mel_to_hertz(lower_edges_mel) 135 | upper_edges_hz = mel_to_hertz(upper_edges_mel) 136 | freqs = linspace(0.0, sample_rate / 2.0, num_fft_bands) 137 | melmat = zeros((num_mel_bands, num_fft_bands)) 138 | 139 | for imelband, (center, lower, upper) in enumerate(zip( 140 | center_frequencies_hz, lower_edges_hz, upper_edges_hz)): 141 | 142 | left_slope = (freqs >= lower) == (freqs <= center) 143 | melmat[imelband, left_slope] = ( 144 | (freqs[left_slope] - lower) / (center - lower) 145 | ) 146 | 147 | right_slope = (freqs >= center) == (freqs <= upper) 148 | melmat[imelband, right_slope] = ( 149 | (upper - freqs[right_slope]) / (upper - center) 150 | ) 151 | 152 | return melmat, (center_frequencies_mel, freqs) 153 | 154 | -------------------------------------------------------------------------------- /LEDStripController/pyhl.py: -------------------------------------------------------------------------------- 1 | from bleak import BleakScanner, BleakClient 2 | import asyncio 3 | import sys 4 | sys.coinit_flags = 0 # 0 means MTA 5 | import pyaudio 6 | import qasync 7 | import numpy as np 8 | import scipy.cluster 9 | from PIL import ImageGrab 10 | from PyQt5.QtGui import * 11 | from turtle import color 12 | from dataclasses import dataclass 13 | from functools import cached_property 14 | from PyQt5.QtCore import * 15 | from PyQt5.QtWidgets import * 16 | import ExternalAudio 17 | import BLEClass 18 | import Utils 19 | import matplotlib.image as img 20 | try: 21 | from ctypes import windll 22 | except ImportError: 23 | print("ctypes not imported due to different OS (Non Windows)") 24 | 25 | 26 | class MainWindow(QMainWindow): 27 | def closeEvent(self, event): 28 | if self.device_address.text() != "": 29 | device = BLEClass.BleakScanner.find_device_by_address(self.device_address.text()) 30 | else: 31 | device = self.devices_combobox.currentData() 32 | 33 | if isinstance(device, BLEClass.BLEDevice): 34 | self.build_client(device) 35 | self.connect_button.disconnect() 36 | self.connect_button.clicked.connect(self.destroy_client) 37 | self.connect_button.setText("Disconnect") 38 | 39 | 40 | def __init__(self): 41 | global isModeUsed, idx 42 | super().__init__() 43 | self.setFixedSize(400, 300) 44 | isModeUsed = False 45 | idx = -1 46 | self.setWindowTitle("HappyLigthing-py") 47 | self.setWindowIcon(QIcon('HappyLighting-py_icon.png')) 48 | 49 | 50 | self.modeList = QListWidget(self) 51 | self.modeList.setGeometry(210, 110, 180, 180) 52 | self.modeList.itemDoubleClicked.connect(self.selectMode) 53 | 54 | self.horizontalSlider = QSlider(self) 55 | self.horizontalSlider.setObjectName(u"horizontalSlider") 56 | self.horizontalSlider.setGeometry(QRect(250, 80, 131, 22)) 57 | self.horizontalSlider.setMinimum(1) 58 | self.horizontalSlider.setMaximum(10) 59 | self.horizontalSlider.setOrientation(Qt.Horizontal) 60 | self.horizontalSlider.valueChanged.connect(self.changeSpeed) 61 | 62 | self.deviceMic = QRadioButton(self) 63 | self.deviceMic.setText("Device Mic") 64 | self.deviceMic.setChecked(True) 65 | self.deviceMic.setGeometry(QRect(100, 170, 91, 20)) 66 | 67 | self.micDevices_combobox = QComboBox(self) 68 | self.micDevices_combobox.setGeometry(QRect(10, 210, 191, 22)) 69 | 70 | self.localMic = QRadioButton(self) 71 | self.localMic.setText("Local Mic") 72 | self.localMic.setChecked(False) 73 | self.localMic.setGeometry(QRect(10, 170, 91, 20)) 74 | 75 | self.startCapture = QCheckBox(self) 76 | self.startCapture.setText("Start Capture") 77 | self.startCapture.setCheckState(Qt.Unchecked) 78 | self.startCapture.setGeometry(QRect(290, 60, 101, 20)) 79 | 80 | self.scan_button = QPushButton(self) 81 | self.scan_button.setText("Scan") 82 | self.scan_button.setGeometry(QRect(10, 10, 75, 23)) 83 | 84 | 85 | self.powerOn_button = QPushButton(self) 86 | self.powerOn_button.setText("Power On") 87 | self.powerOn_button.setGeometry(QRect(10, 65, 75, 23)) 88 | self.powerOn_button.clicked.connect(self.changePowerToOn) 89 | 90 | self.powerOff_button = QPushButton(self) 91 | self.powerOff_button.setText("Power Off") 92 | self.powerOff_button.setGeometry(QRect(85, 65, 75, 23)) 93 | self.powerOff_button.clicked.connect(self.changePowerToOff) 94 | 95 | self.connect_button = QPushButton(self) 96 | self.connect_button.setText("Connect") 97 | self.connect_button.setGeometry(QRect(10, 40, 75, 23)) 98 | 99 | self.devices_combobox = QComboBox(self) 100 | self.devices_combobox.setGeometry(QRect(90, 10, 121, 22)) 101 | # Label Create 102 | self.label = QLabel(self) 103 | self.label.setGeometry(QRect(220, 11, 20, 20)) 104 | #self.label.setMinimumSize(QSize(100, 100)) 105 | #self.label.setMaximumSize(QSize(300, 300)) 106 | self.label.setObjectName("lb1") 107 | self.label.setScaledContents(True) 108 | 109 | import os 110 | self.movie = None 111 | # Loading the GIF 112 | """ Get absolute path to resource, works for dev and for PyInstaller """ 113 | base_path = "" 114 | try: 115 | # PyInstaller creates a temp folder and stores path in _MEIPASS 116 | base_path = sys._MEIPASS 117 | except Exception: 118 | base_path = os.path.abspath(".") 119 | 120 | self.movie = QMovie(os.path.join(base_path, "Flower.gif")) 121 | 122 | #self.movie = QMovie(resource_path("Flower.gif")) 123 | self.label.setMovie(self.movie) 124 | self.label.hide() 125 | 126 | self.device_address = QLineEdit(self) 127 | self.device_address.setGeometry(QRect(160, 40, 121, 22)) 128 | 129 | self.label1 = QLabel(self) 130 | self.label1.setGeometry(QRect(90, 40, 71, 20)) 131 | self.label1.setText("Disconnected") 132 | self.label1.setStyleSheet("QLabel {color: red; }"); 133 | 134 | self.label2 = QLabel(self) 135 | self.label2.setGeometry(QRect(10, 190, 71, 20)) 136 | self.label2.setText("Input Devices") 137 | #self.label2.setStyleSheet("QLabel {color: red; }"); 138 | 139 | self.send_button = QPushButton(self) 140 | self.send_button.setText("Color") 141 | self.send_button.setGeometry(QRect(310, 10, 80, 23)) 142 | 143 | self.bass_button = QCheckBox(self) 144 | self.bass_button.setChecked(True) 145 | self.bass_button.setText("Bass") 146 | self.bass_button.setGeometry(QRect(10, 230, 51, 23)) 147 | 148 | self.middle_button = QCheckBox(self) 149 | self.middle_button.setChecked(True) 150 | self.middle_button.setText("Middle") 151 | self.middle_button.setGeometry(QRect(80, 230, 51, 23)) 152 | 153 | self.high_button = QCheckBox(self) 154 | self.high_button.setChecked(True) 155 | self.high_button.setText("High") 156 | self.high_button.setGeometry(QRect(150, 230, 51, 23)) 157 | 158 | 159 | self.scan_button.clicked.connect(self.handle_scan) 160 | self.connect_button.clicked.connect(self.handle_connect) 161 | self.send_button.clicked.connect(self.handle_send) 162 | self.modeList.itemDoubleClicked.connect(self.selectMode) 163 | self.deviceMic.toggled.connect(self.handle_musicmode) 164 | self.localMic.toggled.connect(self.handle_musicmode) 165 | self.startCapture.stateChanged.connect(self.handle_startcapture) 166 | self.micDevices_combobox.currentIndexChanged.connect(self.updateMicDevice) 167 | self.bass_button.clicked.connect(lambda: self.handle_enabledisable("B")) 168 | self.middle_button.clicked.connect(lambda: self.handle_enabledisable("M")) 169 | self.high_button.clicked.connect(lambda: self.handle_enabledisable("H")) 170 | 171 | 172 | self.modeList.addItem("Pulsating rainbow") 173 | self.modeList.addItem("Pulsating red") 174 | self.modeList.addItem("Pulsating green") 175 | self.modeList.addItem("Pulsating blue") 176 | self.modeList.addItem("Pulsating yellow") 177 | self.modeList.addItem("Pulsating cyan") 178 | self.modeList.addItem("Pulsating purple") 179 | self.modeList.addItem("Pulsating white") 180 | self.modeList.addItem("Pulsating red/green") 181 | self.modeList.addItem("Pulsating red/blue") 182 | self.modeList.addItem("Pulsating green/blue") 183 | self.modeList.addItem("Rainbow strobe") 184 | self.modeList.addItem("Red strobe") 185 | self.modeList.addItem("Green strobe") 186 | self.modeList.addItem("Blue strobe") 187 | self.modeList.addItem("Yellow strobe") 188 | self.modeList.addItem("Cyan strobe") 189 | self.modeList.addItem("Purple strobe") 190 | self.modeList.addItem("white strobe") 191 | self.modeList.addItem("Rainbow jumping change") 192 | self.modeList.addItem("Pulsating RGB") 193 | self.modeList.addItem("RGB jumping change") 194 | self.modeList.addItem("Music Mode") 195 | 196 | self.setElemetsActiveStatus(False) 197 | 198 | def setElemetsActiveStatus(self, status): 199 | self.micDevices_combobox.setEnabled(status) 200 | self.bass_button.setEnabled(status) 201 | self.middle_button.setEnabled(status) 202 | self.high_button.setEnabled(status) 203 | self.localMic.setEnabled(status) 204 | self.deviceMic.setEnabled(status) 205 | self.modeList.setEnabled(status) 206 | self.send_button.setEnabled(status) 207 | self.horizontalSlider.setEnabled(status) 208 | 209 | 210 | def selectMode(self, item): 211 | global isModeUsed, idx 212 | isModeUsed = True 213 | idx = self.modeList.indexFromItem(item).row() 214 | if idx <= 21: 215 | self.handle_mode(idx) 216 | elif idx >= 22: 217 | if idx == 22: 218 | self.handle_musicmode() 219 | 220 | 221 | @cached_property 222 | def devices(self): 223 | return list() 224 | 225 | @property 226 | def current_client(self): 227 | return Utils.client 228 | 229 | @qasync.asyncSlot() 230 | async def build_client(self, device): 231 | if Utils.client is not None: 232 | await Utils.client.stop() 233 | Utils.client = BLEClass.QBleakClient(device) 234 | Utils.client.messageChanged.connect(self.handle_message_changed) 235 | await Utils.client.start() 236 | 237 | 238 | @qasync.asyncSlot() 239 | async def destroy_client(self): 240 | if Utils.client is not None: 241 | await Utils.client.stop() 242 | self.connect_button.disconnect() 243 | self.connect_button.clicked.connect(self.handle_connect) 244 | self.setElemetsActiveStatus(False) 245 | self.scan_button.setEnabled(True) 246 | self.label1.setText("Disconnected") 247 | self.connect_button.setText("Connect") 248 | self.label1.setStyleSheet("QLabel {color: red; }"); 249 | 250 | 251 | @qasync.asyncSlot() 252 | async def handle_connect(self): 253 | #self.log_edit.appendPlainText("try connect") 254 | s_Address = self.device_address.text() 255 | if self.device_address.text() != "": 256 | device = await BLEClass.BleakScanner.find_device_by_address(self.device_address.text()) 257 | else: 258 | device = self.devices_combobox.currentData() 259 | 260 | if isinstance(device, BLEClass.BLEDevice): 261 | await self.build_client(device) 262 | self.label1.setText("Connected") 263 | self.scan_button.setEnabled(False) 264 | #self.connect_button.setEnabled(False) 265 | info = Utils.p.get_host_api_info_by_index(0) 266 | numdevices = info.get('deviceCount') 267 | for i in range(0, numdevices): 268 | if (Utils.p.get_device_info_by_host_api_device_index(0, i).get('maxInputChannels')) > 0: 269 | tmp_device = Utils.p.get_device_info_by_host_api_device_index(0, i) 270 | Utils.InputDevices[i] = tmp_device 271 | dev_name = tmp_device["name"] 272 | self.micDevices_combobox.addItem(dev_name) 273 | self.label1.setStyleSheet("QLabel {color: green; }"); 274 | self.setElemetsActiveStatus(True) 275 | self.connect_button.disconnect() 276 | self.connect_button.clicked.connect(self.destroy_client) 277 | self.connect_button.setText("Disconnect") 278 | 279 | @qasync.asyncSlot() 280 | async def handle_scan(self): 281 | #self.log_edit.appendPlainText("Started scanner") 282 | self.devices.clear() 283 | self.label.show() 284 | self.movie.start() 285 | devices = await BLEClass.BleakScanner.discover(timeout=8.0) 286 | self.devices.extend(devices) 287 | self.devices_combobox.clear() 288 | for i, device in enumerate(self.devices): 289 | if str(device.name).startswith("QHM"): 290 | Utils.printLog(("Found Device {}".format(device.name))) 291 | self.devices_combobox.insertItem(i, device.name, device) 292 | #self.log_edit.appendPlainText("Finish scanner") 293 | self.movie.stop() 294 | self.label.hide() 295 | 296 | def changeSpeed(self, value): 297 | global isModeUsed 298 | Utils.Speed = value 299 | if isModeUsed: 300 | self.handle_mode(self.modeList.currentIndex().row()) 301 | 302 | def changePowerToOn(self): 303 | self.handle_powerOn() 304 | 305 | def changePowerToOff(self): 306 | self.handle_powerOff() 307 | 308 | @qasync.asyncSlot() 309 | async def handle_powerOff(self): 310 | await self.current_client.writePower("Off") 311 | 312 | @qasync.asyncSlot() 313 | async def handle_powerOn(self): 314 | await self.current_client.writePower("On") 315 | 316 | @qasync.asyncSlot() 317 | async def handle_enabledisable(self, what): 318 | 319 | if what == "B": 320 | Utils.BlueMic = not Utils.BlueMic 321 | if what == "M": 322 | Utils.RedMic = not Utils.RedMic 323 | if what == "H": 324 | Utils.GreenMic = not Utils.GreenMic 325 | 326 | self.handle_rewrite() 327 | 328 | @qasync.asyncSlot() 329 | async def handle_rewrite(self): 330 | await self.current_client.writeColor() 331 | 332 | 333 | def handle_message_changed(self, message): 334 | pass 335 | #self.log_edit.appendPlainText(f"msg: {message.decode()}") 336 | 337 | @qasync.asyncSlot() 338 | async def handle_send(self): 339 | 340 | Utils.isModeUsed = False 341 | self.res = QColorDialog.getColor() 342 | try: 343 | await self.current_client.writeColor(self.res.red(), self.res.green(), self.res.blue()) 344 | except Exception as ex: 345 | Utils.printLog("Colors error {}".format(ex)) 346 | 347 | 348 | @qasync.asyncSlot() 349 | async def handle_mode(self, idx): 350 | await self.current_client.writeMode(idx) 351 | 352 | def updateMicDevice(self, index): 353 | Utils.selectedInputDevice = index 354 | 355 | 356 | @qasync.asyncSlot() 357 | async def handle_musicmode(self): 358 | global isModeUsed, idx 359 | 360 | if isModeUsed and idx == 22: 361 | if self.deviceMic.isChecked(): 362 | Utils.localAudio = False 363 | await self.current_client.writeMicState(True) 364 | elif self.localMic.isChecked(): 365 | await self.current_client.writeMicState(False) 366 | Utils.localAudio = True 367 | await ExternalAudio.start_stream() 368 | 369 | 370 | async def captureImage(self): 371 | #NUM_CLUSTERS = 5 372 | while Utils.captureMode: 373 | def bincount_app(a): 374 | try: 375 | a2D = a.reshape(-1,a.shape[-1]) 376 | col_range = (256, 256, 256) # generically : a2D.max(0)+1 377 | a1D = np.ravel_multi_index(a2D.T, col_range) 378 | return np.unravel_index(np.bincount(a1D).argmax(), col_range) 379 | except Exception as err: 380 | Utils.printLog(err) 381 | 382 | #print('reading image') 383 | im = ImageGrab.grab() 384 | #im = Image.open('image.jpg') 385 | im = im.resize((150, 150)) # optional, to reduce time 386 | im = np.array(im) 387 | 388 | colour = bincount_app(im) 389 | Utils.printLog(colour) 390 | await self.current_client.writeColor(colour[0], colour[1], colour[2]) 391 | 392 | @qasync.asyncSlot() 393 | async def handle_startcapture(self): 394 | if self.startCapture.checkState() == Qt.Checked: 395 | Utils.captureMode = True 396 | loop = asyncio.get_running_loop() 397 | loop.run_in_executor(None, lambda: asyncio.run(self.captureImage())) 398 | else: 399 | Utils.captureMode = False 400 | 401 | 402 | 403 | def main(): 404 | try: 405 | user32 = windll.user32 406 | user32.SetProcessDPIAware() 407 | except: 408 | pass 409 | Utils.app = QApplication(sys.argv) 410 | #Utils.app.aboutToQuit.connect(myExitHandler) 411 | loop = qasync.QEventLoop(Utils.app) 412 | asyncio.set_event_loop(loop) 413 | w = MainWindow() 414 | w.show() 415 | with loop: 416 | loop.run_forever() 417 | 418 | def test(): 419 | pass 420 | 421 | if __name__ == "__main__": 422 | main() -------------------------------------------------------------------------------- /LEDStripController/pyhl.spec: -------------------------------------------------------------------------------- 1 | # -*- mode: python ; coding: utf-8 -*- 2 | 3 | block_cipher = None 4 | 5 | a = Analysis(['pyhl.py'], 6 | pathex=['LEDStripController'], 7 | binaries=[], 8 | datas=[('Flower.gif', '.'), ('gamma_table.npy', '.')], 9 | hiddenimports=[]) 10 | 11 | pyz = PYZ(a.pure, a.zipped_data, 12 | cipher=block_cipher) 13 | 14 | exe = EXE(pyz, 15 | a.scripts, 16 | a.binaries, 17 | a.zipfiles, 18 | a.datas, 19 | [], 20 | name='PyHL - GUI', 21 | debug=False, 22 | bootloader_ignore_signals=False, 23 | bootloader_silent=False, 24 | runtime_tmpdir=None, 25 | console=True) 26 | -------------------------------------------------------------------------------- /LEDStripController/requirements.txt: -------------------------------------------------------------------------------- 1 | bleak==0.21.1 2 | matplotlib==3.8.1 3 | numpy==1.26.1 4 | Pillow==10.1.0 5 | pyaudio==0.2.13 6 | PyQt5==5.15.10 7 | PyQt5_sip==12.13.0 8 | qasync==0.26.0 9 | scipy==1.11.3 10 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU AFFERO GENERAL PUBLIC LICENSE 2 | Version 3, 19 November 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU Affero General Public License is a free, copyleft license for 11 | software and other kinds of works, specifically designed to ensure 12 | cooperation with the community in the case of network server software. 13 | 14 | The licenses for most software and other practical works are designed 15 | to take away your freedom to share and change the works. By contrast, 16 | our General Public Licenses are intended to guarantee your freedom to 17 | share and change all versions of a program--to make sure it remains free 18 | software for all its users. 19 | 20 | When we speak of free software, we are referring to freedom, not 21 | price. Our General Public Licenses are designed to make sure that you 22 | have the freedom to distribute copies of free software (and charge for 23 | them if you wish), that you receive source code or can get it if you 24 | want it, that you can change the software or use pieces of it in new 25 | free programs, and that you know you can do these things. 26 | 27 | Developers that use our General Public Licenses protect your rights 28 | with two steps: (1) assert copyright on the software, and (2) offer 29 | you this License which gives you legal permission to copy, distribute 30 | and/or modify the software. 31 | 32 | A secondary benefit of defending all users' freedom is that 33 | improvements made in alternate versions of the program, if they 34 | receive widespread use, become available for other developers to 35 | incorporate. Many developers of free software are heartened and 36 | encouraged by the resulting cooperation. However, in the case of 37 | software used on network servers, this result may fail to come about. 38 | The GNU General Public License permits making a modified version and 39 | letting the public access it on a server without ever releasing its 40 | source code to the public. 41 | 42 | The GNU Affero General Public License is designed specifically to 43 | ensure that, in such cases, the modified source code becomes available 44 | to the community. It requires the operator of a network server to 45 | provide the source code of the modified version running there to the 46 | users of that server. Therefore, public use of a modified version, on 47 | a publicly accessible server, gives the public access to the source 48 | code of the modified version. 49 | 50 | An older license, called the Affero General Public License and 51 | published by Affero, was designed to accomplish similar goals. This is 52 | a different license, not a version of the Affero GPL, but Affero has 53 | released a new version of the Affero GPL which permits relicensing under 54 | this license. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | TERMS AND CONDITIONS 60 | 61 | 0. Definitions. 62 | 63 | "This License" refers to version 3 of the GNU Affero General Public License. 64 | 65 | "Copyright" also means copyright-like laws that apply to other kinds of 66 | works, such as semiconductor masks. 67 | 68 | "The Program" refers to any copyrightable work licensed under this 69 | License. Each licensee is addressed as "you". "Licensees" and 70 | "recipients" may be individuals or organizations. 71 | 72 | To "modify" a work means to copy from or adapt all or part of the work 73 | in a fashion requiring copyright permission, other than the making of an 74 | exact copy. The resulting work is called a "modified version" of the 75 | earlier work or a work "based on" the earlier work. 76 | 77 | A "covered work" means either the unmodified Program or a work based 78 | on the Program. 79 | 80 | To "propagate" a work means to do anything with it that, without 81 | permission, would make you directly or secondarily liable for 82 | infringement under applicable copyright law, except executing it on a 83 | computer or modifying a private copy. Propagation includes copying, 84 | distribution (with or without modification), making available to the 85 | public, and in some countries other activities as well. 86 | 87 | To "convey" a work means any kind of propagation that enables other 88 | parties to make or receive copies. Mere interaction with a user through 89 | a computer network, with no transfer of a copy, is not conveying. 90 | 91 | An interactive user interface displays "Appropriate Legal Notices" 92 | to the extent that it includes a convenient and prominently visible 93 | feature that (1) displays an appropriate copyright notice, and (2) 94 | tells the user that there is no warranty for the work (except to the 95 | extent that warranties are provided), that licensees may convey the 96 | work under this License, and how to view a copy of this License. If 97 | the interface presents a list of user commands or options, such as a 98 | menu, a prominent item in the list meets this criterion. 99 | 100 | 1. Source Code. 101 | 102 | The "source code" for a work means the preferred form of the work 103 | for making modifications to it. "Object code" means any non-source 104 | form of a work. 105 | 106 | A "Standard Interface" means an interface that either is an official 107 | standard defined by a recognized standards body, or, in the case of 108 | interfaces specified for a particular programming language, one that 109 | is widely used among developers working in that language. 110 | 111 | The "System Libraries" of an executable work include anything, other 112 | than the work as a whole, that (a) is included in the normal form of 113 | packaging a Major Component, but which is not part of that Major 114 | Component, and (b) serves only to enable use of the work with that 115 | Major Component, or to implement a Standard Interface for which an 116 | implementation is available to the public in source code form. A 117 | "Major Component", in this context, means a major essential component 118 | (kernel, window system, and so on) of the specific operating system 119 | (if any) on which the executable work runs, or a compiler used to 120 | produce the work, or an object code interpreter used to run it. 121 | 122 | The "Corresponding Source" for a work in object code form means all 123 | the source code needed to generate, install, and (for an executable 124 | work) run the object code and to modify the work, including scripts to 125 | control those activities. However, it does not include the work's 126 | System Libraries, or general-purpose tools or generally available free 127 | programs which are used unmodified in performing those activities but 128 | which are not part of the work. For example, Corresponding Source 129 | includes interface definition files associated with source files for 130 | the work, and the source code for shared libraries and dynamically 131 | linked subprograms that the work is specifically designed to require, 132 | such as by intimate data communication or control flow between those 133 | subprograms and other parts of the work. 134 | 135 | The Corresponding Source need not include anything that users 136 | can regenerate automatically from other parts of the Corresponding 137 | Source. 138 | 139 | The Corresponding Source for a work in source code form is that 140 | same work. 141 | 142 | 2. Basic Permissions. 143 | 144 | All rights granted under this License are granted for the term of 145 | copyright on the Program, and are irrevocable provided the stated 146 | conditions are met. This License explicitly affirms your unlimited 147 | permission to run the unmodified Program. The output from running a 148 | covered work is covered by this License only if the output, given its 149 | content, constitutes a covered work. This License acknowledges your 150 | rights of fair use or other equivalent, as provided by copyright law. 151 | 152 | You may make, run and propagate covered works that you do not 153 | convey, without conditions so long as your license otherwise remains 154 | in force. You may convey covered works to others for the sole purpose 155 | of having them make modifications exclusively for you, or provide you 156 | with facilities for running those works, provided that you comply with 157 | the terms of this License in conveying all material for which you do 158 | not control copyright. Those thus making or running the covered works 159 | for you must do so exclusively on your behalf, under your direction 160 | and control, on terms that prohibit them from making any copies of 161 | your copyrighted material outside their relationship with you. 162 | 163 | Conveying under any other circumstances is permitted solely under 164 | the conditions stated below. Sublicensing is not allowed; section 10 165 | makes it unnecessary. 166 | 167 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 168 | 169 | No covered work shall be deemed part of an effective technological 170 | measure under any applicable law fulfilling obligations under article 171 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 172 | similar laws prohibiting or restricting circumvention of such 173 | measures. 174 | 175 | When you convey a covered work, you waive any legal power to forbid 176 | circumvention of technological measures to the extent such circumvention 177 | is effected by exercising rights under this License with respect to 178 | the covered work, and you disclaim any intention to limit operation or 179 | modification of the work as a means of enforcing, against the work's 180 | users, your or third parties' legal rights to forbid circumvention of 181 | technological measures. 182 | 183 | 4. Conveying Verbatim Copies. 184 | 185 | You may convey verbatim copies of the Program's source code as you 186 | receive it, in any medium, provided that you conspicuously and 187 | appropriately publish on each copy an appropriate copyright notice; 188 | keep intact all notices stating that this License and any 189 | non-permissive terms added in accord with section 7 apply to the code; 190 | keep intact all notices of the absence of any warranty; and give all 191 | recipients a copy of this License along with the Program. 192 | 193 | You may charge any price or no price for each copy that you convey, 194 | and you may offer support or warranty protection for a fee. 195 | 196 | 5. Conveying Modified Source Versions. 197 | 198 | You may convey a work based on the Program, or the modifications to 199 | produce it from the Program, in the form of source code under the 200 | terms of section 4, provided that you also meet all of these conditions: 201 | 202 | a) The work must carry prominent notices stating that you modified 203 | it, and giving a relevant date. 204 | 205 | b) The work must carry prominent notices stating that it is 206 | released under this License and any conditions added under section 207 | 7. This requirement modifies the requirement in section 4 to 208 | "keep intact all notices". 209 | 210 | c) You must license the entire work, as a whole, under this 211 | License to anyone who comes into possession of a copy. This 212 | License will therefore apply, along with any applicable section 7 213 | additional terms, to the whole of the work, and all its parts, 214 | regardless of how they are packaged. This License gives no 215 | permission to license the work in any other way, but it does not 216 | invalidate such permission if you have separately received it. 217 | 218 | d) If the work has interactive user interfaces, each must display 219 | Appropriate Legal Notices; however, if the Program has interactive 220 | interfaces that do not display Appropriate Legal Notices, your 221 | work need not make them do so. 222 | 223 | A compilation of a covered work with other separate and independent 224 | works, which are not by their nature extensions of the covered work, 225 | and which are not combined with it such as to form a larger program, 226 | in or on a volume of a storage or distribution medium, is called an 227 | "aggregate" if the compilation and its resulting copyright are not 228 | used to limit the access or legal rights of the compilation's users 229 | beyond what the individual works permit. Inclusion of a covered work 230 | in an aggregate does not cause this License to apply to the other 231 | parts of the aggregate. 232 | 233 | 6. Conveying Non-Source Forms. 234 | 235 | You may convey a covered work in object code form under the terms 236 | of sections 4 and 5, provided that you also convey the 237 | machine-readable Corresponding Source under the terms of this License, 238 | in one of these ways: 239 | 240 | a) Convey the object code in, or embodied in, a physical product 241 | (including a physical distribution medium), accompanied by the 242 | Corresponding Source fixed on a durable physical medium 243 | customarily used for software interchange. 244 | 245 | b) Convey the object code in, or embodied in, a physical product 246 | (including a physical distribution medium), accompanied by a 247 | written offer, valid for at least three years and valid for as 248 | long as you offer spare parts or customer support for that product 249 | model, to give anyone who possesses the object code either (1) a 250 | copy of the Corresponding Source for all the software in the 251 | product that is covered by this License, on a durable physical 252 | medium customarily used for software interchange, for a price no 253 | more than your reasonable cost of physically performing this 254 | conveying of source, or (2) access to copy the 255 | Corresponding Source from a network server at no charge. 256 | 257 | c) Convey individual copies of the object code with a copy of the 258 | written offer to provide the Corresponding Source. This 259 | alternative is allowed only occasionally and noncommercially, and 260 | only if you received the object code with such an offer, in accord 261 | with subsection 6b. 262 | 263 | d) Convey the object code by offering access from a designated 264 | place (gratis or for a charge), and offer equivalent access to the 265 | Corresponding Source in the same way through the same place at no 266 | further charge. You need not require recipients to copy the 267 | Corresponding Source along with the object code. If the place to 268 | copy the object code is a network server, the Corresponding Source 269 | may be on a different server (operated by you or a third party) 270 | that supports equivalent copying facilities, provided you maintain 271 | clear directions next to the object code saying where to find the 272 | Corresponding Source. Regardless of what server hosts the 273 | Corresponding Source, you remain obligated to ensure that it is 274 | available for as long as needed to satisfy these requirements. 275 | 276 | e) Convey the object code using peer-to-peer transmission, provided 277 | you inform other peers where the object code and Corresponding 278 | Source of the work are being offered to the general public at no 279 | charge under subsection 6d. 280 | 281 | A separable portion of the object code, whose source code is excluded 282 | from the Corresponding Source as a System Library, need not be 283 | included in conveying the object code work. 284 | 285 | A "User Product" is either (1) a "consumer product", which means any 286 | tangible personal property which is normally used for personal, family, 287 | or household purposes, or (2) anything designed or sold for incorporation 288 | into a dwelling. In determining whether a product is a consumer product, 289 | doubtful cases shall be resolved in favor of coverage. For a particular 290 | product received by a particular user, "normally used" refers to a 291 | typical or common use of that class of product, regardless of the status 292 | of the particular user or of the way in which the particular user 293 | actually uses, or expects or is expected to use, the product. A product 294 | is a consumer product regardless of whether the product has substantial 295 | commercial, industrial or non-consumer uses, unless such uses represent 296 | the only significant mode of use of the product. 297 | 298 | "Installation Information" for a User Product means any methods, 299 | procedures, authorization keys, or other information required to install 300 | and execute modified versions of a covered work in that User Product from 301 | a modified version of its Corresponding Source. The information must 302 | suffice to ensure that the continued functioning of the modified object 303 | code is in no case prevented or interfered with solely because 304 | modification has been made. 305 | 306 | If you convey an object code work under this section in, or with, or 307 | specifically for use in, a User Product, and the conveying occurs as 308 | part of a transaction in which the right of possession and use of the 309 | User Product is transferred to the recipient in perpetuity or for a 310 | fixed term (regardless of how the transaction is characterized), the 311 | Corresponding Source conveyed under this section must be accompanied 312 | by the Installation Information. But this requirement does not apply 313 | if neither you nor any third party retains the ability to install 314 | modified object code on the User Product (for example, the work has 315 | been installed in ROM). 316 | 317 | The requirement to provide Installation Information does not include a 318 | requirement to continue to provide support service, warranty, or updates 319 | for a work that has been modified or installed by the recipient, or for 320 | the User Product in which it has been modified or installed. Access to a 321 | network may be denied when the modification itself materially and 322 | adversely affects the operation of the network or violates the rules and 323 | protocols for communication across the network. 324 | 325 | Corresponding Source conveyed, and Installation Information provided, 326 | in accord with this section must be in a format that is publicly 327 | documented (and with an implementation available to the public in 328 | source code form), and must require no special password or key for 329 | unpacking, reading or copying. 330 | 331 | 7. Additional Terms. 332 | 333 | "Additional permissions" are terms that supplement the terms of this 334 | License by making exceptions from one or more of its conditions. 335 | Additional permissions that are applicable to the entire Program shall 336 | be treated as though they were included in this License, to the extent 337 | that they are valid under applicable law. If additional permissions 338 | apply only to part of the Program, that part may be used separately 339 | under those permissions, but the entire Program remains governed by 340 | this License without regard to the additional permissions. 341 | 342 | When you convey a copy of a covered work, you may at your option 343 | remove any additional permissions from that copy, or from any part of 344 | it. (Additional permissions may be written to require their own 345 | removal in certain cases when you modify the work.) You may place 346 | additional permissions on material, added by you to a covered work, 347 | for which you have or can give appropriate copyright permission. 348 | 349 | Notwithstanding any other provision of this License, for material you 350 | add to a covered work, you may (if authorized by the copyright holders of 351 | that material) supplement the terms of this License with terms: 352 | 353 | a) Disclaiming warranty or limiting liability differently from the 354 | terms of sections 15 and 16 of this License; or 355 | 356 | b) Requiring preservation of specified reasonable legal notices or 357 | author attributions in that material or in the Appropriate Legal 358 | Notices displayed by works containing it; or 359 | 360 | c) Prohibiting misrepresentation of the origin of that material, or 361 | requiring that modified versions of such material be marked in 362 | reasonable ways as different from the original version; or 363 | 364 | d) Limiting the use for publicity purposes of names of licensors or 365 | authors of the material; or 366 | 367 | e) Declining to grant rights under trademark law for use of some 368 | trade names, trademarks, or service marks; or 369 | 370 | f) Requiring indemnification of licensors and authors of that 371 | material by anyone who conveys the material (or modified versions of 372 | it) with contractual assumptions of liability to the recipient, for 373 | any liability that these contractual assumptions directly impose on 374 | those licensors and authors. 375 | 376 | All other non-permissive additional terms are considered "further 377 | restrictions" within the meaning of section 10. If the Program as you 378 | received it, or any part of it, contains a notice stating that it is 379 | governed by this License along with a term that is a further 380 | restriction, you may remove that term. If a license document contains 381 | a further restriction but permits relicensing or conveying under this 382 | License, you may add to a covered work material governed by the terms 383 | of that license document, provided that the further restriction does 384 | not survive such relicensing or conveying. 385 | 386 | If you add terms to a covered work in accord with this section, you 387 | must place, in the relevant source files, a statement of the 388 | additional terms that apply to those files, or a notice indicating 389 | where to find the applicable terms. 390 | 391 | Additional terms, permissive or non-permissive, may be stated in the 392 | form of a separately written license, or stated as exceptions; 393 | the above requirements apply either way. 394 | 395 | 8. Termination. 396 | 397 | You may not propagate or modify a covered work except as expressly 398 | provided under this License. Any attempt otherwise to propagate or 399 | modify it is void, and will automatically terminate your rights under 400 | this License (including any patent licenses granted under the third 401 | paragraph of section 11). 402 | 403 | However, if you cease all violation of this License, then your 404 | license from a particular copyright holder is reinstated (a) 405 | provisionally, unless and until the copyright holder explicitly and 406 | finally terminates your license, and (b) permanently, if the copyright 407 | holder fails to notify you of the violation by some reasonable means 408 | prior to 60 days after the cessation. 409 | 410 | Moreover, your license from a particular copyright holder is 411 | reinstated permanently if the copyright holder notifies you of the 412 | violation by some reasonable means, this is the first time you have 413 | received notice of violation of this License (for any work) from that 414 | copyright holder, and you cure the violation prior to 30 days after 415 | your receipt of the notice. 416 | 417 | Termination of your rights under this section does not terminate the 418 | licenses of parties who have received copies or rights from you under 419 | this License. If your rights have been terminated and not permanently 420 | reinstated, you do not qualify to receive new licenses for the same 421 | material under section 10. 422 | 423 | 9. Acceptance Not Required for Having Copies. 424 | 425 | You are not required to accept this License in order to receive or 426 | run a copy of the Program. Ancillary propagation of a covered work 427 | occurring solely as a consequence of using peer-to-peer transmission 428 | to receive a copy likewise does not require acceptance. However, 429 | nothing other than this License grants you permission to propagate or 430 | modify any covered work. These actions infringe copyright if you do 431 | not accept this License. Therefore, by modifying or propagating a 432 | covered work, you indicate your acceptance of this License to do so. 433 | 434 | 10. Automatic Licensing of Downstream Recipients. 435 | 436 | Each time you convey a covered work, the recipient automatically 437 | receives a license from the original licensors, to run, modify and 438 | propagate that work, subject to this License. You are not responsible 439 | for enforcing compliance by third parties with this License. 440 | 441 | An "entity transaction" is a transaction transferring control of an 442 | organization, or substantially all assets of one, or subdividing an 443 | organization, or merging organizations. If propagation of a covered 444 | work results from an entity transaction, each party to that 445 | transaction who receives a copy of the work also receives whatever 446 | licenses to the work the party's predecessor in interest had or could 447 | give under the previous paragraph, plus a right to possession of the 448 | Corresponding Source of the work from the predecessor in interest, if 449 | the predecessor has it or can get it with reasonable efforts. 450 | 451 | You may not impose any further restrictions on the exercise of the 452 | rights granted or affirmed under this License. For example, you may 453 | not impose a license fee, royalty, or other charge for exercise of 454 | rights granted under this License, and you may not initiate litigation 455 | (including a cross-claim or counterclaim in a lawsuit) alleging that 456 | any patent claim is infringed by making, using, selling, offering for 457 | sale, or importing the Program or any portion of it. 458 | 459 | 11. Patents. 460 | 461 | A "contributor" is a copyright holder who authorizes use under this 462 | License of the Program or a work on which the Program is based. The 463 | work thus licensed is called the contributor's "contributor version". 464 | 465 | A contributor's "essential patent claims" are all patent claims 466 | owned or controlled by the contributor, whether already acquired or 467 | hereafter acquired, that would be infringed by some manner, permitted 468 | by this License, of making, using, or selling its contributor version, 469 | but do not include claims that would be infringed only as a 470 | consequence of further modification of the contributor version. For 471 | purposes of this definition, "control" includes the right to grant 472 | patent sublicenses in a manner consistent with the requirements of 473 | this License. 474 | 475 | Each contributor grants you a non-exclusive, worldwide, royalty-free 476 | patent license under the contributor's essential patent claims, to 477 | make, use, sell, offer for sale, import and otherwise run, modify and 478 | propagate the contents of its contributor version. 479 | 480 | In the following three paragraphs, a "patent license" is any express 481 | agreement or commitment, however denominated, not to enforce a patent 482 | (such as an express permission to practice a patent or covenant not to 483 | sue for patent infringement). To "grant" such a patent license to a 484 | party means to make such an agreement or commitment not to enforce a 485 | patent against the party. 486 | 487 | If you convey a covered work, knowingly relying on a patent license, 488 | and the Corresponding Source of the work is not available for anyone 489 | to copy, free of charge and under the terms of this License, through a 490 | publicly available network server or other readily accessible means, 491 | then you must either (1) cause the Corresponding Source to be so 492 | available, or (2) arrange to deprive yourself of the benefit of the 493 | patent license for this particular work, or (3) arrange, in a manner 494 | consistent with the requirements of this License, to extend the patent 495 | license to downstream recipients. "Knowingly relying" means you have 496 | actual knowledge that, but for the patent license, your conveying the 497 | covered work in a country, or your recipient's use of the covered work 498 | in a country, would infringe one or more identifiable patents in that 499 | country that you have reason to believe are valid. 500 | 501 | If, pursuant to or in connection with a single transaction or 502 | arrangement, you convey, or propagate by procuring conveyance of, a 503 | covered work, and grant a patent license to some of the parties 504 | receiving the covered work authorizing them to use, propagate, modify 505 | or convey a specific copy of the covered work, then the patent license 506 | you grant is automatically extended to all recipients of the covered 507 | work and works based on it. 508 | 509 | A patent license is "discriminatory" if it does not include within 510 | the scope of its coverage, prohibits the exercise of, or is 511 | conditioned on the non-exercise of one or more of the rights that are 512 | specifically granted under this License. You may not convey a covered 513 | work if you are a party to an arrangement with a third party that is 514 | in the business of distributing software, under which you make payment 515 | to the third party based on the extent of your activity of conveying 516 | the work, and under which the third party grants, to any of the 517 | parties who would receive the covered work from you, a discriminatory 518 | patent license (a) in connection with copies of the covered work 519 | conveyed by you (or copies made from those copies), or (b) primarily 520 | for and in connection with specific products or compilations that 521 | contain the covered work, unless you entered into that arrangement, 522 | or that patent license was granted, prior to 28 March 2007. 523 | 524 | Nothing in this License shall be construed as excluding or limiting 525 | any implied license or other defenses to infringement that may 526 | otherwise be available to you under applicable patent law. 527 | 528 | 12. No Surrender of Others' Freedom. 529 | 530 | If conditions are imposed on you (whether by court order, agreement or 531 | otherwise) that contradict the conditions of this License, they do not 532 | excuse you from the conditions of this License. If you cannot convey a 533 | covered work so as to satisfy simultaneously your obligations under this 534 | License and any other pertinent obligations, then as a consequence you may 535 | not convey it at all. For example, if you agree to terms that obligate you 536 | to collect a royalty for further conveying from those to whom you convey 537 | the Program, the only way you could satisfy both those terms and this 538 | License would be to refrain entirely from conveying the Program. 539 | 540 | 13. Remote Network Interaction; Use with the GNU General Public License. 541 | 542 | Notwithstanding any other provision of this License, if you modify the 543 | Program, your modified version must prominently offer all users 544 | interacting with it remotely through a computer network (if your version 545 | supports such interaction) an opportunity to receive the Corresponding 546 | Source of your version by providing access to the Corresponding Source 547 | from a network server at no charge, through some standard or customary 548 | means of facilitating copying of software. This Corresponding Source 549 | shall include the Corresponding Source for any work covered by version 3 550 | of the GNU General Public License that is incorporated pursuant to the 551 | following paragraph. 552 | 553 | Notwithstanding any other provision of this License, you have 554 | permission to link or combine any covered work with a work licensed 555 | under version 3 of the GNU General Public License into a single 556 | combined work, and to convey the resulting work. The terms of this 557 | License will continue to apply to the part which is the covered work, 558 | but the work with which it is combined will remain governed by version 559 | 3 of the GNU General Public License. 560 | 561 | 14. Revised Versions of this License. 562 | 563 | The Free Software Foundation may publish revised and/or new versions of 564 | the GNU Affero General Public License from time to time. Such new versions 565 | will be similar in spirit to the present version, but may differ in detail to 566 | address new problems or concerns. 567 | 568 | Each version is given a distinguishing version number. If the 569 | Program specifies that a certain numbered version of the GNU Affero General 570 | Public License "or any later version" applies to it, you have the 571 | option of following the terms and conditions either of that numbered 572 | version or of any later version published by the Free Software 573 | Foundation. If the Program does not specify a version number of the 574 | GNU Affero General Public License, you may choose any version ever published 575 | by the Free Software Foundation. 576 | 577 | If the Program specifies that a proxy can decide which future 578 | versions of the GNU Affero General Public License can be used, that proxy's 579 | public statement of acceptance of a version permanently authorizes you 580 | to choose that version for the Program. 581 | 582 | Later license versions may give you additional or different 583 | permissions. However, no additional obligations are imposed on any 584 | author or copyright holder as a result of your choosing to follow a 585 | later version. 586 | 587 | 15. Disclaimer of Warranty. 588 | 589 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 590 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 591 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 592 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 593 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 594 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 595 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 596 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 597 | 598 | 16. Limitation of Liability. 599 | 600 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 601 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 602 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 603 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 604 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 605 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 606 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 607 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 608 | SUCH DAMAGES. 609 | 610 | 17. Interpretation of Sections 15 and 16. 611 | 612 | If the disclaimer of warranty and limitation of liability provided 613 | above cannot be given local legal effect according to their terms, 614 | reviewing courts shall apply local law that most closely approximates 615 | an absolute waiver of all civil liability in connection with the 616 | Program, unless a warranty or assumption of liability accompanies a 617 | copy of the Program in return for a fee. 618 | 619 | END OF TERMS AND CONDITIONS 620 | 621 | How to Apply These Terms to Your New Programs 622 | 623 | If you develop a new program, and you want it to be of the greatest 624 | possible use to the public, the best way to achieve this is to make it 625 | free software which everyone can redistribute and change under these terms. 626 | 627 | To do so, attach the following notices to the program. It is safest 628 | to attach them to the start of each source file to most effectively 629 | state the exclusion of warranty; and each file should have at least 630 | the "copyright" line and a pointer to where the full notice is found. 631 | 632 | 633 | Copyright (C) 634 | 635 | This program is free software: you can redistribute it and/or modify 636 | it under the terms of the GNU Affero General Public License as published 637 | by the Free Software Foundation, either version 3 of the License, or 638 | (at your option) any later version. 639 | 640 | This program is distributed in the hope that it will be useful, 641 | but WITHOUT ANY WARRANTY; without even the implied warranty of 642 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 643 | GNU Affero General Public License for more details. 644 | 645 | You should have received a copy of the GNU Affero General Public License 646 | along with this program. If not, see . 647 | 648 | Also add information on how to contact you by electronic and paper mail. 649 | 650 | If your software can interact with users remotely through a computer 651 | network, you should also make sure that it provides a way for users to 652 | get its source. For example, if your program is a web application, its 653 | interface could display a "Source" link that leads users to an archive 654 | of the code. There are many ways you could offer source, and different 655 | solutions will be better for different programs; see section 13 for the 656 | specific requirements. 657 | 658 | You should also get your employer (if you work as a programmer) or school, 659 | if any, to sign a "copyright disclaimer" for the program, if necessary. 660 | For more information on this, and how to apply and follow the GNU AGPL, see 661 | . 662 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 |

3 | 4 |

5 | 6 | 7 | 8 |

9 | 10 |

11 | HappyLighting-py was built reversing the original APK and replicated the BLE communication but with intention to create new functionalities. 12 |

13 | 14 |

15 | 16 | 17 |

18 | 19 | 20 | --- 21 | 22 | # How To 23 | 24 | First of all you need python. 25 | For Windows download the latest version from [here](https://www.python.org/downloads/) 26 | 27 | For Linux download by running ```apt install python3``` 28 | 29 | After installed Python, the procedure is the same for both OS. 30 | Open the terminal inside the folder "LEDStripController" and run these commands: 31 | 32 | ``` 33 | # First, download the requirements by running 34 | pip install -r requirements.txt 35 | 36 | # After that, run the app by run 37 | python3 pyhl.py 38 | 39 | # Enjoy 40 | ``` 41 | If you are on Linux, probably you need to install 2 more dependencies, in a console run: 42 | ```apt install libasound-dev portaudio19-dev -y``` 43 | 44 | There is also an available executable for Linux or Windows in Release section if you want a Click&Go file 45 | 46 | ### HappyLighting Support 47 | 48 | - [x] Change color 49 | - [x] Change mode & speed 50 | - [x] Enable integrated mic 51 | - [x] Emulated device mic (need improvements) 52 | - [x] Change color getting input from screen 53 | - [x] CLI Version [Branch](https://github.com/MikeCoder96/HappyLighting-py/tree/nogui) 54 | - [ ] Custom mode (Possible with custom language) 55 | - [ ] IFTTT Integration 56 | - [ ] Elgato Stream Deck integration 57 | - [ ] Device group and indipendet control 58 | - [ ] Change color using mouse pointer 59 | 60 | 61 | Any suggests? Write [here](https://github.com/MikeCoder96/HappyLighting-py/issues)! 62 | 63 | --- 64 | 65 | 66 | 67 | 68 | 69 | 70 | --------------------------------------------------------------------------------