Skip to main content

audio-mouse

Control mouse with audio input.

This project is intended to use a guitar as an input source and use the notes played on it to simulate mouse movements. But you can always use your voice and control the mouse movements as long as you can hit those pitches which are configured to trigger the mouse events

Install

pip install audio-mouse

Examples

Basic example

from mouse import LineIn, Mouse


def main():
    line_in = LineIn()
    mouse_handler = Mouse()

    stream = line_in.record()
    line_in.detect_pitch(mouse_handler, stream)


if __name__ == "__main__":
    main()

Configuring notes/pitches

You can configure the notes you want to act as trigger for specific mouse movements for example, you can configure that when a pitch of A2 is played the mouse pointer moves up etc.

from mouse import LineIn, Mouse


def main():
    line_in = LineIn()
    mouse_handler = Mouse()

    mouse_handler.UP = "A2"
    mouse_handler.DOWN = "B2"
    mouse_handler.RIGHT = "G3"
    # Events that are not configured will use the defaults (check constants.py)

    stream = line_in.record()
    line_in.detect_pitch(mouse_handler, stream)


if __name__ == "__main__":
    main()

Configuring X/Y mouse speed

you can configure Mouse.MOUSE_X and Mouse.MOUSE_Y to update the speed of the mouse.

from mouse import LineIn, Mouse


def main():
    line_in = LineIn()
    mouse_handler = Mouse()

    mouse_handler.MOUSE_X = 10
    mouse_handler.MOUSE_Y = 10

    stream = line_in.record()
    line_in.detect_pitch(mouse_handler, stream)


if __name__ == "__main__":
    main()

In action

Checkout the 30 seconds video linked below for a demo. I've played few of the notes from the major pentatonic scale on 5th fret of a guitar and each note is a mouse event.

https://imgur.com/a/ECJwEFy

Scribbles

Looks like we can make a visual representation of what we play and speak and use it for some analysis maybe? IDK. Play something and without listening to it one can visually analyze some patterns maybe? Can make a note transcriber. Maybe something like converting the recorded pitches to notes and then tabs? IDK

License

MIT

Metadata

Release files for audio-mouse 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for audio-mouse 1.0.2
File Size Uploaded Provenance Actions
audio-mouse-1.0.2.tar.gz 4.0 kB Without provenance Details for audio-mouse-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for audio-mouse 1.0.2
File Interpreter ABI Platform Actions
audio_mouse-1.0.2-py3-none-any.whl Python 3 none any Details for audio_mouse-1.0.2-py3-none-any.whl

Total release size: 9.4 kB

Release files / audio-mouse-1.0.2.tar.gz

Download URL audio-mouse-1.0.2.tar.gz
Size 4.0 kB
Tags Source
SHA-256 checksum
How to use checksums
16cc21b0e1b8471786196804c2c9e56e76d20443ac64227d8f42c193af01afbf
BLAKE2b-256 checksum
How to use checksums
835e063347772e3bdf7272a10d454a8d8dee838441d121fcc9ae0beef83bbfcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.0

Release files / audio_mouse-1.0.2-py3-none-any.whl

Download URL audio_mouse-1.0.2-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
399f6594498c5e8bf67f3f1c1a779e715b5104d6f82898659f7f0d6b227e87e8
BLAKE2b-256 checksum
How to use checksums
1b49c9e9dc8c867d7747448489ce7b7e2c2520bc3f2d99d6142ceeb1b67f64c5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.0

Security for audio-mouse 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page