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 hashes)

Uploaded Source

Supported by

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