theremin 0.0.6__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- theremin-0.0.6/LICENSE +21 -0
- theremin-0.0.6/PKG-INFO +87 -0
- theremin-0.0.6/README.md +67 -0
- theremin-0.0.6/setup.cfg +39 -0
- theremin-0.0.6/setup.py +3 -0
- theremin-0.0.6/theremin/__init__.py +47 -0
- theremin-0.0.6/theremin/audio.py +2122 -0
- theremin-0.0.6/theremin/audio_features.py +353 -0
- theremin-0.0.6/theremin/dag_audio_features.py +338 -0
- theremin-0.0.6/theremin/display.py +250 -0
- theremin-0.0.6/theremin/main.py +34 -0
- theremin-0.0.6/theremin/pipelines.py +318 -0
- theremin-0.0.6/theremin/script_utils.py +543 -0
- theremin-0.0.6/theremin/util.py +300 -0
- theremin-0.0.6/theremin/video_features.py +410 -0
- theremin-0.0.6/theremin.egg-info/PKG-INFO +87 -0
- theremin-0.0.6/theremin.egg-info/SOURCES.txt +21 -0
- theremin-0.0.6/theremin.egg-info/dependency_links.txt +1 -0
- theremin-0.0.6/theremin.egg-info/entry_points.txt +2 -0
- theremin-0.0.6/theremin.egg-info/not-zip-safe +1 -0
- theremin-0.0.6/theremin.egg-info/requires.txt +9 -0
- theremin-0.0.6/theremin.egg-info/top_level.txt +1 -0
theremin-0.0.6/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [year] [fullname]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
theremin-0.0.6/PKG-INFO
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: theremin
|
|
3
|
+
Version: 0.0.6
|
|
4
|
+
Summary: A video-to-sound theremin
|
|
5
|
+
Home-page: https://github.com/thorwhalen/theremin
|
|
6
|
+
Author: Thor Whalen
|
|
7
|
+
License: mit
|
|
8
|
+
Platform: any
|
|
9
|
+
Description-Content-Type: text/markdown
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Requires-Dist: dol
|
|
12
|
+
Requires-Dist: i2
|
|
13
|
+
Requires-Dist: cw
|
|
14
|
+
Requires-Dist: meshed
|
|
15
|
+
Requires-Dist: opencv-python
|
|
16
|
+
Requires-Dist: hum
|
|
17
|
+
Requires-Dist: mediapipe
|
|
18
|
+
Provides-Extra: testing
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# theremin
|
|
22
|
+
|
|
23
|
+
A video-to-sound theremin.
|
|
24
|
+
|
|
25
|
+
To install: ```pip install theremin```
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# About this project
|
|
29
|
+
|
|
30
|
+
The theremin, an iconic electronic musical instrument invented in the 1920s by [Léon Theremin](https://www.youtube.com/watch?v=w5qf9O6c20o), is played without physical contact, using hand movements to control pitch and volume through electromagnetic fields.
|
|
31
|
+
|
|
32
|
+
Today, with advancements in digital sensors, AI-based models for real-time sensor data processing, and sophisticated audio generation tools, there is an unprecedented opportunity to generalize the theremin’s concept into a flexible framework and platform. This initiative, the theremin Project, aims to explore the sonification of physical activity, opening new avenues for musical expression.
|
|
33
|
+
|
|
34
|
+
Musical instruments are fundamentally devices that translate physical interactions into sound. The physical properties of an instrument—be it the strings of a violin or the keys of a piano—not only shape the sound produced but also influence how musicians interact with them. These interactions impose constraints that, far from being restrictive, inspire and guide creativity in profound ways. The theremin Project leverages modern digital technologies to expand this paradigm, enabling users to explore countless ways to produce sound through movement. By mapping visual cues (e.g., gestures, facial expressions), tactile inputs, or even audio signals (e.g., sounds from objects or voice) to sound, the project empowers users to create entirely new instruments, each with its own creative constraints ripe for exploration.
|
|
35
|
+
|
|
36
|
+
The complexity of these mappings introduces a learning curve, but also vast creative potential. A key advantage of the project’s flexible mapping approach is its adaptability: complex mappings can be simplified for beginners to quickly express themselves, with the option to gradually increase complexity as their skills develop. This scalability bridges the spectrum of musical expression, from effortless AI-generated music—where anyone can create high-quality songs with minimal input—to the nuanced, skill-intensive artistry of acoustic instruments. While AI-driven tools risk flooding the music space with low-effort content, the theremin Project seeks to explore the middle ground, fostering tools that balance accessibility with expressive depth.
|
|
37
|
+
|
|
38
|
+
Consider the extremes: on one end, AI allows someone with no musical training to generate a song by clicking a button or describing its style, offering high quality but limited personal expressivity. On the other, acoustic instruments demand years of practice to unlock their full potential, rewarding players with profound expressive control. The theremin Project envisions a platform where users can navigate this spectrum, creating instruments that adapt to their abilities while encouraging growth. By providing intuitive tools to map movement to sound, the project aims to democratize musical expression, uncover novel modes of creativity, and inspire a new generation of digital instruments.
|
|
39
|
+
|
|
40
|
+
Along with advancements in Music AI, we should be able to explore a large range of possibilities of expressive control. One point on this spectrum would be to take an existing piece of music, and direct many aspects of it's rendition via visual cues, like a conductor (which was one of the candidate names for this project, along with maestro, director, and orchestrator -- all already taken on pypi, the repository of all python packages).
|
|
41
|
+
|
|
42
|
+
The theremin project is a bold step toward this future, inviting exploration of the vast possibilities at the intersection of movement, sound, and technology.
|
|
43
|
+
|
|
44
|
+
## Work in Progress
|
|
45
|
+
|
|
46
|
+
The objective of this project is to enable users to easily make mappings between sensors and sound,
|
|
47
|
+
in such a way that is advantageous for whatever their goal is:
|
|
48
|
+
playing music, learning how to play music, making some sound producing installation, sonifying some data stream, etc.
|
|
49
|
+
|
|
50
|
+
Note that here were's starting with video and keyboard as the main "sensors", but the plan is to generalize this to all possible streams of input control.
|
|
51
|
+
One of the main targets being controlling via sound itself.
|
|
52
|
+
That is, giving our sound producing system the ability to hear as well.
|
|
53
|
+
This, we hope, will open up many interesting abilities when paired with AI music gen, both for education and for improvisation.
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## A few links:
|
|
57
|
+
|
|
58
|
+
See Leon theremin [playing his own instrument](https://www.youtube.com/watch?v=w5qf9O6c20o),
|
|
59
|
+
or also here, [playing "Deep Night" (1930)](https://www.youtube.com/watch?v=WhR2e9ab-Uw).
|
|
60
|
+
The first one I even heard:
|
|
61
|
+
[Samuel Hoffman playing "over the rainbox"](https://www.youtube.com/watch?v=K6KbEnGnymk).
|
|
62
|
+
Someone might complain if I don't mention Led's Zepplin's Jimmy Page... [playing around](https://www.youtube.com/watch?v=KPhXm-UPfEU) with a theremin -- but personally, though I appreciate the exploration, I don't consider it as being "playing the theremin".
|
|
63
|
+
|
|
64
|
+
<img width="700" height="700" alt="theremin_processing_pipeline" src="https://github.com/user-attachments/assets/2b3e7874-9ca6-456d-ad70-89234f9d6e4a" />
|
|
65
|
+
|
|
66
|
+
# Old "about"
|
|
67
|
+
|
|
68
|
+
The objective of this project is to make "instruments" that work like a theremin, that is, whereby the features of the sounds produced are controlled by the position of the left and right hand.
|
|
69
|
+
|
|
70
|
+
That, but generalized.
|
|
71
|
+
A theremin is an analog device that whose sound is parametrized by two features only:
|
|
72
|
+
Pitch and volume, respectively controlled by the left and right hand; the
|
|
73
|
+
distance from the device's sensor determines the pitch and volume of the sound produced.
|
|
74
|
+
|
|
75
|
+
Here, though, we'll use video as our sensor (and will consider more kinds of sensors later): So we can not only detect the positions of the hands, but also the positions of the fingers, and the angles between them,
|
|
76
|
+
detect gestures, and so on. Further, we can use the facial expressions to add to
|
|
77
|
+
the parametrization of the sound produced.
|
|
78
|
+
|
|
79
|
+
What the project wants to grow up to be is a platform for creating musical instruments
|
|
80
|
+
that are controlled by the body, enabling the user to determine the mapping between
|
|
81
|
+
the video stream and the sound produced.
|
|
82
|
+
We hope this will enable the creation of new musical instruments that are more
|
|
83
|
+
intuitive and expressive than the traditional theremin.
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
theremin-0.0.6/README.md
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# theremin
|
|
2
|
+
|
|
3
|
+
A video-to-sound theremin.
|
|
4
|
+
|
|
5
|
+
To install: ```pip install theremin```
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# About this project
|
|
9
|
+
|
|
10
|
+
The theremin, an iconic electronic musical instrument invented in the 1920s by [Léon Theremin](https://www.youtube.com/watch?v=w5qf9O6c20o), is played without physical contact, using hand movements to control pitch and volume through electromagnetic fields.
|
|
11
|
+
|
|
12
|
+
Today, with advancements in digital sensors, AI-based models for real-time sensor data processing, and sophisticated audio generation tools, there is an unprecedented opportunity to generalize the theremin’s concept into a flexible framework and platform. This initiative, the theremin Project, aims to explore the sonification of physical activity, opening new avenues for musical expression.
|
|
13
|
+
|
|
14
|
+
Musical instruments are fundamentally devices that translate physical interactions into sound. The physical properties of an instrument—be it the strings of a violin or the keys of a piano—not only shape the sound produced but also influence how musicians interact with them. These interactions impose constraints that, far from being restrictive, inspire and guide creativity in profound ways. The theremin Project leverages modern digital technologies to expand this paradigm, enabling users to explore countless ways to produce sound through movement. By mapping visual cues (e.g., gestures, facial expressions), tactile inputs, or even audio signals (e.g., sounds from objects or voice) to sound, the project empowers users to create entirely new instruments, each with its own creative constraints ripe for exploration.
|
|
15
|
+
|
|
16
|
+
The complexity of these mappings introduces a learning curve, but also vast creative potential. A key advantage of the project’s flexible mapping approach is its adaptability: complex mappings can be simplified for beginners to quickly express themselves, with the option to gradually increase complexity as their skills develop. This scalability bridges the spectrum of musical expression, from effortless AI-generated music—where anyone can create high-quality songs with minimal input—to the nuanced, skill-intensive artistry of acoustic instruments. While AI-driven tools risk flooding the music space with low-effort content, the theremin Project seeks to explore the middle ground, fostering tools that balance accessibility with expressive depth.
|
|
17
|
+
|
|
18
|
+
Consider the extremes: on one end, AI allows someone with no musical training to generate a song by clicking a button or describing its style, offering high quality but limited personal expressivity. On the other, acoustic instruments demand years of practice to unlock their full potential, rewarding players with profound expressive control. The theremin Project envisions a platform where users can navigate this spectrum, creating instruments that adapt to their abilities while encouraging growth. By providing intuitive tools to map movement to sound, the project aims to democratize musical expression, uncover novel modes of creativity, and inspire a new generation of digital instruments.
|
|
19
|
+
|
|
20
|
+
Along with advancements in Music AI, we should be able to explore a large range of possibilities of expressive control. One point on this spectrum would be to take an existing piece of music, and direct many aspects of it's rendition via visual cues, like a conductor (which was one of the candidate names for this project, along with maestro, director, and orchestrator -- all already taken on pypi, the repository of all python packages).
|
|
21
|
+
|
|
22
|
+
The theremin project is a bold step toward this future, inviting exploration of the vast possibilities at the intersection of movement, sound, and technology.
|
|
23
|
+
|
|
24
|
+
## Work in Progress
|
|
25
|
+
|
|
26
|
+
The objective of this project is to enable users to easily make mappings between sensors and sound,
|
|
27
|
+
in such a way that is advantageous for whatever their goal is:
|
|
28
|
+
playing music, learning how to play music, making some sound producing installation, sonifying some data stream, etc.
|
|
29
|
+
|
|
30
|
+
Note that here were's starting with video and keyboard as the main "sensors", but the plan is to generalize this to all possible streams of input control.
|
|
31
|
+
One of the main targets being controlling via sound itself.
|
|
32
|
+
That is, giving our sound producing system the ability to hear as well.
|
|
33
|
+
This, we hope, will open up many interesting abilities when paired with AI music gen, both for education and for improvisation.
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## A few links:
|
|
37
|
+
|
|
38
|
+
See Leon theremin [playing his own instrument](https://www.youtube.com/watch?v=w5qf9O6c20o),
|
|
39
|
+
or also here, [playing "Deep Night" (1930)](https://www.youtube.com/watch?v=WhR2e9ab-Uw).
|
|
40
|
+
The first one I even heard:
|
|
41
|
+
[Samuel Hoffman playing "over the rainbox"](https://www.youtube.com/watch?v=K6KbEnGnymk).
|
|
42
|
+
Someone might complain if I don't mention Led's Zepplin's Jimmy Page... [playing around](https://www.youtube.com/watch?v=KPhXm-UPfEU) with a theremin -- but personally, though I appreciate the exploration, I don't consider it as being "playing the theremin".
|
|
43
|
+
|
|
44
|
+
<img width="700" height="700" alt="theremin_processing_pipeline" src="https://github.com/user-attachments/assets/2b3e7874-9ca6-456d-ad70-89234f9d6e4a" />
|
|
45
|
+
|
|
46
|
+
# Old "about"
|
|
47
|
+
|
|
48
|
+
The objective of this project is to make "instruments" that work like a theremin, that is, whereby the features of the sounds produced are controlled by the position of the left and right hand.
|
|
49
|
+
|
|
50
|
+
That, but generalized.
|
|
51
|
+
A theremin is an analog device that whose sound is parametrized by two features only:
|
|
52
|
+
Pitch and volume, respectively controlled by the left and right hand; the
|
|
53
|
+
distance from the device's sensor determines the pitch and volume of the sound produced.
|
|
54
|
+
|
|
55
|
+
Here, though, we'll use video as our sensor (and will consider more kinds of sensors later): So we can not only detect the positions of the hands, but also the positions of the fingers, and the angles between them,
|
|
56
|
+
detect gestures, and so on. Further, we can use the facial expressions to add to
|
|
57
|
+
the parametrization of the sound produced.
|
|
58
|
+
|
|
59
|
+
What the project wants to grow up to be is a platform for creating musical instruments
|
|
60
|
+
that are controlled by the body, enabling the user to determine the mapping between
|
|
61
|
+
the video stream and the sound produced.
|
|
62
|
+
We hope this will enable the creation of new musical instruments that are more
|
|
63
|
+
intuitive and expressive than the traditional theremin.
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
theremin-0.0.6/setup.cfg
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[metadata]
|
|
2
|
+
name = theremin
|
|
3
|
+
version = 0.0.6
|
|
4
|
+
url = https://github.com/thorwhalen/theremin
|
|
5
|
+
platforms = any
|
|
6
|
+
description_file = README.md
|
|
7
|
+
root_url = https://github.com/thorwhalen/
|
|
8
|
+
license = mit
|
|
9
|
+
author = Thor Whalen
|
|
10
|
+
description = A video-to-sound theremin
|
|
11
|
+
long_description = file:README.md
|
|
12
|
+
long_description_content_type = text/markdown
|
|
13
|
+
keywords =
|
|
14
|
+
display_name = theremin
|
|
15
|
+
|
|
16
|
+
[options]
|
|
17
|
+
packages = find:
|
|
18
|
+
include_package_data = True
|
|
19
|
+
zip_safe = False
|
|
20
|
+
install_requires =
|
|
21
|
+
dol
|
|
22
|
+
i2
|
|
23
|
+
cw
|
|
24
|
+
meshed
|
|
25
|
+
opencv-python
|
|
26
|
+
hum
|
|
27
|
+
mediapipe
|
|
28
|
+
|
|
29
|
+
[options.entry_points]
|
|
30
|
+
console_scripts =
|
|
31
|
+
theremin = theremin.main:dispatched_theremin_cli
|
|
32
|
+
|
|
33
|
+
[options.extras_require]
|
|
34
|
+
testing =
|
|
35
|
+
|
|
36
|
+
[egg_info]
|
|
37
|
+
tag_build =
|
|
38
|
+
tag_date = 0
|
|
39
|
+
|
theremin-0.0.6/setup.py
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"""
|
|
2
|
+
|
|
3
|
+
The objective of this project is to make "instruments" that work like a theremin,
|
|
4
|
+
that is, whereby the features of the sounds produced are controlled by the position of
|
|
5
|
+
the left and right hand.
|
|
6
|
+
|
|
7
|
+
That, but generalized.
|
|
8
|
+
A theremin is an analog device that whose sound is parametrized by two features only:
|
|
9
|
+
Pitch and volume, respectively controlled by the left and right hand; the
|
|
10
|
+
distance from the device's sensor determines the pitch and volume of the sound produced.
|
|
11
|
+
|
|
12
|
+
Here, though, we'll use video as our sensor, so we can not only detect the positions
|
|
13
|
+
of the hands, but also the positions of the fingers, and the angles between them,
|
|
14
|
+
detect gestures, and so on. Further, we can use the facial expressions to add to
|
|
15
|
+
the parametrization of the sound produced.
|
|
16
|
+
|
|
17
|
+
What the project wants to grow up to be is a platform for creating musical instruments
|
|
18
|
+
that are controlled by the body, enabling the user to determine the mapping between
|
|
19
|
+
the video stream and the sound produced.
|
|
20
|
+
We hope this will enable the creation of new musical instruments that are more
|
|
21
|
+
intuitive and expressive than the traditional theremin.
|
|
22
|
+
|
|
23
|
+
Right now, the project is very much in its infancy, and we're just trying to get the
|
|
24
|
+
basics working.
|
|
25
|
+
|
|
26
|
+
Here's a bit about what exists so far:
|
|
27
|
+
|
|
28
|
+
* _03_hand_gesture_recognition_with_video_feedback.py: Detects hand gestures and overlays
|
|
29
|
+
the detected landmarks and categories on the video stream in real-time.
|
|
30
|
+
* _06_hand_gesture_w_slabs.py: The same, but using slabs, for a better framework setup
|
|
31
|
+
* _05_a_wrist_lines.py: Draws lines showing the wrist position on the video stream
|
|
32
|
+
in real-time.
|
|
33
|
+
* _07_wrist_lines_w_sound.py: Draws lines showing the wrist position on the video stream
|
|
34
|
+
and produces sound based on the wrist position. The resulting sound is horrible though,
|
|
35
|
+
due to the lack of a proper real-time setup (I believe). The sound produced is
|
|
36
|
+
produced in realtime, but only a small waveform chunk is produced.
|
|
37
|
+
It's choppy.
|
|
38
|
+
**We need to buffer the stream of sound features and have an independent process that
|
|
39
|
+
reads from the buffer and produces the sound, taking more than one chunk of
|
|
40
|
+
information to determine the sound produced.**
|
|
41
|
+
* _08_keyboard_theremin.py: To reduce the complexity of the sound produced, this script
|
|
42
|
+
uses a keyboard to produce sound, with the pitch and volume controlled by the
|
|
43
|
+
left and right hand, respectively. This doesn't work well at all. More work is needed.
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
"""
|