Skip to main content

Robobo audio streaming library

Project description

robobo-python-audio-stream

This library is required to use the audio streaming from the Smartphone's microphone in the Robobo.py library. It only runs in Android operating system.

Installation

Download this repository to your computer and save it in the robobo.by folder. Then open a terminal window and type the two following commands:

pip install robobopy_audiostream

Example

The following script shows an example of the basic usage of this library:

from robobopy_audiostream.RoboboAudio import RoboboAudio
from robobopy.Robobo import Robobo
import pyaudio

SERVER_IP = "ROBOBO_IP"

p = pyaudio.PyAudio()
FORMAT = pyaudio.paInt16
CHANNELS = 1
RATE = 44100
CHUNK = 1024

stream = p.open(format=FORMAT,
                channels=CHANNELS,
                rate=RATE,
                output=True,
                frames_per_buffer=CHUNK)


rob = Robobo(SERVER_IP)
rob.connect()

rob.setAudioStreamBitrate(RATE)
rob.startAudioStream()

audio = RoboboAudio(SERVER_IP)
audio.connect()

audio.syncAudioQueue()
while True:
    try:
        audioData = audio.getAudioWithMetadata()
        if not audioData is None:
            data, ts, snc = audioData
            stream.write(data)
        else:
            break
    except KeyboardInterrupt:
        break

rob.stopAudioStream()
audio.disconnect()

rob.disconnect()

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

robobopy_audiostream-1.1.0.tar.gz (15.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

robobopy_audiostream-1.1.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file robobopy_audiostream-1.1.0.tar.gz.

File metadata

  • Download URL: robobopy_audiostream-1.1.0.tar.gz
  • Upload date:
  • Size: 15.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for robobopy_audiostream-1.1.0.tar.gz
Algorithm Hash digest
SHA256 7289a32df305fe9756e82243468287d4b6a80a50c586c8b3ea367c332b8a2e6c
MD5 e80a9f7b086849c0ed34ae3861dc1b9d
BLAKE2b-256 0c63756ff73b94b3050170ef47abec5a77ad690264a58a7f1002122aabdf8bb2

See more details on using hashes here.

File details

Details for the file robobopy_audiostream-1.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for robobopy_audiostream-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 914ebf1d6bed5ba9782cf2723599fddf8268ef88cb131d09d151ad00a1b1b789
MD5 188736fd68ba9452f7d02a62c70a7d10
BLAKE2b-256 36b8ae87f1d99f6d97cb814ad506baf599396635614465db95062e95ff0410b5

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