{"id":17093541,"url":"https://github.com/nuniz/mlx_stft","last_synced_at":"2025-04-12T22:44:54.489Z","repository":{"id":224726335,"uuid":"755459426","full_name":"nuniz/mlx_stft","owner":"nuniz","description":"Short-Time Fourier Transform (STFT) for MLX (Apple)","archived":false,"fork":false,"pushed_at":"2024-07-16T15:48:39.000Z","size":247,"stargazers_count":9,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-12T22:44:47.091Z","etag":null,"topics":["apple","audio","ml-explore","mlx","signal-processing","speech","stft"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nuniz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-10T09:19:27.000Z","updated_at":"2025-02-18T08:38:19.000Z","dependencies_parsed_at":"2024-02-27T12:53:25.913Z","dependency_job_id":"89c76427-1e4c-4151-bacb-c8e1b520c1a5","html_url":"https://github.com/nuniz/mlx_stft","commit_stats":null,"previous_names":["nuniz/mlx_stft"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuniz%2Fmlx_stft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuniz%2Fmlx_stft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuniz%2Fmlx_stft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nuniz%2Fmlx_stft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nuniz","download_url":"https://codeload.github.com/nuniz/mlx_stft/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248643047,"owners_count":21138353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["apple","audio","ml-explore","mlx","signal-processing","speech","stft"],"created_at":"2024-10-14T14:07:29.544Z","updated_at":"2025-04-12T22:44:54.471Z","avatar_url":"https://github.com/nuniz.png","language":"Python","funding_links":[],"categories":["Libraries and Tools"],"sub_categories":["2024"],"readme":"# Short-Time Fourier Transform (STFT)\n\nThis module implements the Short-Time Fourier Transform (STFT) in Python using MLX.\n\nIt is designed to inherit from the nn.Module, which allows it to be used either as a standalone module or as part of a larger neural network architecture. \n\n## Installation\nYou can install mlx_stft directly from pypi:\n```bash\npip install mlx_stft\n```\n\nOr you can install it directly from the source code:\n```bash\ngit clone https://github.com/nuniz/mlx_stft.git\ncd mlx_stft\npython setup.py install\n```\n\n## Usage\n```python\nfrom mlx_stft import STFT\n\n# Create an instance of the STFT module\nstft = STFT(n_fft=1024, win_length=256, hop_length=128, return_db=True, onesided=True)\n\n# Compute STFT of an audio signal\ny = stft(x)\n```\n\n```\nx: mx.array [batch, length]\ny: mx.array [batch, n_fft // 2, size of fold] if one_sided else [batch, n_fft, size of fold]\nwhere size of fold = 1 + length // hop_length\n``` \n\n## Arguments\n    n_fft: Number of Fourier transform points.\n    win_length: Length of the STFT window.\n    hop_length: Number of audio samples between adjacent STFT columns.\n    window: Type of window function to apply (default is \"hann\").\n    onesided: Whether to return only the non-redundant part of the spectrum (default is False).\n    return_db: Whether to return the result in decibels (default is False).\n\n## Example\n\nThe STFT is illustrated in the picture below using the [NOIZEUS](https://ecs.utdallas.edu/loizou/speech/noizeus/) dataset's sp09.wav file.\n\n### One-Sided STFT\n![one-sided stft](supplementary_material/one-sided.jpg)\n\n### Dual-Sided STFT\n![dual-sided stft](supplementary_material/dual-sided.jpg)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuniz%2Fmlx_stft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnuniz%2Fmlx_stft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnuniz%2Fmlx_stft/lists"}