Skip to content

Can you play audio directly from a python script using DawDreamer? #97

Answered by DBraun
music-lover99 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, thanks for finding this bug! The issue is that loop_end needs to be set to a high value (but also not too high, which is another bug aspect). This adjustment is working for me

from librosa import load
from scipy.io import wavfile
import dawdreamer as daw

SAMPLE_RATE = 44100
buffer_size = 512
time_ratio = 1.25
song_path = "C:/Users/sebastian/Desktop/slowed_and_lowered/Drake - Fair Trade (Lyrics) ft. Travis Scott.mp3"

def load_audio_file(file_path, duration=None):
    sig, rate = load(file_path, duration=duration, mono=False, sr=SAMPLE_RATE)
    assert(rate == SAMPLE_RATE)
    return sig

engine = daw.RenderEngine(SAMPLE_RATE, buffer_size)
input_audio = load_audio_file(song_path)

pla…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@music-lover99
Comment options

@DBraun
Comment options

@music-lover99
Comment options

Answer selected by music-lover99
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants