Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Removed `play_chord`, `play_error_sound` and `play_finish_sound` functions. As a consequence `sox` has become a redundant dependency, thus it has been removed.

Julian van Doornf79948348cdb
diff --git a/.github/manimdependency.json b/.github/manimdependency.json
index e8f89d51c..4fe0447ed 100644
--- a/.github/manimdependency.json
+++ b/.github/manimdependency.json
@@ -1,6 +1,5 @@
{
"windows": {
- "sox": "sox-14.4.2-win32",
"ffmpeg": "https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-4.3.1-2020-09-16-full_build.zip"
}
}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 4ba9fded8..1a738aefb 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -56,7 +56,7 @@ jobs:
- name: Install system dependencies (MacOS)
if: runner.os == 'macOS'
run: |
- brew install openssl readline ffmpeg sox pyenv pyenv-virtualenv
+ brew install openssl readline ffmpeg pyenv pyenv-virtualenv
brew cask install basictex
eval "$(/usr/libexec/path_helper -s)"
sudo tlmgr update --self
@@ -70,13 +70,11 @@ jobs:
uses: actions/cache@v2
with:
path: ${{ github.workspace }}\ManimCache
- key: ${{ runner.os }}-dependencies-ffmpeg-sox-tinytex-${{ hashFiles('.github/manimdependency.json') }}-${{ steps.pip-cache-and-time.outputs.date }}
+ key: ${{ runner.os }}-dependencies-ffmpeg-tinytex-${{ hashFiles('.github/manimdependency.json') }}-${{ steps.pip-cache-and-time.outputs.date }}
- name: Download system dependencies (Windows)
if: runner.os == 'Windows' && steps.cache-windows.outputs.cache-hit != 'true'
run: |
- $soxVersion = python -c "import json;print(json.load(open('.github/manimdependency.json'))['windows']['sox'])"
- $soxVersionNumber = python -c "import json;print(json.load(open('.github/manimdependency.json'))['windows']['sox'].split('-')[1])"
$ffmpegUrl = python -c "import json;print(json.load(open('.github/manimdependency.json'))['windows']['ffmpeg'])"
$OriPath = $env:PATH
echo "Install Tinytex"
@@ -86,10 +84,7 @@ jobs:
tlmgr update --self
tlmgr install standalone preview doublestroke ms setspace rsfs relsize ragged2e fundus-calligra microtype wasysym physics dvisvgm jknapltx wasy cm-super babel-english
$env:PATH=$OriPath
- echo "Completed Latex Install Sox"
- Invoke-WebRequest "https://downloads.sourceforge.net/project/sox/sox/$($soxVersionNumber)/$($soxVersion).zip" -UserAgent "wget" -O "$($env:TMP)\SoX.zip"
- 7z x "$($env:TMP)\SoX.zip" -o"$($PWD)\ManimCache"
- Move-Item "ManimCache\sox-*" "ManimCache\SoX"
+ echo "Completed Latex"
Invoke-WebRequest "$ffmpegUrl" -O "$($env:TMP)\ffmpeg.zip"
7z x "$($env:TMP)\ffmpeg.zip" -o"$($PWD)\ManimCache"
Move-Item "ManimCache\ffmpeg-*" "ManimCache\FFmpeg"
@@ -99,7 +94,6 @@ jobs:
run: |
$env:Path += ";" + "$($PWD)\ManimCache\FFmpeg\bin"
$env:Path += ";" + "$($PWD)\ManimCache\LatexWindows\TinyTeX\bin\win32"
- $env:Path += ";" + "$($PWD)\ManimCache\SoX"
$env:Path = "$env:USERPROFILE\.poetry\bin;$($env:PATH)"
echo "::set-env name=Path::$env:Path"
diff --git a/docs/source/installation/linux.rst b/docs/source/installation/linux.rst
index c2299e739..18bcb7e9b 100644
--- a/docs/source/installation/linux.rst
+++ b/docs/source/installation/linux.rst
@@ -9,7 +9,6 @@ instructions in `Certifying a clean install`_.
The two necessary dependencies are cairo and ffmpeg. LaTeX is strongly
recommended, as it is necessary to have access to the ``Tex`` and ``MathTex`` classes.
-Sox is only required if you want manim to play sounds when rendering scenes.
Ubuntu/Debian
*************
@@ -40,12 +39,6 @@ To install LaTeX:
sudo apt install texlive texlive-latex-extra texlive-fonts-extra \
texlive-latex-recommended texlive-science texlive-fonts-extra tipa
-To install Sox (optional):
-
-.. code-block:: bash
-
- sudo apt install sox
-
.. note:: These instructions are also valid for other Debian-based
distributions or distributions that use the ``apt`` package manager.
@@ -72,11 +65,6 @@ To install LaTeX:
sudo pacman -S texlive-most
-To install Sox (optional):
-
-.. code-block:: bash
-
- sudo pacman -S sox
.. note:: These instructions are also valid for other Arch-based
distributions or distributions that use the ``pacman`` package
@@ -89,8 +77,7 @@ Certifying a clean install
To check that all dependencies have been installed properly, you can execute
the commands ``ffmpeg -version`` and ``latex``. (If LaTeX is installed
properly, you will be taken to a command-line program that captures your
-cursor. Press CTRL+C to exit.) To check that Sox is installed correctly,
-simply run ``sox``.
+cursor. Press CTRL+C to exit.)
.. note:: Note the LaTeX installation may take up a lot of space. The manim
community developers are currently working on providing a simpler,
diff --git a/docs/source/installation/mac.rst b/docs/source/installation/mac.rst
index f1ec6aa8d..25064a4c1 100644
--- a/docs/source/installation/mac.rst
+++ b/docs/source/installation/mac.rst
@@ -21,12 +21,6 @@ To install ffmpeg:
brew install ffmpeg
-To install Sox (optional):
-
-.. code-block:: bash
-
- brew install sox
-
To install LaTeX:
.. code-block:: bash
@@ -64,7 +58,7 @@ To check that all dependencies have been installed properly, you can execute
the commands ``ffmpeg -version`` and ``latex`` (regardless of whether you
installed MacTeX or BasicTeX). If LaTeX is installed properly, you will be
taken to a command-line program that captures your cursor. Press CTRL+C to
-exit. To check that Sox is installed correctly, simply run ``sox``.
+exit.
After making sure you have a clean install, you can go back to
:ref:`installing-manim`.
diff --git a/docs/source/installation/win.rst b/docs/source/installation/win.rst
index 29e9ca098..6700179c2 100644
--- a/docs/source/installation/win.rst
+++ b/docs/source/installation/win.rst
@@ -28,14 +28,6 @@ FFmpeg installation
environment variable and running ``ffmpeg``.
-Sox installation (optional)
-***************************
-
-1. To install Sox, execute ``choco install sox.portable``.
-
-2. You can check if you did it right by running ``refreshenv`` to update your
- environment variable and running ``sox``.
-
.. _latex-installation:
LaTeX Installation
diff --git a/docs/source/tutorials/configuration.rst b/docs/source/tutorials/configuration.rst
index a87ee8dd7..3f3db0daa 100644
--- a/docs/source/tutorials/configuration.rst
+++ b/docs/source/tutorials/configuration.rst
@@ -46,7 +46,7 @@ The output looks as follows.
.. testoutput::
:options: -ELLIPSIS, +NORMALIZE_WHITESPACE
- usage: manim [-h] [-o OUTPUT_FILE] [-p] [-f] [--sound] [--leave_progress_bars]
+ usage: manim [-h] [-o OUTPUT_FILE] [-p] [-f] [--leave_progress_bars]
[-a] [-w] [-s] [-g] [-i] [--disable_caching] [--flush_cache]
[--log_to_file] [-c BACKGROUND_COLOR]
[--background_opacity BACKGROUND_OPACITY] [--media_dir MEDIA_DIR]
@@ -72,7 +72,6 @@ The output looks as follows.
-p, --preview Automatically open the saved file once its done
-f, --show_in_file_browser
Show the output file in the File Browser
- --sound Play a success/failure sound
--leave_progress_bars
Leave progress bars displayed in terminal
-a, --write_all Write all the scenes from a file
diff --git a/manim/__main__.py b/manim/__main__.py
index fc1055183..2450229bc 100644
--- a/manim/__main__.py
+++ b/manim/__main__.py
@@ -17,7 +17,6 @@ from .utils.module_ops import (
get_scenes_to_render,
)
from .scene.scene import Scene
-from .utils.sounds import play_error_sound, play_finish_sound
from .utils.file_ops import open_file as open_media_file
from .grpc.impl import frame_server_impl
@@ -73,7 +72,6 @@ def main():
module = get_module(file_writer_config["input_file"])
all_scene_classes = get_scene_classes_from_module(module)
scene_classes_to_render = get_scenes_to_render(all_scene_classes)
- sound_on = file_writer_config["sound"]
for SceneClass in scene_classes_to_render:
try:
if camera_config["use_js_renderer"]:
@@ -82,15 +80,10 @@ def main():
scene = SceneClass()
scene.render()
open_file_if_needed(scene.file_writer)
- if sound_on:
- play_finish_sound()
except Exception:
print("\n\n")
traceback.print_exc()
print("\n\n")
- if not camera_config["use_js_renderer"]:
- if sound_on:
- play_error_sound()
if __name__ == "__main__":
diff --git a/manim/config/config_utils.py b/manim/config/config_utils.py
index b85efa55e..c993c600d 100644
--- a/manim/config/config_utils.py
+++ b/manim/config/config_utils.py
@@ -52,7 +52,6 @@ def _parse_file_writer_config(config_parser, args):
for boolean_opt in [
"preview",
"show_in_file_browser",
- "sound",
"leave_progress_bars",
"write_to_movie",
"save_last_frame",
@@ -236,12 +235,6 @@ def _parse_cli(arg_list, input=True):
const=True,
help="Show the output file in the File Browser",
)
- parser.add_argument(
- "--sound",
- action="store_const",
- const=True,
- help="Play a success/failure sound",
- )
parser.add_argument(
"--leave_progress_bars",
action="store_const",
diff --git a/manim/config/default.cfg b/manim/config/default.cfg
index 45e67d121..7d8b057f8 100644
--- a/manim/config/default.cfg
+++ b/manim/config/default.cfg
@@ -42,9 +42,6 @@ verbosity = INFO
# --progress_bar
progress_bar = True
-# --sound
-sound = False
-
# -o, --output_file
output_file =
diff --git a/manim/scene/scene_file_writer.py b/manim/scene/scene_file_writer.py
index efc5dcd79..bbe86b609 100644
--- a/manim/scene/scene_file_writer.py
+++ b/manim/scene/scene_file_writer.py
@@ -25,7 +25,7 @@ from ..utils.sounds import get_full_sound_file_path
class SceneFileWriter(object):
"""
SceneFileWriter is the object that actually writes the animations
- played, into video files, using FFMPEG, and Sox, if sound is needed.
+ played, into video files, using FFMPEG.
This is mostly for Manim's internal use. You will rarely, if ever,
have to use the methods for this class, unless tinkering with the very
fabric of Manim's reality.
diff --git a/manim/utils/sounds.py b/manim/utils/sounds.py
index dd46294d9..84d587b57 100644
--- a/manim/utils/sounds.py
+++ b/manim/utils/sounds.py
@@ -1,9 +1,6 @@
"""Sound-related utility functions."""
__all__ = [
- "play_chord",
- "play_error_sound",
- "play_finish_sound",
"get_full_sound_file_path",
]
@@ -12,32 +9,7 @@ import os
from ..utils.file_ops import seek_full_path_from_defaults
-def play_chord(*nums):
- commands = (
- [
- "play",
- "-n",
- "-c1",
- "--no-show-progress",
- "synth",
- ]
- + ["sin %-" + str(num) for num in nums]
- + ["fade h 0.5 1 0.5", ">", os.devnull]
- )
- try:
- os.system(" ".join(commands))
- except:
- pass
-
-
-def play_error_sound():
- play_chord(11, 8, 6, 1)
-
-
-def play_finish_sound():
- play_chord(12, 9, 5, 2)
-
-
+# Still in use by add_sound() function in scene_file_writer.py
def get_full_sound_file_path(sound_file_name):
return seek_full_path_from_defaults(
sound_file_name,