2023-04-21T09:35:43,878 Created temporary directory: /tmp/pip-ephem-wheel-cache-8acg2rjp 2023-04-21T09:35:43,883 Created temporary directory: /tmp/pip-build-tracker-z7xx40dr 2023-04-21T09:35:43,884 Initialized build tracking at /tmp/pip-build-tracker-z7xx40dr 2023-04-21T09:35:43,885 Created build tracker: /tmp/pip-build-tracker-z7xx40dr 2023-04-21T09:35:43,885 Entered build tracker: /tmp/pip-build-tracker-z7xx40dr 2023-04-21T09:35:43,886 Created temporary directory: /tmp/pip-wheel-06xyezyj 2023-04-21T09:35:43,896 DEPRECATION: --no-binary currently disables reading from the cache of locally built wheels. In the future --no-binary will not influence the wheel cache. pip 23.1 will enforce this behaviour change. A possible replacement is to use the --no-cache-dir option. You can use the flag --use-feature=no-binary-enable-wheel-cache to test the upcoming behaviour. Discussion can be found at https://github.com/pypa/pip/issues/11453 2023-04-21T09:35:43,902 Created temporary directory: /tmp/pip-ephem-wheel-cache-3um992ww 2023-04-21T09:35:43,961 Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple 2023-04-21T09:35:43,967 2 location(s) to search for versions of auraloss: 2023-04-21T09:35:43,967 * https://pypi.org/simple/auraloss/ 2023-04-21T09:35:43,967 * https://www.piwheels.org/simple/auraloss/ 2023-04-21T09:35:43,968 Fetching project page and analyzing links: https://pypi.org/simple/auraloss/ 2023-04-21T09:35:43,969 Getting page https://pypi.org/simple/auraloss/ 2023-04-21T09:35:43,973 Found index url https://pypi.org/simple 2023-04-21T09:35:44,162 Fetched page https://pypi.org/simple/auraloss/ as application/vnd.pypi.simple.v1+json 2023-04-21T09:35:44,169 Skipping link: No binaries permitted for auraloss: https://files.pythonhosted.org/packages/d6/25/55d1e56d2cc1431a01b73d0df97deb1e387bd5d6543bf898fc1ee49634f0/auraloss-0.1.7-py3-none-any.whl (from https://pypi.org/simple/auraloss/) (requires-python:>=3.6.0) 2023-04-21T09:35:44,171 Found link https://files.pythonhosted.org/packages/ef/0b/396f1e34d6cdeba43cc31f31706c8ccf4cffbd3962ce8f5b14d7d720eb6b/auraloss-0.1.7.tar.gz (from https://pypi.org/simple/auraloss/) (requires-python:>=3.6.0), version: 0.1.7 2023-04-21T09:35:44,172 Skipping link: No binaries permitted for auraloss: https://files.pythonhosted.org/packages/01/e5/1f1ab8c0631707d528d50a531e826ce13cfcba459e69e379e98901486a33/auraloss-0.2.0-py3-none-any.whl (from https://pypi.org/simple/auraloss/) (requires-python:>=3.6.0) 2023-04-21T09:35:44,173 Found link https://files.pythonhosted.org/packages/ae/d6/4e108da932bc2de10a5a236622f95320bd1acbc28f650dd28b56e5011a1c/auraloss-0.2.0.tar.gz (from https://pypi.org/simple/auraloss/) (requires-python:>=3.6.0), version: 0.2.0 2023-04-21T09:35:44,174 Skipping link: No binaries permitted for auraloss: https://files.pythonhosted.org/packages/3e/ed/3dfb1909bef29478d9a22766eb74cc8e407f314eefe6bd218cdc24ea7680/auraloss-0.2.1-py3-none-any.whl (from https://pypi.org/simple/auraloss/) (requires-python:>=3.6.0) 2023-04-21T09:35:44,175 Found link https://files.pythonhosted.org/packages/80/fc/b0743001e5afa92a93e5b13b0f74f64b8450bcb263a71d649340d889ba11/auraloss-0.2.1.tar.gz (from https://pypi.org/simple/auraloss/) (requires-python:>=3.6.0), version: 0.2.1 2023-04-21T09:35:44,176 Skipping link: No binaries permitted for auraloss: https://files.pythonhosted.org/packages/11/b6/d3a792035cc21b55c22a8745ca9f4ea3835b2408d63d4c787dcf52e1af4a/auraloss-0.2.2-py3-none-any.whl (from https://pypi.org/simple/auraloss/) (requires-python:>=3.6.0) 2023-04-21T09:35:44,177 Found link https://files.pythonhosted.org/packages/d1/0c/88c8f0579631fb88119895fc13ed30fedcadfce80df97c179331568aa4bb/auraloss-0.2.2.tar.gz (from https://pypi.org/simple/auraloss/) (requires-python:>=3.6.0), version: 0.2.2 2023-04-21T09:35:44,178 Skipping link: No binaries permitted for auraloss: https://files.pythonhosted.org/packages/62/9c/7f19f53c92ba04a2a6c26f0d8388eed78bc8408f8ab8221d4ac7d2892468/auraloss-0.3.0-py3-none-any.whl (from https://pypi.org/simple/auraloss/) (requires-python:>=3.6.0) 2023-04-21T09:35:44,179 Found link https://files.pythonhosted.org/packages/1e/6e/0b8c140e51450b9f558bf9483500989d9b81e0bc99073b38743cb6739a15/auraloss-0.3.0.tar.gz (from https://pypi.org/simple/auraloss/) (requires-python:>=3.6.0), version: 0.3.0 2023-04-21T09:35:44,180 Skipping link: No binaries permitted for auraloss: https://files.pythonhosted.org/packages/a6/ab/8df927d3f0951cf67ca5973d89b35bcbda1777a4c78bf90a853d02d91285/auraloss-0.4.0-py3-none-any.whl (from https://pypi.org/simple/auraloss/) (requires-python:>=3.6.0) 2023-04-21T09:35:44,181 Found link https://files.pythonhosted.org/packages/ec/55/2a3bbafa3e947b972c81f852c6c31cc359a21848908f2aabd35b34b532e9/auraloss-0.4.0.tar.gz (from https://pypi.org/simple/auraloss/) (requires-python:>=3.6.0), version: 0.4.0 2023-04-21T09:35:44,182 Fetching project page and analyzing links: https://www.piwheels.org/simple/auraloss/ 2023-04-21T09:35:44,183 Getting page https://www.piwheels.org/simple/auraloss/ 2023-04-21T09:35:44,185 Found index url https://www.piwheels.org/simple 2023-04-21T09:35:44,483 Fetched page https://www.piwheels.org/simple/auraloss/ as text/html 2023-04-21T09:35:44,488 Skipping link: No binaries permitted for auraloss: https://www.piwheels.org/simple/auraloss/auraloss-0.3.0-py3-none-any.whl#sha256=0de12183d93ed3a210e80b31da45736da1866ae97d3f6f275c25364f793f6dd1 (from https://www.piwheels.org/simple/auraloss/) (requires-python:>=3.6.0) 2023-04-21T09:35:44,489 Skipping link: No binaries permitted for auraloss: https://www.piwheels.org/simple/auraloss/auraloss-0.2.1-py3-none-any.whl#sha256=e21e1605a3c5f3ae7a19055d5de5fa28cb90c2a678d43d2ce391580e6e201596 (from https://www.piwheels.org/simple/auraloss/) (requires-python:>=3.6.0) 2023-04-21T09:35:44,489 Skipping link: No binaries permitted for auraloss: https://www.piwheels.org/simple/auraloss/auraloss-0.2.0-py3-none-any.whl#sha256=95ca26690ed697a0899bb04f1b4eac0ed44b4ef0d30c8f1ea264986dc3a076dc (from https://www.piwheels.org/simple/auraloss/) (requires-python:>=3.6.0) 2023-04-21T09:35:44,490 Skipping link: No binaries permitted for auraloss: https://www.piwheels.org/simple/auraloss/auraloss-0.1.7-py3-none-any.whl#sha256=aea15bde8ba4cacff0bfeeb9822acd8168ddd5e044b063b4d4ad813f3663e5df (from https://www.piwheels.org/simple/auraloss/) (requires-python:>=3.6.0) 2023-04-21T09:35:44,490 Skipping link: not a file: https://www.piwheels.org/simple/auraloss/ 2023-04-21T09:35:44,491 Skipping link: not a file: https://pypi.org/simple/auraloss/ 2023-04-21T09:35:44,525 Given no hashes to check 1 links for project 'auraloss': discarding no candidates 2023-04-21T09:35:44,555 Collecting auraloss==0.4.0 2023-04-21T09:35:44,560 Created temporary directory: /tmp/pip-unpack-ikwynjsc 2023-04-21T09:35:44,729 Downloading auraloss-0.4.0.tar.gz (17 kB) 2023-04-21T09:35:44,817 Added auraloss==0.4.0 from https://files.pythonhosted.org/packages/ec/55/2a3bbafa3e947b972c81f852c6c31cc359a21848908f2aabd35b34b532e9/auraloss-0.4.0.tar.gz to build tracker '/tmp/pip-build-tracker-z7xx40dr' 2023-04-21T09:35:44,828 Created temporary directory: /tmp/pip-build-env-50z2g2rx 2023-04-21T09:35:44,849 Installing build dependencies: started 2023-04-21T09:35:44,851 Running command pip subprocess to install build dependencies 2023-04-21T09:35:47,593 Using pip 23.0.1 from /home/piwheels/.local/lib/python3.7/site-packages/pip (python 3.7) 2023-04-21T09:35:48,895 DEPRECATION: --no-binary currently disables reading from the cache of locally built wheels. In the future --no-binary will not influence the wheel cache. pip 23.1 will enforce this behaviour change. A possible replacement is to use the --no-cache-dir option. You can use the flag --use-feature=no-binary-enable-wheel-cache to test the upcoming behaviour. Discussion can be found at https://github.com/pypa/pip/issues/11453 2023-04-21T09:35:48,956 Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple 2023-04-21T09:35:53,251 Collecting setuptools 2023-04-21T09:35:53,363 Downloading setuptools-67.7.1-py3-none-any.whl (1.1 MB) 2023-04-21T09:35:53,652 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.1/1.1 MB 4.1 MB/s eta 0:00:00 2023-04-21T09:35:54,282 Collecting wheel 2023-04-21T09:35:54,319 Using cached https://www.piwheels.org/simple/wheel/wheel-0.40.0-py3-none-any.whl (64 kB) 2023-04-21T09:35:54,685 Collecting attrs 2023-04-21T09:35:54,759 Using cached https://www.piwheels.org/simple/attrs/attrs-23.1.0-py3-none-any.whl (61 kB) 2023-04-21T09:35:55,963 Collecting importlib-metadata 2023-04-21T09:35:55,996 Using cached https://www.piwheels.org/simple/importlib-metadata/importlib_metadata-6.5.0-py3-none-any.whl (22 kB) 2023-04-21T09:35:56,445 Collecting typing-extensions>=3.6.4 2023-04-21T09:35:56,479 Using cached https://www.piwheels.org/simple/typing-extensions/typing_extensions-4.5.0-py3-none-any.whl (27 kB) 2023-04-21T09:35:56,901 Collecting zipp>=0.5 2023-04-21T09:35:56,944 Using cached https://www.piwheels.org/simple/zipp/zipp-3.15.0-py3-none-any.whl (6.8 kB) 2023-04-21T09:36:03,296 Installing collected packages: zipp, wheel, typing-extensions, setuptools, importlib-metadata, attrs 2023-04-21T09:36:03,812 Creating /tmp/pip-build-env-50z2g2rx/overlay/bin 2023-04-21T09:36:03,817 changing mode of /tmp/pip-build-env-50z2g2rx/overlay/bin/wheel to 755 2023-04-21T09:36:08,784 Successfully installed attrs-23.1.0 importlib-metadata-6.5.0 setuptools-67.7.1 typing-extensions-4.5.0 wheel-0.40.0 zipp-3.15.0 2023-04-21T09:36:09,270 [notice] A new release of pip is available: 23.0.1 -> 23.1 2023-04-21T09:36:09,270 [notice] To update, run: python3 -m pip install --upgrade pip 2023-04-21T09:36:09,794 Installing build dependencies: finished with status 'done' 2023-04-21T09:36:09,806 Getting requirements to build wheel: started 2023-04-21T09:36:09,808 Running command Getting requirements to build wheel 2023-04-21T09:36:11,139 /tmp/pip-build-env-50z2g2rx/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `readme` defined outside of `pyproject.toml` would be ignored. 2023-04-21T09:36:11,140 !! 2023-04-21T09:36:11,141 ******************************************************************************** 2023-04-21T09:36:11,141 ########################################################################## 2023-04-21T09:36:11,141 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-04-21T09:36:11,142 ########################################################################## 2023-04-21T09:36:11,142 The following seems to be defined outside of `pyproject.toml`: 2023-04-21T09:36:11,143 `readme = '\n
\n\n# auraloss\n\n\n\nA collection of audio-focused loss functions in PyTorch. \n\n[[PDF](https://www.christiansteinmetz.com/s/DMRN15__auraloss__Audio_focused_loss_functions_in_PyTorch.pdf)]\n\n
\n\n## Setup\n\n```\npip install auraloss\n```\n\nIf you want to use `MelSTFTLoss()` or `FIRFilter()` you will need to specify the extra install (librosa and scipy).\n\n```\npip install auraloss[all]\n```\n\n## Usage\n\n```python\nimport torch\nimport auraloss\n\nmrstft = auraloss.freq.MultiResolutionSTFTLoss()\n\ninput = torch.rand(8,1,44100)\ntarget = torch.rand(8,1,44100)\n\nloss = mrstft(input, target)\n```\n\n**NEW**: Perceptual weighting with mel scaled spectrograms.\n\n```python\n\nbs = 8\nchs = 1\nseq_len = 131072\nsample_rate = 44100\n\n# some audio you want to compare\ntarget = torch.rand(bs, chs, seq_len)\npred = torch.rand(bs, chs, seq_len)\n\n# define the loss function\nloss_fn = auraloss.freq.MultiResolutionSTFTLoss(\n fft_sizes=[1024, 2048, 8192],\n hop_sizes=[256, 512, 2048],\n win_lengths=[1024, 2048, 8192],\n scale="mel",\n n_bins=128,\n sample_rate=sample_rate,\n perceptual_weighting=True,\n)\n\n# compute\nloss = loss_fn(pred, target)\n\n```\n\n## Citation\nIf you use this code in your work please consider citing us.\n```bibtex\n@inproceedings{steinmetz2020auraloss,\n title={auraloss: {A}udio focused loss functions in {PyTorch}},\n author={Steinmetz, Christian J. and Reiss, Joshua D.},\n booktitle={Digital Music Research Network One-day Workshop (DMRN+15)},\n year={2020}\n}\n```\n\n\n# Loss functions\n\nWe categorize the loss functions as either time-domain or frequency-domain approaches. \nAdditionally, we include perceptual transforms.\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
Loss functionInterfaceReference
Time domain
Error-to-signal ratio (ESR)auraloss.time.ESRLoss()Wright & Välimäki, 2019
DC error (DC)auraloss.time.DCLoss()Wright & Välimäki, 2019
Log hyperbolic cosine (Log-cosh)auraloss.time.LogCoshLoss()Chen et al., 2019
Signal-to-noise ratio (SNR)auraloss.time.SNRLoss()
Scale-invariant signal-to-distortion
ratio (SI-SDR)
auraloss.time.SISDRLoss()Le Roux et al., 2018
Scale-dependent signal-to-distortion
ratio (SD-SDR)
auraloss.time.SDSDRLoss()Le Roux et al., 2018
Frequency domain
Aggregate STFTauraloss.freq.STFTLoss()Arik et al., 2018
Aggregate Mel-scaled STFTauraloss.freq.MelSTFTLoss(sample_rate)
Multi-resolution STFTauraloss.freq.MultiResolutionSTFTLoss()Yamamoto et al., 2019*
Random-resolution STFTauraloss.freq.RandomResolutionSTFTLoss()Steinmetz & Reiss, 2020
Sum and difference STFT lossauraloss.freq.SumAndDifferenceSTFTLoss()Steinmetz et al., 2020
Perceptual transforms
Sum and difference signal transformauraloss.perceptual.SumAndDifference()
FIR pre-emphasis filtersauraloss.perceptual.FIRFilter()Wright & Välimäki, 2019
\n\n\\* [Wang et al., 2019](https://arxiv.org/abs/1904.12088) also propose a multi-resolution spectral loss (that [Engel et al., 2020](https://arxiv.org/abs/2001.04643) follow), \nbut they do not include both the log magnitude (L1 distance) and spectral convergence terms, introduced in [Arik et al., 2018](https://arxiv.org/abs/1808.0671), and then extended for the multi-resolution case in [Yamamoto et al., 2019](https://arxiv.org/abs/1910.11480).\n\n## Examples\n\nCurrently we include an example using a set of the loss functions to train a TCN for modeling an analog dynamic range compressor. \nFor details please refer to the details in [`examples/compressor`](examples/compressor). \nWe provide pre-trained models, evaluation scripts to compute the metrics in the [paper](https://www.christiansteinmetz.com/s/DMRN15__auraloss__Audio_focused_loss_functions_in_PyTorch.pdf), as well as scripts to retrain models. \n\nThere are some more advanced things you can do based upon the `STFTLoss` class. \nFor example, you can compute both linear and log scaled STFT errors as in [Engel et al., 2020](https://arxiv.org/abs/2001.04643).\nIn this case we do not include the spectral convergence term. \n```python\nstft_loss = auraloss.freq.STFTLoss(\n w_log_mag=1.0, \n w_lin_mag=1.0, \n w_sc=0.0,\n)\n```\n\nThere is also a Mel-scaled STFT loss, which has some special requirements. \nThis loss requires you set the sample rate as well as specify the correct device. \n```python\nsample_rate = 44100\nmelstft_loss = auraloss.freq.MelSTFTLoss(sample_rate, device="cuda")\n```\n\nYou can also build a multi-resolution Mel-scaled STFT loss with 64 bins easily. \nMake sure you pass the correct device where the tensors you are comparing will be. \n```python\nloss_fn = auraloss.freq.MultiResolutionSTFTLoss(\n scale="mel", \n n_bins=64,\n sample_rate=sample_rate,\n device="cuda"\n)\n```\n\nIf you are computing a loss on stereo audio you may want to consider the sum and difference (mid/side) loss. \nBelow we have shown an example of using this loss function with the perceptual weighting and mel scaling for \nfurther perceptual relevance. \n\n```python\n\ntarget = torch.rand(8, 2, 44100)\npred = torch.rand(8, 2, 44100)\n\nloss_fn = auraloss.freq.SumAndDifferenceSTFTLoss(\n fft_sizes=[1024, 2048, 8192],\n hop_sizes=[256, 512, 2048],\n win_lengths=[1024, 2048, 8192],\n perceptual_weighting=True,\n sample_rate=44100,\n scale="mel",\n n_bins=128,\n)\n\nloss = loss_fn(pred, target)\n```\n\n# Development\n\nRun tests locally with pytest. \n\n```python -m pytest```\n'` 2023-04-21T09:36:11,144 According to the spec (see the link below), however, setuptools CANNOT 2023-04-21T09:36:11,144 consider this value unless `readme` is listed as `dynamic`. 2023-04-21T09:36:11,145 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-04-21T09:36:11,146 For the time being, `setuptools` will still consider the given value (as a 2023-04-21T09:36:11,146 **transitional** measure), but please note that future releases of setuptools will 2023-04-21T09:36:11,146 follow strictly the standard. 2023-04-21T09:36:11,147 To prevent this warning, you can list `readme` under `dynamic` or alternatively 2023-04-21T09:36:11,147 remove the `[project]` table from your file and rely entirely on other means of 2023-04-21T09:36:11,148 configuration. 2023-04-21T09:36:11,148 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-04-21T09:36:11,149 or your builds will no longer be supported. 2023-04-21T09:36:11,149 ******************************************************************************** 2023-04-21T09:36:11,150 !! 2023-04-21T09:36:11,150 _handle_missing_dynamic(dist, project_table) 2023-04-21T09:36:11,830 running egg_info 2023-04-21T09:36:11,842 writing auraloss.egg-info/PKG-INFO 2023-04-21T09:36:11,846 writing dependency_links to auraloss.egg-info/dependency_links.txt 2023-04-21T09:36:11,851 writing requirements to auraloss.egg-info/requires.txt 2023-04-21T09:36:11,853 writing top-level names to auraloss.egg-info/top_level.txt 2023-04-21T09:36:11,894 reading manifest file 'auraloss.egg-info/SOURCES.txt' 2023-04-21T09:36:11,899 adding license file 'LICENSE' 2023-04-21T09:36:11,904 writing manifest file 'auraloss.egg-info/SOURCES.txt' 2023-04-21T09:36:11,908 /tmp/pip-build-env-50z2g2rx/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `requires-python` defined outside of `pyproject.toml` would be ignored. 2023-04-21T09:36:11,908 !! 2023-04-21T09:36:11,909 ******************************************************************************** 2023-04-21T09:36:11,910 ########################################################################## 2023-04-21T09:36:11,910 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-04-21T09:36:11,910 ########################################################################## 2023-04-21T09:36:11,911 The following seems to be defined outside of `pyproject.toml`: 2023-04-21T09:36:11,912 `requires-python = '>=3.6.0'` 2023-04-21T09:36:11,913 According to the spec (see the link below), however, setuptools CANNOT 2023-04-21T09:36:11,914 consider this value unless `requires-python` is listed as `dynamic`. 2023-04-21T09:36:11,915 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-04-21T09:36:11,916 For the time being, `setuptools` will still consider the given value (as a 2023-04-21T09:36:11,916 **transitional** measure), but please note that future releases of setuptools will 2023-04-21T09:36:11,917 follow strictly the standard. 2023-04-21T09:36:11,918 To prevent this warning, you can list `requires-python` under `dynamic` or alternatively 2023-04-21T09:36:11,918 remove the `[project]` table from your file and rely entirely on other means of 2023-04-21T09:36:11,919 configuration. 2023-04-21T09:36:11,920 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-04-21T09:36:11,920 or your builds will no longer be supported. 2023-04-21T09:36:11,920 ******************************************************************************** 2023-04-21T09:36:11,921 !! 2023-04-21T09:36:11,922 _handle_missing_dynamic(dist, project_table) 2023-04-21T09:36:11,922 /tmp/pip-build-env-50z2g2rx/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `license` defined outside of `pyproject.toml` would be ignored. 2023-04-21T09:36:11,923 !! 2023-04-21T09:36:11,924 ******************************************************************************** 2023-04-21T09:36:11,924 ########################################################################## 2023-04-21T09:36:11,924 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-04-21T09:36:11,925 ########################################################################## 2023-04-21T09:36:11,926 The following seems to be defined outside of `pyproject.toml`: 2023-04-21T09:36:11,926 `license = 'Apache License 2.0'` 2023-04-21T09:36:11,927 According to the spec (see the link below), however, setuptools CANNOT 2023-04-21T09:36:11,928 consider this value unless `license` is listed as `dynamic`. 2023-04-21T09:36:11,929 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-04-21T09:36:11,929 For the time being, `setuptools` will still consider the given value (as a 2023-04-21T09:36:11,930 **transitional** measure), but please note that future releases of setuptools will 2023-04-21T09:36:11,930 follow strictly the standard. 2023-04-21T09:36:11,931 To prevent this warning, you can list `license` under `dynamic` or alternatively 2023-04-21T09:36:11,931 remove the `[project]` table from your file and rely entirely on other means of 2023-04-21T09:36:11,932 configuration. 2023-04-21T09:36:11,932 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-04-21T09:36:11,933 or your builds will no longer be supported. 2023-04-21T09:36:11,933 ******************************************************************************** 2023-04-21T09:36:11,934 !! 2023-04-21T09:36:11,934 _handle_missing_dynamic(dist, project_table) 2023-04-21T09:36:11,935 /tmp/pip-build-env-50z2g2rx/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `classifiers` defined outside of `pyproject.toml` would be ignored. 2023-04-21T09:36:11,935 !! 2023-04-21T09:36:11,936 ******************************************************************************** 2023-04-21T09:36:11,937 ########################################################################## 2023-04-21T09:36:11,937 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-04-21T09:36:11,938 ########################################################################## 2023-04-21T09:36:11,939 The following seems to be defined outside of `pyproject.toml`: 2023-04-21T09:36:11,940 `classifiers = ['License :: OSI Approved :: Apache Software License', 'Topic :: Multimedia :: Sound/Audio', 'Topic :: Scientific/Engineering']` 2023-04-21T09:36:11,941 According to the spec (see the link below), however, setuptools CANNOT 2023-04-21T09:36:11,941 consider this value unless `classifiers` is listed as `dynamic`. 2023-04-21T09:36:11,942 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-04-21T09:36:11,943 For the time being, `setuptools` will still consider the given value (as a 2023-04-21T09:36:11,943 **transitional** measure), but please note that future releases of setuptools will 2023-04-21T09:36:11,944 follow strictly the standard. 2023-04-21T09:36:11,944 To prevent this warning, you can list `classifiers` under `dynamic` or alternatively 2023-04-21T09:36:11,945 remove the `[project]` table from your file and rely entirely on other means of 2023-04-21T09:36:11,945 configuration. 2023-04-21T09:36:11,946 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-04-21T09:36:11,946 or your builds will no longer be supported. 2023-04-21T09:36:11,947 ******************************************************************************** 2023-04-21T09:36:11,948 !! 2023-04-21T09:36:11,948 _handle_missing_dynamic(dist, project_table) 2023-04-21T09:36:11,949 /tmp/pip-build-env-50z2g2rx/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:69: SetuptoolsWarning: `install_requires` overwritten in `pyproject.toml` (dependencies) 2023-04-21T09:36:11,949 corresp(dist, value, root_dir) 2023-04-21T09:36:12,092 Getting requirements to build wheel: finished with status 'done' 2023-04-21T09:36:12,119 Created temporary directory: /tmp/pip-modern-metadata-pmvz7by5 2023-04-21T09:36:12,125 Preparing metadata (pyproject.toml): started 2023-04-21T09:36:12,127 Running command Preparing metadata (pyproject.toml) 2023-04-21T09:36:13,375 /tmp/pip-build-env-50z2g2rx/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `readme` defined outside of `pyproject.toml` would be ignored. 2023-04-21T09:36:13,376 !! 2023-04-21T09:36:13,377 ******************************************************************************** 2023-04-21T09:36:13,378 ########################################################################## 2023-04-21T09:36:13,378 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-04-21T09:36:13,378 ########################################################################## 2023-04-21T09:36:13,379 The following seems to be defined outside of `pyproject.toml`: 2023-04-21T09:36:13,380 `readme = '\n
\n\n# auraloss\n\n\n\nA collection of audio-focused loss functions in PyTorch. \n\n[[PDF](https://www.christiansteinmetz.com/s/DMRN15__auraloss__Audio_focused_loss_functions_in_PyTorch.pdf)]\n\n
\n\n## Setup\n\n```\npip install auraloss\n```\n\nIf you want to use `MelSTFTLoss()` or `FIRFilter()` you will need to specify the extra install (librosa and scipy).\n\n```\npip install auraloss[all]\n```\n\n## Usage\n\n```python\nimport torch\nimport auraloss\n\nmrstft = auraloss.freq.MultiResolutionSTFTLoss()\n\ninput = torch.rand(8,1,44100)\ntarget = torch.rand(8,1,44100)\n\nloss = mrstft(input, target)\n```\n\n**NEW**: Perceptual weighting with mel scaled spectrograms.\n\n```python\n\nbs = 8\nchs = 1\nseq_len = 131072\nsample_rate = 44100\n\n# some audio you want to compare\ntarget = torch.rand(bs, chs, seq_len)\npred = torch.rand(bs, chs, seq_len)\n\n# define the loss function\nloss_fn = auraloss.freq.MultiResolutionSTFTLoss(\n fft_sizes=[1024, 2048, 8192],\n hop_sizes=[256, 512, 2048],\n win_lengths=[1024, 2048, 8192],\n scale="mel",\n n_bins=128,\n sample_rate=sample_rate,\n perceptual_weighting=True,\n)\n\n# compute\nloss = loss_fn(pred, target)\n\n```\n\n## Citation\nIf you use this code in your work please consider citing us.\n```bibtex\n@inproceedings{steinmetz2020auraloss,\n title={auraloss: {A}udio focused loss functions in {PyTorch}},\n author={Steinmetz, Christian J. and Reiss, Joshua D.},\n booktitle={Digital Music Research Network One-day Workshop (DMRN+15)},\n year={2020}\n}\n```\n\n\n# Loss functions\n\nWe categorize the loss functions as either time-domain or frequency-domain approaches. \nAdditionally, we include perceptual transforms.\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
Loss functionInterfaceReference
Time domain
Error-to-signal ratio (ESR)auraloss.time.ESRLoss()Wright & Välimäki, 2019
DC error (DC)auraloss.time.DCLoss()Wright & Välimäki, 2019
Log hyperbolic cosine (Log-cosh)auraloss.time.LogCoshLoss()Chen et al., 2019
Signal-to-noise ratio (SNR)auraloss.time.SNRLoss()
Scale-invariant signal-to-distortion
ratio (SI-SDR)
auraloss.time.SISDRLoss()Le Roux et al., 2018
Scale-dependent signal-to-distortion
ratio (SD-SDR)
auraloss.time.SDSDRLoss()Le Roux et al., 2018
Frequency domain
Aggregate STFTauraloss.freq.STFTLoss()Arik et al., 2018
Aggregate Mel-scaled STFTauraloss.freq.MelSTFTLoss(sample_rate)
Multi-resolution STFTauraloss.freq.MultiResolutionSTFTLoss()Yamamoto et al., 2019*
Random-resolution STFTauraloss.freq.RandomResolutionSTFTLoss()Steinmetz & Reiss, 2020
Sum and difference STFT lossauraloss.freq.SumAndDifferenceSTFTLoss()Steinmetz et al., 2020
Perceptual transforms
Sum and difference signal transformauraloss.perceptual.SumAndDifference()
FIR pre-emphasis filtersauraloss.perceptual.FIRFilter()Wright & Välimäki, 2019
\n\n\\* [Wang et al., 2019](https://arxiv.org/abs/1904.12088) also propose a multi-resolution spectral loss (that [Engel et al., 2020](https://arxiv.org/abs/2001.04643) follow), \nbut they do not include both the log magnitude (L1 distance) and spectral convergence terms, introduced in [Arik et al., 2018](https://arxiv.org/abs/1808.0671), and then extended for the multi-resolution case in [Yamamoto et al., 2019](https://arxiv.org/abs/1910.11480).\n\n## Examples\n\nCurrently we include an example using a set of the loss functions to train a TCN for modeling an analog dynamic range compressor. \nFor details please refer to the details in [`examples/compressor`](examples/compressor). \nWe provide pre-trained models, evaluation scripts to compute the metrics in the [paper](https://www.christiansteinmetz.com/s/DMRN15__auraloss__Audio_focused_loss_functions_in_PyTorch.pdf), as well as scripts to retrain models. \n\nThere are some more advanced things you can do based upon the `STFTLoss` class. \nFor example, you can compute both linear and log scaled STFT errors as in [Engel et al., 2020](https://arxiv.org/abs/2001.04643).\nIn this case we do not include the spectral convergence term. \n```python\nstft_loss = auraloss.freq.STFTLoss(\n w_log_mag=1.0, \n w_lin_mag=1.0, \n w_sc=0.0,\n)\n```\n\nThere is also a Mel-scaled STFT loss, which has some special requirements. \nThis loss requires you set the sample rate as well as specify the correct device. \n```python\nsample_rate = 44100\nmelstft_loss = auraloss.freq.MelSTFTLoss(sample_rate, device="cuda")\n```\n\nYou can also build a multi-resolution Mel-scaled STFT loss with 64 bins easily. \nMake sure you pass the correct device where the tensors you are comparing will be. \n```python\nloss_fn = auraloss.freq.MultiResolutionSTFTLoss(\n scale="mel", \n n_bins=64,\n sample_rate=sample_rate,\n device="cuda"\n)\n```\n\nIf you are computing a loss on stereo audio you may want to consider the sum and difference (mid/side) loss. \nBelow we have shown an example of using this loss function with the perceptual weighting and mel scaling for \nfurther perceptual relevance. \n\n```python\n\ntarget = torch.rand(8, 2, 44100)\npred = torch.rand(8, 2, 44100)\n\nloss_fn = auraloss.freq.SumAndDifferenceSTFTLoss(\n fft_sizes=[1024, 2048, 8192],\n hop_sizes=[256, 512, 2048],\n win_lengths=[1024, 2048, 8192],\n perceptual_weighting=True,\n sample_rate=44100,\n scale="mel",\n n_bins=128,\n)\n\nloss = loss_fn(pred, target)\n```\n\n# Development\n\nRun tests locally with pytest. \n\n```python -m pytest```\n'` 2023-04-21T09:36:13,381 According to the spec (see the link below), however, setuptools CANNOT 2023-04-21T09:36:13,381 consider this value unless `readme` is listed as `dynamic`. 2023-04-21T09:36:13,382 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-04-21T09:36:13,382 For the time being, `setuptools` will still consider the given value (as a 2023-04-21T09:36:13,383 **transitional** measure), but please note that future releases of setuptools will 2023-04-21T09:36:13,383 follow strictly the standard. 2023-04-21T09:36:13,384 To prevent this warning, you can list `readme` under `dynamic` or alternatively 2023-04-21T09:36:13,384 remove the `[project]` table from your file and rely entirely on other means of 2023-04-21T09:36:13,384 configuration. 2023-04-21T09:36:13,385 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-04-21T09:36:13,385 or your builds will no longer be supported. 2023-04-21T09:36:13,386 ******************************************************************************** 2023-04-21T09:36:13,386 !! 2023-04-21T09:36:13,387 _handle_missing_dynamic(dist, project_table) 2023-04-21T09:36:14,018 running dist_info 2023-04-21T09:36:14,032 creating /tmp/pip-modern-metadata-pmvz7by5/auraloss.egg-info 2023-04-21T09:36:14,043 writing /tmp/pip-modern-metadata-pmvz7by5/auraloss.egg-info/PKG-INFO 2023-04-21T09:36:14,048 writing dependency_links to /tmp/pip-modern-metadata-pmvz7by5/auraloss.egg-info/dependency_links.txt 2023-04-21T09:36:14,052 writing requirements to /tmp/pip-modern-metadata-pmvz7by5/auraloss.egg-info/requires.txt 2023-04-21T09:36:14,054 writing top-level names to /tmp/pip-modern-metadata-pmvz7by5/auraloss.egg-info/top_level.txt 2023-04-21T09:36:14,057 writing manifest file '/tmp/pip-modern-metadata-pmvz7by5/auraloss.egg-info/SOURCES.txt' 2023-04-21T09:36:14,094 reading manifest file '/tmp/pip-modern-metadata-pmvz7by5/auraloss.egg-info/SOURCES.txt' 2023-04-21T09:36:14,099 adding license file 'LICENSE' 2023-04-21T09:36:14,104 writing manifest file '/tmp/pip-modern-metadata-pmvz7by5/auraloss.egg-info/SOURCES.txt' 2023-04-21T09:36:14,106 creating '/tmp/pip-modern-metadata-pmvz7by5/auraloss-0.4.0.dist-info' 2023-04-21T09:36:14,182 /tmp/pip-build-env-50z2g2rx/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `requires-python` defined outside of `pyproject.toml` would be ignored. 2023-04-21T09:36:14,182 !! 2023-04-21T09:36:14,183 ******************************************************************************** 2023-04-21T09:36:14,184 ########################################################################## 2023-04-21T09:36:14,184 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-04-21T09:36:14,184 ########################################################################## 2023-04-21T09:36:14,185 The following seems to be defined outside of `pyproject.toml`: 2023-04-21T09:36:14,186 `requires-python = '>=3.6.0'` 2023-04-21T09:36:14,187 According to the spec (see the link below), however, setuptools CANNOT 2023-04-21T09:36:14,188 consider this value unless `requires-python` is listed as `dynamic`. 2023-04-21T09:36:14,189 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-04-21T09:36:14,190 For the time being, `setuptools` will still consider the given value (as a 2023-04-21T09:36:14,190 **transitional** measure), but please note that future releases of setuptools will 2023-04-21T09:36:14,191 follow strictly the standard. 2023-04-21T09:36:14,192 To prevent this warning, you can list `requires-python` under `dynamic` or alternatively 2023-04-21T09:36:14,192 remove the `[project]` table from your file and rely entirely on other means of 2023-04-21T09:36:14,192 configuration. 2023-04-21T09:36:14,193 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-04-21T09:36:14,194 or your builds will no longer be supported. 2023-04-21T09:36:14,194 ******************************************************************************** 2023-04-21T09:36:14,195 !! 2023-04-21T09:36:14,196 _handle_missing_dynamic(dist, project_table) 2023-04-21T09:36:14,196 /tmp/pip-build-env-50z2g2rx/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `license` defined outside of `pyproject.toml` would be ignored. 2023-04-21T09:36:14,197 !! 2023-04-21T09:36:14,198 ******************************************************************************** 2023-04-21T09:36:14,198 ########################################################################## 2023-04-21T09:36:14,199 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-04-21T09:36:14,199 ########################################################################## 2023-04-21T09:36:14,200 The following seems to be defined outside of `pyproject.toml`: 2023-04-21T09:36:14,201 `license = 'Apache License 2.0'` 2023-04-21T09:36:14,201 According to the spec (see the link below), however, setuptools CANNOT 2023-04-21T09:36:14,202 consider this value unless `license` is listed as `dynamic`. 2023-04-21T09:36:14,203 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-04-21T09:36:14,203 For the time being, `setuptools` will still consider the given value (as a 2023-04-21T09:36:14,204 **transitional** measure), but please note that future releases of setuptools will 2023-04-21T09:36:14,204 follow strictly the standard. 2023-04-21T09:36:14,205 To prevent this warning, you can list `license` under `dynamic` or alternatively 2023-04-21T09:36:14,205 remove the `[project]` table from your file and rely entirely on other means of 2023-04-21T09:36:14,206 configuration. 2023-04-21T09:36:14,206 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-04-21T09:36:14,207 or your builds will no longer be supported. 2023-04-21T09:36:14,207 ******************************************************************************** 2023-04-21T09:36:14,208 !! 2023-04-21T09:36:14,209 _handle_missing_dynamic(dist, project_table) 2023-04-21T09:36:14,209 /tmp/pip-build-env-50z2g2rx/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `classifiers` defined outside of `pyproject.toml` would be ignored. 2023-04-21T09:36:14,209 !! 2023-04-21T09:36:14,210 ******************************************************************************** 2023-04-21T09:36:14,211 ########################################################################## 2023-04-21T09:36:14,211 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-04-21T09:36:14,212 ########################################################################## 2023-04-21T09:36:14,213 The following seems to be defined outside of `pyproject.toml`: 2023-04-21T09:36:14,214 `classifiers = ['License :: OSI Approved :: Apache Software License', 'Topic :: Multimedia :: Sound/Audio', 'Topic :: Scientific/Engineering']` 2023-04-21T09:36:14,215 According to the spec (see the link below), however, setuptools CANNOT 2023-04-21T09:36:14,215 consider this value unless `classifiers` is listed as `dynamic`. 2023-04-21T09:36:14,216 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-04-21T09:36:14,217 For the time being, `setuptools` will still consider the given value (as a 2023-04-21T09:36:14,217 **transitional** measure), but please note that future releases of setuptools will 2023-04-21T09:36:14,218 follow strictly the standard. 2023-04-21T09:36:14,218 To prevent this warning, you can list `classifiers` under `dynamic` or alternatively 2023-04-21T09:36:14,219 remove the `[project]` table from your file and rely entirely on other means of 2023-04-21T09:36:14,219 configuration. 2023-04-21T09:36:14,220 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-04-21T09:36:14,220 or your builds will no longer be supported. 2023-04-21T09:36:14,221 ******************************************************************************** 2023-04-21T09:36:14,222 !! 2023-04-21T09:36:14,222 _handle_missing_dynamic(dist, project_table) 2023-04-21T09:36:14,223 /tmp/pip-build-env-50z2g2rx/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:69: SetuptoolsWarning: `install_requires` overwritten in `pyproject.toml` (dependencies) 2023-04-21T09:36:14,223 corresp(dist, value, root_dir) 2023-04-21T09:36:14,367 Preparing metadata (pyproject.toml): finished with status 'done' 2023-04-21T09:36:14,383 Source in /tmp/pip-wheel-06xyezyj/auraloss_6407988618de451f845e6a95c07e265d has version 0.4.0, which satisfies requirement auraloss==0.4.0 from https://files.pythonhosted.org/packages/ec/55/2a3bbafa3e947b972c81f852c6c31cc359a21848908f2aabd35b34b532e9/auraloss-0.4.0.tar.gz 2023-04-21T09:36:14,385 Removed auraloss==0.4.0 from https://files.pythonhosted.org/packages/ec/55/2a3bbafa3e947b972c81f852c6c31cc359a21848908f2aabd35b34b532e9/auraloss-0.4.0.tar.gz from build tracker '/tmp/pip-build-tracker-z7xx40dr' 2023-04-21T09:36:14,400 Created temporary directory: /tmp/pip-unpack-d8b5orym 2023-04-21T09:36:14,401 Building wheels for collected packages: auraloss 2023-04-21T09:36:14,410 Created temporary directory: /tmp/pip-wheel-gx39mf7c 2023-04-21T09:36:14,411 Destination directory: /tmp/pip-wheel-gx39mf7c 2023-04-21T09:36:14,415 Building wheel for auraloss (pyproject.toml): started 2023-04-21T09:36:14,418 Running command Building wheel for auraloss (pyproject.toml) 2023-04-21T09:36:15,672 /tmp/pip-build-env-50z2g2rx/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `readme` defined outside of `pyproject.toml` would be ignored. 2023-04-21T09:36:15,673 !! 2023-04-21T09:36:15,674 ******************************************************************************** 2023-04-21T09:36:15,675 ########################################################################## 2023-04-21T09:36:15,675 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-04-21T09:36:15,675 ########################################################################## 2023-04-21T09:36:15,676 The following seems to be defined outside of `pyproject.toml`: 2023-04-21T09:36:15,677 `readme = '\n
\n\n# auraloss\n\n\n\nA collection of audio-focused loss functions in PyTorch. \n\n[[PDF](https://www.christiansteinmetz.com/s/DMRN15__auraloss__Audio_focused_loss_functions_in_PyTorch.pdf)]\n\n
\n\n## Setup\n\n```\npip install auraloss\n```\n\nIf you want to use `MelSTFTLoss()` or `FIRFilter()` you will need to specify the extra install (librosa and scipy).\n\n```\npip install auraloss[all]\n```\n\n## Usage\n\n```python\nimport torch\nimport auraloss\n\nmrstft = auraloss.freq.MultiResolutionSTFTLoss()\n\ninput = torch.rand(8,1,44100)\ntarget = torch.rand(8,1,44100)\n\nloss = mrstft(input, target)\n```\n\n**NEW**: Perceptual weighting with mel scaled spectrograms.\n\n```python\n\nbs = 8\nchs = 1\nseq_len = 131072\nsample_rate = 44100\n\n# some audio you want to compare\ntarget = torch.rand(bs, chs, seq_len)\npred = torch.rand(bs, chs, seq_len)\n\n# define the loss function\nloss_fn = auraloss.freq.MultiResolutionSTFTLoss(\n fft_sizes=[1024, 2048, 8192],\n hop_sizes=[256, 512, 2048],\n win_lengths=[1024, 2048, 8192],\n scale="mel",\n n_bins=128,\n sample_rate=sample_rate,\n perceptual_weighting=True,\n)\n\n# compute\nloss = loss_fn(pred, target)\n\n```\n\n## Citation\nIf you use this code in your work please consider citing us.\n```bibtex\n@inproceedings{steinmetz2020auraloss,\n title={auraloss: {A}udio focused loss functions in {PyTorch}},\n author={Steinmetz, Christian J. and Reiss, Joshua D.},\n booktitle={Digital Music Research Network One-day Workshop (DMRN+15)},\n year={2020}\n}\n```\n\n\n# Loss functions\n\nWe categorize the loss functions as either time-domain or frequency-domain approaches. \nAdditionally, we include perceptual transforms.\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
Loss functionInterfaceReference
Time domain
Error-to-signal ratio (ESR)auraloss.time.ESRLoss()Wright & Välimäki, 2019
DC error (DC)auraloss.time.DCLoss()Wright & Välimäki, 2019
Log hyperbolic cosine (Log-cosh)auraloss.time.LogCoshLoss()Chen et al., 2019
Signal-to-noise ratio (SNR)auraloss.time.SNRLoss()
Scale-invariant signal-to-distortion
ratio (SI-SDR)
auraloss.time.SISDRLoss()Le Roux et al., 2018
Scale-dependent signal-to-distortion
ratio (SD-SDR)
auraloss.time.SDSDRLoss()Le Roux et al., 2018
Frequency domain
Aggregate STFTauraloss.freq.STFTLoss()Arik et al., 2018
Aggregate Mel-scaled STFTauraloss.freq.MelSTFTLoss(sample_rate)
Multi-resolution STFTauraloss.freq.MultiResolutionSTFTLoss()Yamamoto et al., 2019*
Random-resolution STFTauraloss.freq.RandomResolutionSTFTLoss()Steinmetz & Reiss, 2020
Sum and difference STFT lossauraloss.freq.SumAndDifferenceSTFTLoss()Steinmetz et al., 2020
Perceptual transforms
Sum and difference signal transformauraloss.perceptual.SumAndDifference()
FIR pre-emphasis filtersauraloss.perceptual.FIRFilter()Wright & Välimäki, 2019
\n\n\\* [Wang et al., 2019](https://arxiv.org/abs/1904.12088) also propose a multi-resolution spectral loss (that [Engel et al., 2020](https://arxiv.org/abs/2001.04643) follow), \nbut they do not include both the log magnitude (L1 distance) and spectral convergence terms, introduced in [Arik et al., 2018](https://arxiv.org/abs/1808.0671), and then extended for the multi-resolution case in [Yamamoto et al., 2019](https://arxiv.org/abs/1910.11480).\n\n## Examples\n\nCurrently we include an example using a set of the loss functions to train a TCN for modeling an analog dynamic range compressor. \nFor details please refer to the details in [`examples/compressor`](examples/compressor). \nWe provide pre-trained models, evaluation scripts to compute the metrics in the [paper](https://www.christiansteinmetz.com/s/DMRN15__auraloss__Audio_focused_loss_functions_in_PyTorch.pdf), as well as scripts to retrain models. \n\nThere are some more advanced things you can do based upon the `STFTLoss` class. \nFor example, you can compute both linear and log scaled STFT errors as in [Engel et al., 2020](https://arxiv.org/abs/2001.04643).\nIn this case we do not include the spectral convergence term. \n```python\nstft_loss = auraloss.freq.STFTLoss(\n w_log_mag=1.0, \n w_lin_mag=1.0, \n w_sc=0.0,\n)\n```\n\nThere is also a Mel-scaled STFT loss, which has some special requirements. \nThis loss requires you set the sample rate as well as specify the correct device. \n```python\nsample_rate = 44100\nmelstft_loss = auraloss.freq.MelSTFTLoss(sample_rate, device="cuda")\n```\n\nYou can also build a multi-resolution Mel-scaled STFT loss with 64 bins easily. \nMake sure you pass the correct device where the tensors you are comparing will be. \n```python\nloss_fn = auraloss.freq.MultiResolutionSTFTLoss(\n scale="mel", \n n_bins=64,\n sample_rate=sample_rate,\n device="cuda"\n)\n```\n\nIf you are computing a loss on stereo audio you may want to consider the sum and difference (mid/side) loss. \nBelow we have shown an example of using this loss function with the perceptual weighting and mel scaling for \nfurther perceptual relevance. \n\n```python\n\ntarget = torch.rand(8, 2, 44100)\npred = torch.rand(8, 2, 44100)\n\nloss_fn = auraloss.freq.SumAndDifferenceSTFTLoss(\n fft_sizes=[1024, 2048, 8192],\n hop_sizes=[256, 512, 2048],\n win_lengths=[1024, 2048, 8192],\n perceptual_weighting=True,\n sample_rate=44100,\n scale="mel",\n n_bins=128,\n)\n\nloss = loss_fn(pred, target)\n```\n\n# Development\n\nRun tests locally with pytest. \n\n```python -m pytest```\n'` 2023-04-21T09:36:15,678 According to the spec (see the link below), however, setuptools CANNOT 2023-04-21T09:36:15,678 consider this value unless `readme` is listed as `dynamic`. 2023-04-21T09:36:15,679 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-04-21T09:36:15,679 For the time being, `setuptools` will still consider the given value (as a 2023-04-21T09:36:15,679 **transitional** measure), but please note that future releases of setuptools will 2023-04-21T09:36:15,680 follow strictly the standard. 2023-04-21T09:36:15,680 To prevent this warning, you can list `readme` under `dynamic` or alternatively 2023-04-21T09:36:15,681 remove the `[project]` table from your file and rely entirely on other means of 2023-04-21T09:36:15,681 configuration. 2023-04-21T09:36:15,682 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-04-21T09:36:15,682 or your builds will no longer be supported. 2023-04-21T09:36:15,682 ******************************************************************************** 2023-04-21T09:36:15,683 !! 2023-04-21T09:36:15,683 _handle_missing_dynamic(dist, project_table) 2023-04-21T09:36:16,293 running bdist_wheel 2023-04-21T09:36:16,332 running build 2023-04-21T09:36:16,333 running build_py 2023-04-21T09:36:16,346 creating build 2023-04-21T09:36:16,347 creating build/lib 2023-04-21T09:36:16,348 creating build/lib/auraloss 2023-04-21T09:36:16,351 copying auraloss/freq.py -> build/lib/auraloss 2023-04-21T09:36:16,357 copying auraloss/perceptual.py -> build/lib/auraloss 2023-04-21T09:36:16,361 copying auraloss/utils.py -> build/lib/auraloss 2023-04-21T09:36:16,364 copying auraloss/__init__.py -> build/lib/auraloss 2023-04-21T09:36:16,368 copying auraloss/time.py -> build/lib/auraloss 2023-04-21T09:36:16,372 copying auraloss/plotting.py -> build/lib/auraloss 2023-04-21T09:36:16,375 running egg_info 2023-04-21T09:36:16,396 writing auraloss.egg-info/PKG-INFO 2023-04-21T09:36:16,400 writing dependency_links to auraloss.egg-info/dependency_links.txt 2023-04-21T09:36:16,403 writing requirements to auraloss.egg-info/requires.txt 2023-04-21T09:36:16,406 writing top-level names to auraloss.egg-info/top_level.txt 2023-04-21T09:36:16,424 reading manifest file 'auraloss.egg-info/SOURCES.txt' 2023-04-21T09:36:16,428 adding license file 'LICENSE' 2023-04-21T09:36:16,433 writing manifest file 'auraloss.egg-info/SOURCES.txt' 2023-04-21T09:36:16,458 installing to build/bdist.linux-armv7l/wheel 2023-04-21T09:36:16,459 running install 2023-04-21T09:36:16,520 running install_lib 2023-04-21T09:36:16,532 creating build/bdist.linux-armv7l 2023-04-21T09:36:16,533 creating build/bdist.linux-armv7l/wheel 2023-04-21T09:36:16,537 creating build/bdist.linux-armv7l/wheel/auraloss 2023-04-21T09:36:16,539 copying build/lib/auraloss/freq.py -> build/bdist.linux-armv7l/wheel/auraloss 2023-04-21T09:36:16,544 copying build/lib/auraloss/perceptual.py -> build/bdist.linux-armv7l/wheel/auraloss 2023-04-21T09:36:16,549 copying build/lib/auraloss/utils.py -> build/bdist.linux-armv7l/wheel/auraloss 2023-04-21T09:36:16,553 copying build/lib/auraloss/__init__.py -> build/bdist.linux-armv7l/wheel/auraloss 2023-04-21T09:36:16,556 copying build/lib/auraloss/time.py -> build/bdist.linux-armv7l/wheel/auraloss 2023-04-21T09:36:16,561 copying build/lib/auraloss/plotting.py -> build/bdist.linux-armv7l/wheel/auraloss 2023-04-21T09:36:16,567 running install_egg_info 2023-04-21T09:36:16,576 Copying auraloss.egg-info to build/bdist.linux-armv7l/wheel/auraloss-0.4.0-py3.7.egg-info 2023-04-21T09:36:16,598 running install_scripts 2023-04-21T09:36:16,633 creating build/bdist.linux-armv7l/wheel/auraloss-0.4.0.dist-info/WHEEL 2023-04-21T09:36:16,638 creating '/tmp/pip-wheel-gx39mf7c/.tmp-kw8irjno/auraloss-0.4.0-py3-none-any.whl' and adding 'build/bdist.linux-armv7l/wheel' to it 2023-04-21T09:36:16,644 adding 'auraloss/__init__.py' 2023-04-21T09:36:16,652 adding 'auraloss/freq.py' 2023-04-21T09:36:16,656 adding 'auraloss/perceptual.py' 2023-04-21T09:36:16,659 adding 'auraloss/plotting.py' 2023-04-21T09:36:16,663 adding 'auraloss/time.py' 2023-04-21T09:36:16,666 adding 'auraloss/utils.py' 2023-04-21T09:36:16,674 adding 'auraloss-0.4.0.dist-info/LICENSE' 2023-04-21T09:36:16,678 adding 'auraloss-0.4.0.dist-info/METADATA' 2023-04-21T09:36:16,680 adding 'auraloss-0.4.0.dist-info/WHEEL' 2023-04-21T09:36:16,683 adding 'auraloss-0.4.0.dist-info/top_level.txt' 2023-04-21T09:36:16,685 adding 'auraloss-0.4.0.dist-info/RECORD' 2023-04-21T09:36:16,689 removing build/bdist.linux-armv7l/wheel 2023-04-21T09:36:16,702 /tmp/pip-build-env-50z2g2rx/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `requires-python` defined outside of `pyproject.toml` would be ignored. 2023-04-21T09:36:16,702 !! 2023-04-21T09:36:16,703 ******************************************************************************** 2023-04-21T09:36:16,703 ########################################################################## 2023-04-21T09:36:16,703 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-04-21T09:36:16,704 ########################################################################## 2023-04-21T09:36:16,704 The following seems to be defined outside of `pyproject.toml`: 2023-04-21T09:36:16,705 `requires-python = '>=3.6.0'` 2023-04-21T09:36:16,706 According to the spec (see the link below), however, setuptools CANNOT 2023-04-21T09:36:16,706 consider this value unless `requires-python` is listed as `dynamic`. 2023-04-21T09:36:16,706 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-04-21T09:36:16,707 For the time being, `setuptools` will still consider the given value (as a 2023-04-21T09:36:16,707 **transitional** measure), but please note that future releases of setuptools will 2023-04-21T09:36:16,708 follow strictly the standard. 2023-04-21T09:36:16,708 To prevent this warning, you can list `requires-python` under `dynamic` or alternatively 2023-04-21T09:36:16,709 remove the `[project]` table from your file and rely entirely on other means of 2023-04-21T09:36:16,709 configuration. 2023-04-21T09:36:16,710 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-04-21T09:36:16,710 or your builds will no longer be supported. 2023-04-21T09:36:16,711 ******************************************************************************** 2023-04-21T09:36:16,712 !! 2023-04-21T09:36:16,713 _handle_missing_dynamic(dist, project_table) 2023-04-21T09:36:16,713 /tmp/pip-build-env-50z2g2rx/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `license` defined outside of `pyproject.toml` would be ignored. 2023-04-21T09:36:16,713 !! 2023-04-21T09:36:16,714 ******************************************************************************** 2023-04-21T09:36:16,715 ########################################################################## 2023-04-21T09:36:16,715 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-04-21T09:36:16,716 ########################################################################## 2023-04-21T09:36:16,717 The following seems to be defined outside of `pyproject.toml`: 2023-04-21T09:36:16,718 `license = 'Apache License 2.0'` 2023-04-21T09:36:16,719 According to the spec (see the link below), however, setuptools CANNOT 2023-04-21T09:36:16,719 consider this value unless `license` is listed as `dynamic`. 2023-04-21T09:36:16,720 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-04-21T09:36:16,721 For the time being, `setuptools` will still consider the given value (as a 2023-04-21T09:36:16,721 **transitional** measure), but please note that future releases of setuptools will 2023-04-21T09:36:16,722 follow strictly the standard. 2023-04-21T09:36:16,723 To prevent this warning, you can list `license` under `dynamic` or alternatively 2023-04-21T09:36:16,723 remove the `[project]` table from your file and rely entirely on other means of 2023-04-21T09:36:16,723 configuration. 2023-04-21T09:36:16,724 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-04-21T09:36:16,725 or your builds will no longer be supported. 2023-04-21T09:36:16,725 ******************************************************************************** 2023-04-21T09:36:16,726 !! 2023-04-21T09:36:16,726 _handle_missing_dynamic(dist, project_table) 2023-04-21T09:36:16,727 /tmp/pip-build-env-50z2g2rx/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:62: _WouldIgnoreField: `classifiers` defined outside of `pyproject.toml` would be ignored. 2023-04-21T09:36:16,727 !! 2023-04-21T09:36:16,728 ******************************************************************************** 2023-04-21T09:36:16,729 ########################################################################## 2023-04-21T09:36:16,729 # configuration would be ignored/result in error due to `pyproject.toml` # 2023-04-21T09:36:16,729 ########################################################################## 2023-04-21T09:36:16,730 The following seems to be defined outside of `pyproject.toml`: 2023-04-21T09:36:16,731 `classifiers = ['License :: OSI Approved :: Apache Software License', 'Topic :: Multimedia :: Sound/Audio', 'Topic :: Scientific/Engineering']` 2023-04-21T09:36:16,732 According to the spec (see the link below), however, setuptools CANNOT 2023-04-21T09:36:16,732 consider this value unless `classifiers` is listed as `dynamic`. 2023-04-21T09:36:16,733 https://packaging.python.org/en/latest/specifications/declaring-project-metadata/ 2023-04-21T09:36:16,734 For the time being, `setuptools` will still consider the given value (as a 2023-04-21T09:36:16,734 **transitional** measure), but please note that future releases of setuptools will 2023-04-21T09:36:16,735 follow strictly the standard. 2023-04-21T09:36:16,736 To prevent this warning, you can list `classifiers` under `dynamic` or alternatively 2023-04-21T09:36:16,736 remove the `[project]` table from your file and rely entirely on other means of 2023-04-21T09:36:16,736 configuration. 2023-04-21T09:36:16,737 By 2023-Oct-30, you need to update your project and remove deprecated calls 2023-04-21T09:36:16,738 or your builds will no longer be supported. 2023-04-21T09:36:16,738 ******************************************************************************** 2023-04-21T09:36:16,739 !! 2023-04-21T09:36:16,740 _handle_missing_dynamic(dist, project_table) 2023-04-21T09:36:16,740 /tmp/pip-build-env-50z2g2rx/overlay/lib/python3.7/site-packages/setuptools/config/_apply_pyprojecttoml.py:69: SetuptoolsWarning: `install_requires` overwritten in `pyproject.toml` (dependencies) 2023-04-21T09:36:16,741 corresp(dist, value, root_dir) 2023-04-21T09:36:16,893 Building wheel for auraloss (pyproject.toml): finished with status 'done' 2023-04-21T09:36:16,905 Created wheel for auraloss: filename=auraloss-0.4.0-py3-none-any.whl size=16743 sha256=7a1cc7e12ae63baf01dc60eff48968f2530a27e9c92406a1872e3093f6a1e631 2023-04-21T09:36:16,907 Stored in directory: /tmp/pip-ephem-wheel-cache-3um992ww/wheels/b2/db/ba/14b09c9447dda8e1a8c9cacee675aba209815ff27271f45f99 2023-04-21T09:36:16,935 Successfully built auraloss 2023-04-21T09:36:16,943 Removed build tracker: '/tmp/pip-build-tracker-z7xx40dr'