boxerfan88
Addicted to Fun and Learning
- Joined
- Oct 23, 2018
- Messages
- 887
- Likes
- 940
- Thread Starter
- #61
import sys, os, argparse, acoustics
import numpy as np
import sounddevice as sd # {sounddevice} is different from {soundcard} library
# Updated 2023-11-28
# Created by boxerfan88
#
# This tool sets sample rate of SMSL DAC & Soekris DAC
# Takes in sample rate as argument
# Generates pink noise @ sample rate for 3 secs
# then plays it to SMSL DAC and Soekris DAC.
#
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument("-s", "--samplerate", required=True, type=int, help="sample rate")
args = parser.parse_args()
# set sample rate (defaults to 176400)
srt = {44100,48000,88200,96000,176400,192000,352800,384000}
mysamplerate = 176400
if args.samplerate:
if args.samplerate in srt:
mysamplerate = args.samplerate
print('Sample rate set to: ',mysamplerate)
else:
print('Invalid sample rate: ',args.samplerate)
else:
print('No sample rate provided.')
print('Final sample rate: ',mysamplerate,'\n')
# generate pink noise (3secs)
left = acoustics.generator.pink(mysamplerate*3,None)
# scale it by -80dB
left = left * 0.0001
# copy pink noise from left to right channel
right = left
# generate stereo data
stereo_data = np.array([left,right]).T
# Playback to SMSL DAC
print('Playing pink noise at',mysamplerate,'sps to SMSL...')
wasapi_exclusive = sd.WasapiSettings(exclusive=True)
# play stereo data to SMSL device (subwoofer)
try:
sd.play(stereo_data,samplerate=mysamplerate,blocking=True,device='SMSL DO100 (SMSL USB DAC), Windows WASAPI',extra_settings=wasapi_exclusive)
except:
print('Encountered problem playing data to SMSL.')
print('Finish playing...','\n')
# Playback to Soekris DAC
print('Playing pink noise at',mysamplerate,'sps to Soekris...')
wasapi_exclusive = sd.WasapiSettings(exclusive=True)
# play stereo data to Soekris device (main speakers)
try:
sd.play(stereo_data,samplerate=mysamplerate,blocking=True,device='Soekris dac1541 (Soekris dac1xx1), Windows WASAPI',extra_settings=wasapi_exclusive)
except:
print('Encountered problem playing data to Soekris.')
print('Finish playing...','\n')
sys.exit (0)
#===============================================
I seem to have a problem that when the PC returns from sleep mode, I no longer get system audio unless I either disable/enable the device in Control Panel > Sounds, or sometimes restarting the Matrix audio engine works. This is despite the fact that all USB is set to not power-down at sleep.No, you can use both of VAIO (as Windows default audio output device) and VASIO routings "simultaneously" if you like to do so. Please carefully read and look at my such routing diagram shared in my above post #48.
In this case (since you would use Out 1-2 only), on Windows default output "properties" settings, you need to configure the audio device in 2-CH stereo and also make them full-range stereo so that avoiding loss of low-Fq bass sound.
And, please be careful enough that the default gain settings in VAIO routing is Windows maximum full gain (maximum sound volume level), and you usually need digital gain attenuation/suppression (in my case in #48, I carefully set -16 dB, as you know well some of the Youtube clips has very high audio gain!) for routing/redirect into VASIO routings for proper/suitable level matching with your VASIO audio device(s).
I believe this flexible digital gain attenuation in VAIO on VB Matrix's Routing Grid is really nice when I (we) use either of JRiver MC's YouTube window (which feeds stereo 2CH into VAIO as Windows default audio) and usual SSD music library play (which feeds stereo 2CH into VASIO).
In my case, both of VAIO(2CH) input and VASIO(2CH) input are then fed into system-wide DSP Center "EKIO" for multichannel DSP (XO/EQ/Delay/Relative-Gain) processing.
I seem to have a problem that when the PC returns from sleep mode, I no longer get system audio unless I either disable/enable the device in Control Panel > Sounds, or sometimes restarting the Matrix audio engine works. This is despite the fact that all USB is set to not power-down at sleep.
I run the VBMatrix core at 176400 sps, and drive the DACs at the same rate. Recently I started to switch off the SMSL DAC every night, and when I power on the DAC the next day, it defaults to 44100 sps. I found a small little niggle, VBMatrix will operate the DAC at the default 44100 sps (which is not what I want). There is no way to configure VBMatrix to "force" or initialize the DAC to a preferred sample rate before the VBMatrix routing engine starts.
If you would be interested, please refer here post #776 on my project thread for my "Ignition/Start-up Sequences" and full "Shutdown Sequences" .
Hi boxerfan88, have you tried setting your SMSL DO100 as Master? I try VB Matrix with Benchmark DAC3 and Topping DX1, and the time shift on the Topping is horrible. But the DAC3 has none. Since I cannot set Topping as Master, I guess this has something to do with the time shiftBoth.
The Master DAC drives the LR channel. Master DAC is a Soekris dac1541. VB Matrix is configured to use the Soekris ASIO driver as master.
The slave DAC drives the subwoofer. Slave DAC is a SMSL DO100. VB Matrix is configured to use the SMSL WDM driver as slave.
It was playing background music throughout my workday (at home) ... I did not hear any click/pop/dropout.
Nor detect any DAC drift.
//
If you're wondering how I detect DAC clock drifted (ASIO4ALL):
- usually happens after 25-45 mins of playback
- songs with reasonable bass content will have this weird "whoop whoop" bass tune
- and it progressively gets worse.
- when I stop playback & start playback of the same song ... the weird "whoop whoop" bass sound does not happen anymore
- until 25-45 mins later ... it repeats
=> after I switched over from ASIO4ALL to VB Matrix this "whoop whoop" bass has never occurred once. Even after hours of continuous playback.
Hi boxerfan88, have you tried setting your SMSL DO100 as Master? I try VB Matrix with Benchmark DAC3 and Topping DX1, and the time shift on the Topping is horrible. But the DAC3 has none. Since I cannot set Topping as Master, I guess this has something to do with the time shift
Thanks for your reply. I gave up on VB Marix and am looking into DM7 too.Hi there,
I have tried all 3 combinations:
a. Soekris as master
b. SMSL as master
c. internal as master
All resulted in phase shift around the crossover point.
That’s why I went to buy another DAC - the Topping DM7 which has 8 channels. No more phase shift.