Skip to main content

Galaxie Audio is a height level wrapper for pyaudio, with player, recorder, spectrogram, etc ...

Project description

Documentation Status Pipeline Status Coverage Status

Galaxie Audio documentation

https://galaxie-audio.readthedocs.io/en/latest/_images/logo_galaxie.png

Description

A small Audio library, use by Galaxie Tools for play and record audio.

Screenshots

v 0.2

https://galaxie-audio.readthedocs.io/en/latest/_images/screen_01.png

Text Spectrogram

https://galaxie-audio.readthedocs.io/en/latest/_images/screen_02.png

Installation via pip

Pypi

pip install galaxie-audio

Pypi Test

pip install -i https://test.pypi.org/simple/ galaxie-audio

Exemple

# Require when you haven't GLXRadio as default Package
current_dir = os.path.dirname(os.path.abspath(__file__))
sys.path.append(os.path.dirname(current_dir))

from GLXAudio.AudioRecorder import AudioRecorder
from GLXAudio.AudioPlayer import AudioPLayer
from GLXAudio.AudioInterfaces import AudioInterfaces
from GLXAudio.AudioConstants import GLXAUDIO
from GLXAudio.Sleep import Sleep
from GLXViewer import viewer

# THE APP
try:
    verbose = True
    debug = True
    debug_level = 3

    time_to_sleep = 0.42

    if verbose:
        viewer.flush_infos(
            status_text='INIT',
            status_text_color='WHITE',
            column_1='Simplex Repeater',
            column_2=' - Version 0.5'
        )

        viewer.flush_infos(
            status_text='INIT',
            status_text_color='WHITE',
            column_1=AudioInterfaces.__name__ + ':',
            column_2='list interfaces'
        )
        AudioInterfaces.print_interfaces(only_default=True)

    while True:
        #  Create a new temporary file each time, that because communication's should be anonyme
        temporary_file = tempfile.NamedTemporaryFile()
        try:
            # Start a recording
            with AudioRecorder() as recorder:
                recorder.set_debug(debug)
                recorder.set_debug_level(debug_level)
                recorder.set_verbose(verbose)
                recorder.set_format(GLXAUDIO.FORMAT_INT16)
                recorder.set_threshold(2)  # in percent
                recorder.set_channels(1)
                recorder.set_rate(22050)
                recorder.set_chunk_size(1024)
                recorder.record_to_file(filename=temporary_file.name)

            # Wait , because that is how work a repeater
            with Sleep() as sleeper:
                sleeper.set_debug(debug)
                sleeper.set_debug_level(debug_level)
                sleeper.set_verbose(verbose)
                sleeper.sleep(time_to_sleep)

            # Play what is inside our temporary file
            with AudioPLayer() as player:
                player.set_debug(debug)
                player.set_debug_level(debug_level)
                player.set_verbose(verbose)
                player.set_is_detached(False)
                player.play(filename=temporary_file.name)

        except EOFError:
            pass

        # Close the temporary file, it have effect to delete the file.
        # That because communication's should be anonymize
        temporary_file.close()

except KeyboardInterrupt:
    sys.exit(0)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

galaxie-audio-0.1.tar.gz (24.0 kB view details)

Uploaded Source

File details

Details for the file galaxie-audio-0.1.tar.gz.

File metadata

  • Download URL: galaxie-audio-0.1.tar.gz
  • Upload date:
  • Size: 24.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for galaxie-audio-0.1.tar.gz
Algorithm Hash digest
SHA256 72bb179de3b056633f630ccf62ab2924c03f778c97b0df05b3009859d71b1eec
MD5 cf4d3e250165937a0f65abe4a1d3dd0f
BLAKE2b-256 176c0c4ae8f1e4771c8d64a7fe6c9d63d9be641641b8036d9091477faab58ba5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page