almoghamdani / audify

Play/Stream/Record PCM audio data & Encode/Decode Opus to PCM audio data
MIT License
126 stars 20 forks source link

openStream crash my microphone on every other application on the machine #32

Open juanch0x opened 2 years ago

juanch0x commented 2 years ago

Hi, I'm trying to use the openStream api like the following

const st = rtAudio.openStream(
  undefined,
  {
    deviceId: inputName || rtAudio.getDefaultInputDevice(), // Input device id (Get all devices using `getDevices`)
    nChannels: 1, // Number of channels
    firstChannel: 0, // First channel index on device (default = 0).
  },
  RtAudioFormat.RTAUDIO_SINT16, // PCM Format - Signed 16-bit integer
  48000, // Sampling rate is 48kHz
  1920, // Frame size is 1920 (40ms)
  "MyStream", // The name of the stream (used for JACK Api)
  (pcm) => {
    //logic to detect if the person is with voice active
  },
  () => {}
);
rtAudio.start();

It works as expected, and I can get the data that I need from the inputCallback without issues.

The thing is, when i execute rtAudio.start() every other application stop detecting the audio input from the computer until until I restart that application.

It's any workaround for this? Am I doing something wrong?