question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot find a way to send signal to a specific ouput

See original GitHub issue

I have a Lexicon Omega Audio interface. I have written a small program from examples to send a sinewave to the output through MME. This works. I have had a go at selecting an ASIO output and using the channel_selector argument, but no luck. I get invalid number of channels. Is there a way I am missing to be able to pass an argument that says I want outdata to go to a specific output of the device I am using?

import sounddevice as sd
import numpy as np
import scipy.stats as ss
import queue

asio_out = sd.AsioSettings(channel_selectors=[1, 2])

out_q = queue.Queue()

global start_idx
start_idx = 0

def callback(outdata, frames, time, status):

    global start_idx
    t = (start_idx + np.arange(frames)) / 48000
    t = t.reshape(-1, 1)
    sine = 0.9 * np.sin(2 * np.pi * 1000 * t)

    outdata[:] = sine
    out_q.put(sine)

    start_idx += frames

with sd.OutputStream(device=24, samplerate=48000, channels=4, blocksize=4096, callback=callback, extra_settings=asio_out):
    while True:
        pass

Thanks in advance.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mgeiercommented, Mar 18, 2020

I guess this issue is resolved, right?

0reactions
mgeiercommented, Jan 24, 2020

Great that you found the solution yourself!

For the “explicit” case you could also write: outdata[:, :] = data, which does the same if outdata has 2 channels.

In the “one channel” cases, the inner brackets are not necessary, you can write: outdata[:, 0] = data, which I think would be more idiomatic.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Write Advanced Signal Handlers in UNIX - Oracle
The first step is to declare a signal handling routine. There are two kinds of signal handling routines: one kind that does not...
Read more >
go - How to send an interrupt signal - Stack Overflow
I know how to intercept interrupt signals from the console, by using signal.Notify(interruptChannel, os.Interrupt) , however, I can't find a way ...
Read more >
kill() — Send a signal to a process - IBM
You can use either signal() or sigaction() to specify how a signal will be handled when kill() is invoked. A process can use...
Read more >
Linux Signals help - Computer Hope
Finding system-specific signals​​ To view the signals used by your operating system, open a terminal and run man signal or man 7 signal....
Read more >
signal — Set handlers for asynchronous events ... - Python Docs
A Python signal handler does not get executed inside the low-level (C) signal handler. Instead, the low-level signal handler sets a flag which...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found