Dataset Viewer
Auto-converted to Parquet
audio
dict
transcript
stringlengths
1
40
{"bytes":"AAAAAFlIaD8AAABA4X54PwAAAADd63o/AAAAwI9MgD8AAACAfQd/PwAAAIAW8Xs/AAAAQDLJeD8AAAAALpJ2PwAAAI(...TRUNCATED)
احسن قصه درت حتى دابا والي مازال ما دت
{"bytes":"AAAAgGdhYT8AAADAPENmPwAAAGBehjq/AAAAgFp1OT8AAAAgfgFxPwAAAEB1uXU/AAAAwPOWQr8AAADg72xhvwAAAA(...TRUNCATED)
حى شي قناه وى شي بلاصه في الانترنيت 20
{"bytes":"AAAAAOPzsb8AAABA5F7AvwAAAECvtb2/AAAAIDgxvL8AAAAAZEG+vwAAACB0BMG/AAAAgO3ovr8AAABAkeC/vwAAAC(...TRUNCATED)
مارس 2020 باش العالم كامل كان تسد
{"bytes":"AAAA4LJKZj8AAABgFjx0PwAAAICIqXM/AAAAQNqTdj8AAACAO+BzPwAAAEBPH3M/AAAAYOK9cj8AAACA4dFyPwAAAI(...TRUNCATED)
والانظار كامله كانت متوجهه لكوفيد القصه
{"bytes":"AAAAYFwujL8AAADA/mmVvwAAAKBrqZC/AAAAwDnokL8AAADAMsqLvwAAAADSe4i/AAAAwJZohr8AAAAA4+qFvwAAAI(...TRUNCATED)
ديالنا بدات في هذا الفيديو نطلب منكم جوج
{"bytes":"AAAAAH0ec78AAAAAzQCCvwAAAAC2/3y/AAAAwFpPe78AAAAAZA57vwAAAMASRH2/AAAAoJYFfr8AAAAAFl2BvwAAAG(...TRUNCATED)
حوايج اول حاجه بغيتكم تفرجوا فيها حى
{"bytes":"AAAAAFOKpL8AAACAvE20vwAAAACqdLO/AAAA4AZvtb8AAAAAUh+0vwAAAAAWHra/AAAAgEHVtb8AAADAiZy2vwAAAI(...TRUNCATED)
الاخر وتستمتعوا بها الثانيه مني تسالي
{"bytes":"AAAAQPL+rr8AAADgvO28vwAAACCcSr2/AAAAwP4Lwb8AAAAgVxe+vwAAACC/176/AAAAgIFUu78AAADA9Jy4vwAAAM(...TRUNCATED)
هذا الفيديو بارطاجيوه لان هذه احسن فيديو
{"bytes":"AAAAIFKOQr8AAABAv/FTvwAAACAb3FK/AAAAALqPU78AAABAWkBUvwAAAID2Rla/AAAAgCqaWb8AAABgfutbvwAAAK(...TRUNCATED)
تكون في هذ القناه هذ قلوا عل جوج هازين
{"bytes":"AAAA4Lzbyj8AAAAA2B3TPwAAAID1Wc8/AAAAgE/y0T8AAADAyGLOPwAAAIByHdA/AAAAwLjwxz8AAACAbkTFPwAAAA(...TRUNCATED)
السلاح كلاش ديالهم طوال عوازه نيجيريين
End of preview. Expand in Data Studio

How to Use the DarijaTTS-v0.2 Dataset

Code:

import IPython.display as ipd
import io
import numpy as np
import tempfile
import wave
import os

from datasets import load_dataset
from IPython.display import Audio

# Load the DarijaTTS-v0.2 dataset with streaming
streaming_dataset = load_dataset("Lyte/DarijaTTS-v0.2", streaming=True)

print("Dataset loaded with streaming:")
print(streaming_dataset)

# Function to play audio from a streaming dataset element
def play_streaming_audio(element, sampling_rate=22050):
    """
    Plays audio bytes from a streaming dataset element by processing the bytes and creating a temporary WAV file.

    Args:
      element: The dataset element containing the audio.
      sampling_rate: The sampling rate to use for the audio playback.
    """
    audio_bytes = element['audio']['bytes']
    temp_filename = None

    try:
        # Convert the bytes to a NumPy array, assuming float64 data based on previous success
        audio_data = np.frombuffer(audio_bytes, dtype=np.float64)

        # Convert float64 to int16 (standard for WAV) and scale
        int16_data = np.int16(audio_data * 32767)

        # Create a temporary WAV file
        with tempfile.NamedTemporaryFile(suffix='.wav', delete=False) as temp_file:
            temp_filename = temp_file.name

            with wave.open(temp_filename, 'wb') as wf:
                wf.setnchannels(1)  # Mono
                wf.setsampwidth(2)  # 16-bit (2 bytes)
                wf.setframerate(sampling_rate)  # Sample rate
                wf.writeframes(int16_data.tobytes())

        # Play the temporary WAV file
        display(Audio(temp_filename, rate=sampling_rate))

    except Exception as e:
        print(f"Error processing and playing audio: {e}")
        print("Could not play audio.")
    finally:
        # Clean up the temporary file if it was created
        if temp_filename and os.path.exists(temp_filename):
            os.remove(temp_filename)

# Function to iterate through and play a number of streaming audio examples
def play_streaming_examples(dataset, num_examples_to_play=5, sampling_rate=22050):
    """
    Iterates through and plays a specified number of audio examples from a streaming dataset.

    Args:
      dataset: The loaded streaming dataset object.
      num_examples_to_play: The number of examples to play.
      sampling_rate: The sampling rate to use for the audio playback.
    """
    print(f"\nPlaying the first {num_examples_to_play} audio examples...")

    for i, element in enumerate(dataset['train']):
        if i >= num_examples_to_play:
            break

        print(f"\nPlaying example {i+1}")
        play_streaming_audio(element, sampling_rate=sampling_rate)

# Example of how to use the play_streaming_examples function
play_streaming_examples(streaming_dataset, num_examples_to_play=3, sampling_rate=22050)
Downloads last month
516