Comments (6)
You are using SoundDevice. This issue board is about SoundCard. These libraries are not the same.
from soundcard.
@mbatt which OS are you using? I use soundcard with mutiprocessing and works very well, nothing special in the setup thou, it's just regular multiprocessing.
from soundcard.
I use windows 10, finally I was able to send tones to differents devices (outputs) of my device in a separate python processes, but I faced a new weird issue.
when I send a tone of 1khz , the frequency is doubled.
I use spectralissime to view the signal it's 2khz.
from soundcard.
Did you set the samplerate? Could you show us a complete code example of what you were trying to do?
from soundcard.
Here is the code
mport sounddevice as sd
import soundfile as sf
import numpy as np
from audio_constants import *
from wasapi_device_index import *
""" create a numpy array from a .wav file"""
def wave2numpy(file):
data,fs = sf.read(file, dtype = 'float32')
return data
def open_output_stream(index):
out_stream = sd.OutputStream( device=index, dtype="float32",channels = 2 )
out_stream.start()
return out_stream
def play_audio_on_channel(audio_data, stream_object):
stream_object.write(audio_data)
"""here i call the function"""
wasapi_exclusive = sd.WasapiSettings(exclusive=True)
play_audio_on_channel(wave2numpy("Tone_750Hz_44100_600s.wav"),open_output_stream(30))
This is my device querry output:
['28', 'FCA1616', 'Line', '7/8', '(Behringer', 'FCA1616', 'WDM),', 'Windows', 'WASAPI', '(0', 'in,', '2', 'out)']
['29', 'FCA1616', 'Line', '1/2', '(Behringer', 'FCA1616', 'WDM),', 'Windows', 'WASAPI', '(0', 'in,', '2', 'out)']
['30', 'FCA1616', 'Line', '3/4', '(Behringer', 'FCA1616', 'WDM),', 'Windows', 'WASAPI', '(0', 'in,', '2', 'out)']
['32', 'FCA1616', 'Line', '5/6', '(Behringer', 'FCA1616', 'WDM),', 'Windows', 'WASAPI', '(0', 'in,', '2', 'out)']
from soundcard.
In the previous code I stream out a 750 Hz tone but it is played as a 1500Hz tone
when I use the play function I get the right frequency
def play_tone(file,channel,loop):
data,fs = sf.read(file,dtype = 'float32')
sd.play(data,fs,loop=loop, blocking = False, device=channel,never_drop_input=None)
status = sd.wait()
sd.stop()
play_tone("Tone_440Hz_44100_600s.wav", 30,False)
from soundcard.
Related Issues (20)
- Problems with the "fuzzy matcher" in get_microphone() HOT 1
- Watch for moved streams? HOT 1
- Decode error in _CoreAudio.CFString_to_str HOT 2
- feature request - ability to add virtual audio channels. HOT 1
- Why won't it save my audio when I use this with SoundFile? HOT 4
- OSError: ctypes.util.find_library() did not manage to locate a library called 'harfbuzz' please help in windows HOT 2
- Does anyone know how to make this work? HOT 1
- Wav file is empty after recording is saved to file HOT 5
- how to end playback in advance? HOT 2
- Need help with settings HOT 6
- MacOS: Empty result for all_speakers/all_microphones HOT 28
- Record audio unlimited HOT 6
- get mac audio output level HOT 1
- Queation: Is that possible to record based on a button click? HOT 1
- Data loss while recording HOT 4
- Cannot record sound with loopback if silence at start HOT 10
- loopback record audio from speaker return zero array HOT 5
- Problem with the player HOT 1
- how to get non numpy "raw" mono data from the record() method HOT 2
- pluseaudio.py line 3 `import collections` set --> `import collections.abc as collections` HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from soundcard.