dheijl / swyh-rs

Stream What You Hear written in rust, inspired by SWYH.
MIT License
365 stars 15 forks source link

audible low noise in every stream #10

Closed dkent600 closed 4 years ago

dkent600 commented 4 years ago

I find that there is a very audible low background noise in everything I stream through swhy-rs, regardless of the source or the recording. This only happens with swyh-rs.

I am on Windows 10, streaming via Volumio.

dheijl commented 4 years ago

Listening to a Digital Impulse piano Jazz recording I can't hear any noise even at very high volume,

My setup:

dheijl commented 4 years ago

Would you be prepared to try out VBAudio Hifi Cable as the default sound driver for a test? It's donationware if you find it useful: https://shop.vb-audio.com/en/win-apps/19-hifi-cable-asio-bridge.html It makes sure that nothing comes between the audio output and the original audio source. (You can ignore the ASIO stuff unless you have an ASIO audio source available). I've been using it for years. And like I said, I can hear no noise with speakers or headphones. I have had quality trouble though when capturing the sound from my Realtek audio card in the default configuration.

dkent600 commented 4 years ago

My card is Realtek too (on a Dell laptop). I'll try it and see what happens.

dkent600 commented 4 years ago

I installed the driver available here: https://vb-audio.com/Cable/index.htm

But it doesn't work at all, no sound emanating on the computer, much less volumio.

dheijl commented 4 years ago

The download you need is http://vincent.burel.free.fr/VirtualAudioApps/HiFiCableAsioBridgeSetup_v1007.zip. You then have to either make HiFi Cable Input your default output audio device in Windows, or you have to configure your audio playing application to output the sound on HiFi Cable input, either in the app if it supports this, or in the Windows sound mixer if it doesn't. You should also make sure that the sampling frequency of HiFi Cable input and output is the same as the Windows "standard" output device as HiFi Cable does not do any resampling. If HiFi Cable is not your default Windows output device you should select it in swyh-rs (this is now possible in the latest version). In any case you should see the message "the wave_reader is receiving samples".

dkent600 commented 4 years ago

You should also make sure that the sampling frequency of HiFi Cable input and output is the same as the Windows "standard" output device as HiFi Cable does not do any resampling.

Sorry, how does one do this?

dkent600 commented 4 years ago

Still getting no sound from the computer. From swyh-rs, here is some debugging output:

SSDP discovery started
Renderer at : http://192.168.1.53:49152/description.xml
Getting renderer descriptions
Renderer Volumio Volumio ip 192.168.1.53 at urlbase http://192.168.1.53:49152/ has 9 services
  => OpenHome Playlist control url: '/ctl/OHPlaylist', AvTransport url: '/ctl/AVTransport'
SSDP discovery complete
Capturing audio from: Hi-Fi Cable Input (VB-Audio Hi-Fi Cable)
Default audio SupportedStreamConfig { channels: 2, sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
The streaming server is listening on http://192.168.1.50:5901/stream/swyh.wav
The wave_reader is receiving samples
OH Start playing on Volumio host=192.168.1.53 port=49152 from 192.168.1.50 using OpenHome Playlist
Received request /stream/swyh.wav from 192.168.1.53:46496
OH Stop playing on Volumio host=192.168.1.53 port=49152
=>Http connection with 192.168.1.53:46496 terminated [An established connection was aborted by the software in your host machine. (os error 10053)]
Streaming to 192.168.1.53:46496 has ended
*E*E*> Invalid sound source selection !
dkent600 commented 4 years ago

OK, update on what I reported just above:

Though I still get no computer audio using Hi-Fi, I was able to get swyh+volumio working with Hi-Fi the first time I started the app. It was using the Hi-Fi but I'm not sure whether it was because that is your app default or because perhaps it was the Windows default at the time I started the app, which I think it may have been.

When my Windows default is set to my original device, volumio+swyh still works (though with the low freq noise).

But when I select Hi-Fi in your new dropdown I get "EE*> Invalid sound source selection !" and am unable to make the app go back to using Hi-Fi. So there appears to be a bug somewhere inside of your dropdown item select handler.

Thus I am not sure whether Hi-Fi has the noise.

dheijl commented 4 years ago

I know about the "invalid sound source selection", but I can't reproduce it. The dropdown event handler gives me the index in the dropdown list, at least it does so here, but sometimes it seems to give a very large index value, no idea why... So I check the index value against the number of values in the list. How many entries do you have in the dropdown?

dheijl commented 4 years ago

OK I can reproduce this: if it is the first time you use the dropdown and you don't make a selection than you get the error. Once you've chosen a value and you open the dropdown without making a choice it returns the last used choice. So you should be able to activate HiFi Cable again. Did you manage to check the Windows per application mixer settings and the bit depth/sampling rate option in the audio devices control panel?

Edit: the invalid sound source selection should be fixed in 0.8.7.

dkent600 commented 4 years ago

Did you manage to check the Windows per application mixer settings and the bit depth/sampling rate option in the audio devices control panel?

Sorry, I was hoping you could explain how one goes-about doing this.. Still not sure from your description here. And more precise steps would be appreciated, thanks.

So you should be able to activate HiFi Cable again.

Using v0.8.8 the dropdown error is fixed, but I am still not able make it use the Hi-Fi driver. Does the Hi-Fi have to be the windows default? (Even as windows default, swyh still doesn't use it)

dheijl commented 4 years ago

No, HiFi Cable does not have to be the default sound source, but if it is all sound will go through HiFi Cable, otherwise you have to direct the sound for each app to HiFi Cable either in the app (if supported) or in the soundmixer as below:

Sound Mixer: soundmixer

You can then see this reflected in the Volume Mixer (from system tray): VolumeMixer

And the properties of each sound source are set in the Control Panel Sound: ControlPanelSound

dkent600 commented 4 years ago

OK, thanks for the instructions about the frequency settings!

I am still, however, unable to make the app use Hi-Fi. It is stuck on my realtec. I can see this in the log window of the non-debug app.

dkent600 commented 4 years ago

I would be happy to do further testing or send logs, whatever you need

dheijl commented 4 years ago

Yes it would be good if you could run the debug build and send me the contents of the console log.

dkent600 commented 4 years ago

OK, here is the debug output after following steps:

  1. realtek is the windows default
  2. open swyh-rs debug
  3. click "Change Audio Source". It displays two items: Speakers and Hi-Fi
  4. select Hi-Fi (note, no additional debug output appeared with this step)
  5. click the Volumio Volumio button
Supported hosts:
  [Wasapi]
Available hosts:
  [Wasapi]
WASAPI
  Default Output Device:
    Some("Speakers / Headphones (2- Realtek Audio)")
  Devices:
  1. "Speakers / Headphones (2- Realtek Audio)"
    All supported output stream configs:
      1.1. SupportedStreamConfigRange { channels: 2, min_sample_rate: SampleRate(48000), max_sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
    Default output stream config:
      SupportedStreamConfig { channels: 2, sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
  2. "Hi-Fi Cable Input (VB-Audio Hi-Fi Cable)"
    All supported output stream configs:
      2.1. SupportedStreamConfigRange { channels: 2, min_sample_rate: SampleRate(48000), max_sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
    Default output stream config:
      SupportedStreamConfig { channels: 2, sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
  3. "Hi-Fi Cable Output (VB-Audio Hi-Fi Cable)"
  4. "Microphone (2- Realtek Audio)"
Current Configuration: Configuration { auto_resume: false, sound_source: "Speakers / Headphones (2- Realtek Audio)" }
Selected audio source: Speakers / Headphones (2- Realtek Audio)
log: SSDP discovery started
UDP response at 3 from 192.168.1.53:40507:
HTTP/1.1 200 OK
CACHE-CONTROL: max-age=3600
DATE: Thu, 15 Oct 2020 09:10:02 GMT
EXT:
LOCATION: http://192.168.1.53:49152/description.xml
OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01
01-NLS: 39b4a8b6-0278-11eb-a535-936c2f8a36b1
SERVER: Linux/4.19.86-v7+, UPnP/1.0, Portable SDK for UPnP devices/1.6.20.jfd5
X-User-Agent: redsonic
ST: urn:schemas-upnp-org:service:RenderingControl:1
USN: uuid:04255cb4-11f0-58db-0053-0017f700aae4::urn:schemas-upnp-org:service:RenderingControl:1

log: Renderer at : http://192.168.1.53:49152/description.xml
log: Getting renderer descriptions
Get service description for http://192.168.1.53:49152/description.xml
Service description:
<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<device>
<deviceType>urn:schemas-upnp-org:device:MediaRenderer:1</deviceType>
<friendlyName>Volumio</friendlyName>
<manufacturer>Volumio</manufacturer>
<manufacturerURL>https://volumio.org</manufacturerURL>
<modelDescription>The Audiophile Music Player</modelDescription>
<modelName>Volumio</modelName>
<modelNumber>1.0</modelNumber>
<modelURL>https://volumio.org</modelURL>
<serialNumber>42</serialNumber>
<UDN>uuid:04255cb4-11f0-58db-0053-0017f700aae4</UDN>
<iconList>
<icon>
<mimetype>image/png</mimetype>
<width>64</width>
<height>64</height>
<depth>32</depth>
<url>/upmpd/icon.png</url>
</icon>
</iconList>
<serviceList>
<service>
<serviceType>urn:schemas-upnp-org:service:RenderingControl:1</serviceType>
<serviceId>urn:upnp-org:serviceId:RenderingControl</serviceId>
<SCPDURL>/upmpd/RenderingControl.xml</SCPDURL>
<controlURL>/ctl/RenderingControl</controlURL>
<eventSubURL>/evt/RenderingControl</eventSubURL>
</service>
<service>
<serviceType>urn:schemas-upnp-org:service:AVTransport:1</serviceType>
<serviceId>urn:upnp-org:serviceId:AVTransport</serviceId>
<SCPDURL>/upmpd/AVTransport.xml</SCPDURL>
<controlURL>/ctl/AVTransport</controlURL>
<eventSubURL>/evt/AVTransport</eventSubURL>
</service>
<service>
<serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
<serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
<SCPDURL>/upmpd/ConnectionManager.xml</SCPDURL>
<controlURL>/ctl/ConnectionManager</controlURL>
<eventSubURL>/evt/ConnectionManager</eventSubURL>
</service>
<service>
<serviceType>urn:av-openhome-org:service:Product:1</serviceType>
<serviceId>urn:av-openhome-org:serviceId:Product</serviceId>
<SCPDURL>/upmpd/OHProduct.xml</SCPDURL>
<controlURL>/ctl/OHProduct</controlURL>
<eventSubURL>/evt/OHProduct</eventSubURL>
</service>
<service>
<serviceType>urn:av-openhome-org:service:Info:1</serviceType>
<serviceId>urn:av-openhome-org:serviceId:Info</serviceId>
<SCPDURL>/upmpd/OHInfo.xml</SCPDURL>
<controlURL>/ctl/OHInfo</controlURL>
<eventSubURL>/evt/OHInfo</eventSubURL>
</service>
<service>
<serviceType>urn:av-openhome-org:service:Time:1</serviceType>
<serviceId>urn:av-openhome-org:serviceId:Time</serviceId>
<SCPDURL>/upmpd/OHTime.xml</SCPDURL>
<controlURL>/ctl/OHTime</controlURL>
<eventSubURL>/evt/OHTime</eventSubURL>
</service>
<service>
<serviceType>urn:av-openhome-org:service:Volume:1</serviceType>
<serviceId>urn:av-openhome-org:serviceId:Volume</serviceId>
<SCPDURL>/upmpd/OHVolume.xml</SCPDURL>
<controlURL>/ctl/OHVolume</controlURL>
<eventSubURL>/evt/OHVolume</eventSubURL>
</service>
<service>
<serviceType>urn:av-openhome-org:service:Playlist:1</serviceType>
<serviceId>urn:av-openhome-org:serviceId:Playlist</serviceId>
<SCPDURL>/upmpd/OHPlaylist.xml</SCPDURL>
<controlURL>/ctl/OHPlaylist</controlURL>
<eventSubURL>/evt/OHPlaylist</eventSubURL>
</service>
<service>
<serviceType>urn:av-openhome-org:service:Radio:1</serviceType>
<serviceId>urn:av-openhome-org:serviceId:Radio</serviceId>
<SCPDURL>/upmpd/OHRadio.xml</SCPDURL>
<controlURL>/ctl/OHRadio</controlURL>
<eventSubURL>/evt/OHRadio</eventSubURL>
</service>
</serviceList>
<presentationURL>/upmpd/presentation.html</presentationURL>
</device>
<devicelist></devicelist>
<URLBase>http://192.168.1.53:49152/</URLBase>
</root>

log: Renderer Volumio Volumio ip 192.168.1.53 at urlbase http://192.168.1.53:49152/ has 9 services
log:   => OpenHome Playlist control url: '/ctl/OHPlaylist', AvTransport url: '/ctl/AVTransport'
.. urn:schemas-upnp-org:service:RenderingControl:1 urn:upnp-org:serviceId:RenderingControl /ctl/RenderingControl
.. urn:schemas-upnp-org:service:AVTransport:1 urn:upnp-org:serviceId:AVTransport /ctl/AVTransport
.. urn:schemas-upnp-org:service:ConnectionManager:1 urn:upnp-org:serviceId:ConnectionManager /ctl/ConnectionManager
.. urn:av-openhome-org:service:Product:1 urn:av-openhome-org:serviceId:Product /ctl/OHProduct
.. urn:av-openhome-org:service:Info:1 urn:av-openhome-org:serviceId:Info /ctl/OHInfo
.. urn:av-openhome-org:service:Time:1 urn:av-openhome-org:serviceId:Time /ctl/OHTime
.. urn:av-openhome-org:service:Volume:1 urn:av-openhome-org:serviceId:Volume /ctl/OHVolume
.. urn:av-openhome-org:service:Playlist:1 urn:av-openhome-org:serviceId:Playlist /ctl/OHPlaylist
.. urn:av-openhome-org:service:Radio:1 urn:av-openhome-org:serviceId:Radio /ctl/OHRadio
log: SSDP discovery complete
Got 1 renderers
Try capturing system audio
log: Capturing audio from: Speakers / Headphones (2- Realtek Audio)
log: Default audio SupportedStreamConfig { channels: 2, sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
log: The streaming server is listening on http://192.168.1.48:5901/stream/swyh.wav
Supported hosts:
  [Wasapi]
Available hosts:
  [Wasapi]
WASAPI
  Default Output Device:
    Some("Speakers / Headphones (2- Realtek Audio)")
  Devices:
  1. "Speakers / Headphones (2- Realtek Audio)"
    All supported output stream configs:
      1.1. SupportedStreamConfigRange { channels: 2, min_sample_rate: SampleRate(48000), max_sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
    Default output stream config:
      SupportedStreamConfig { channels: 2, sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
  2. "Hi-Fi Cable Input (VB-Audio Hi-Fi Cable)"
    All supported output stream configs:
      2.1. SupportedStreamConfigRange { channels: 2, min_sample_rate: SampleRate(48000), max_sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
    Default output stream config:
      SupportedStreamConfig { channels: 2, sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
  3. "Hi-Fi Cable Output (VB-Audio Hi-Fi Cable)"
  4. "Microphone (2- Realtek Audio)"
Pushed renderer #0 Volumio Volumio, state = ON
log: OH Start playing on Volumio host=192.168.1.53 port=49152 from 192.168.1.48 using OpenHome Playlist
OHPlaylist server URL: http://192.168.1.48:5901/stream/swyh.wav
url: http://192.168.1.53:49152/ctl/OHPlaylist,
=>SOAP Action: urn:av-openhome-org:service:Playlist:1#DeleteAll,
=>SOAP xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:DeleteAll xmlns:u="urn:av-openhome-org:service:Playlist:1"/></s:Body></s:Envelope>
<=SOAP response: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:DeleteAllResponse xmlns:u="urn:av-openhome-org:service:Playlist:1"></u:DeleteAllResponse>
</s:Body> </s:Envelope>

url: http://192.168.1.53:49152/ctl/OHPlaylist,
=>SOAP Action: urn:av-openhome-org:service:Playlist:1#Insert,
=>SOAP xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:Insert xmlns:u="urn:av-openhome-org:service:Playlist:1"><AfterId>0</AfterId><Uri>http://192.168.1.48:5901/stream/swyh.wav</Uri><Metadata>&lt;DIDL-Lite xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot;&gt;&lt;item id=&quot;1&quot; parentID=&quot;0&quot; restricted=&quot;0&quot;&gt;&lt;dc:title&gt;swyh-rs&lt;/dc:title&gt;&lt;res bitsPerSample=&quot;16&quot; nrAudioChannels=&quot;2&quot; protocolInfo=&quot;http-get:*:audio/l16;rate=48000;channels=2:DLNA.ORG_PN=LPCM&quot; sampleFrequency=&quot;48000&quot; duration=&quot;0&quot; &gt;http://192.168.1.48:5901/stream/swyh.wav&lt;/res&gt;&lt;upnp:class&gt;object.item.audioItem.musicTrack&lt;/upnp:class&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</Metadata></u:Insert></s:Body></s:Envelope>
<=SOAP response: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:InsertResponse xmlns:u="urn:av-openhome-org:service:Playlist:1">
<NewId>83</NewId>
</u:InsertResponse>
</s:Body> </s:Envelope>

SeekId: 83
url: http://192.168.1.53:49152/ctl/OHPlaylist,
=>SOAP Action: urn:av-openhome-org:service:Playlist:1#SeekId,
=>SOAP xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:SeekId xmlns:u="urn:av-openhome-org:service:Playlist:1"><Value>83</Value></u:SeekId></s:Body></s:Envelope>
<=SOAP response: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:SeekIdResponse xmlns:u="urn:av-openhome-org:service:Playlist:1"></u:SeekIdResponse>
</s:Body> </s:Envelope>

log: Received request /stream/swyh.wav from 192.168.1.53:58112
url: http://192.168.1.53:49152/ctl/OHPlaylist,
=>SOAP Action: urn:av-openhome-org:service:Playlist:1#Play,
=>SOAP xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:Play xmlns:u="urn:av-openhome-org:service:Playlist:1"/></s:Body></s:Envelope>
Now have 1 streaming clients
<=SOAP response: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:PlayResponse xmlns:u="urn:av-openhome-org:service:Playlist:1"></u:PlayResponse>
</s:Body> </s:Envelope>
dheijl commented 4 years ago

If you select an entry from the dropdown it should be visible in the debug output and in the textbox. I think you have to actually click the chosen entry.

dkent600 commented 4 years ago

If you select an entry from the dropdown it should be visible in the debug output and in the textbox. I think you have to actually click the chosen entry.

In step 4 I clicked on the Hi-Fi entry in the dropdown. If tried this about 20 times. It doesn't work. It used to cause the error message that you fixed, now it does nothing.

dheijl commented 4 years ago

So fltk decides it doesn't like your clicks...as a work-around you can delete the swyh-rs folder in your home directory and make hifi cable the default audio output before you start swyh-rs.

dheijl commented 4 years ago

I'll try it here on a laptop with the touchpad.

dheijl commented 4 years ago

Before installing HiFi cable it works first-time on my laptop, Conexant SmartAudio HD but the sound quality is really bad compared to what I'm used to... Touchpad works as expected (clicks in the dropdown are recognized).

dheijl commented 4 years ago

Now installed HiFi Cable, rebooted, adjusted the sampling rate of HiFi Cable to that of the Conexant (default output), started swyh-rs, selected HiF Cable, it told me it had changed the audio source and to restart, restarted it, let it stream to Volumio, started Spotify and let it play, opened the sound mixer, changed Spotify output to HiFi Cable in the mixer, immediately sound on Volumio, and with much better quality.

I could make a debug build for you that tells me what kind of events are fired when you click the dropdown if you want to help me debug this...

Here the sequence is: Enter, Move, Move, ...Move, Leave, Push. And I check this Push event. I've put the extra debug build in the latest release as a seperate zip.

dkent600 commented 4 years ago

I get "thread panicked while panicking" on start up of the extra debug build, and it crashes.

dheijl commented 4 years ago

I only added 1 println! statement to the event handler, and never had problems with that before. It looks like the fltk events on your system are causing trouble.

I just downloaded the zip file from GitHub, and started the extra debug exe straight from the zip (with 7-zip) to be sure that it's not corrupt, it runs without problem here...

The app has been tested on 3 different Windows 10 versions so far as I know: 1909, 19H2 and 20H2.

Do you use Windows Defender or do you have another Anti-Virus product?

Did you ever try Local Audio Broadcast as an alternative to SWYH? People who had trouble with the original SWYH have had success with Local Audio Broadcast (https://github.com/protyposis/LocalAudioBroadcast). As I don't have a clue what is causing your problems perhaps you could try that one? But is unmaintained...

dheijl commented 4 years ago

Update: I found something in the fltk forums regarding recursion in the dropdown events. I'll make a new extra debug build that checks for this. You don't expect this in an event handler...

dkent600 commented 4 years ago

do you use Windows Defender or do you have another Anti-Virus product?

Yes, Windows Defender

Windows version:

image

dheijl commented 4 years ago

I uploaded a new extra debug version with a recursion lock.

dkent600 commented 4 years ago

Here is the console output with the latest debug exe. Note that after all this is still shows the realtek in the UI log.

Supported hosts:
  [Wasapi]
Available hosts:
  [Wasapi]
WASAPI
  Default Output Device:
    Some("Speakers / Headphones (2- Realtek Audio)")
  Devices:
  1. "Speakers / Headphones (2- Realtek Audio)"
    All supported output stream configs:
      1.1. SupportedStreamConfigRange { channels: 2, min_sample_rate: SampleRate(48000), max_sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
    Default output stream config:
      SupportedStreamConfig { channels: 2, sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
  2. "Hi-Fi Cable Input (VB-Audio Hi-Fi Cable)"
    All supported output stream configs:
      2.1. SupportedStreamConfigRange { channels: 2, min_sample_rate: SampleRate(48000), max_sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
    Default output stream config:
      SupportedStreamConfig { channels: 2, sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
  3. "Microphone (Logitech Webcam C930e)"
  4. "Hi-Fi Cable Output (VB-Audio Hi-Fi Cable)"
  5. "Microphone (2- Realtek Audio)"
Current Configuration: Configuration { auto_resume: false, sound_source: "Speakers / Headphones (2- Realtek Audio)" }
Selected audio source: Speakers / Headphones (2- Realtek Audio)
log: SSDP discovery started
UDP response at 1 from 192.168.1.53:52896:
HTTP/1.1 200 OK
CACHE-CONTROL: max-age=3600
DATE: Thu, 15 Oct 2020 18:48:31 GMT
EXT:
LOCATION: http://192.168.1.53:49152/description.xml
OPT: "http://schemas.upnp.org/upnp/1/0/"; ns=01
01-NLS: 39b4a8b6-0278-11eb-a535-936c2f8a36b1
SERVER: Linux/4.19.86-v7+, UPnP/1.0, Portable SDK for UPnP devices/1.6.20.jfd5
X-User-Agent: redsonic
ST: urn:schemas-upnp-org:service:RenderingControl:1
USN: uuid:04255cb4-11f0-58db-0053-0017f700aae4::urn:schemas-upnp-org:service:RenderingControl:1

log: Renderer at : http://192.168.1.53:49152/description.xml
log: Getting renderer descriptions
Get service description for http://192.168.1.53:49152/description.xml
Service description:
<?xml version="1.0"?>
<root xmlns="urn:schemas-upnp-org:device-1-0">
<specVersion>
<major>1</major>
<minor>0</minor>
</specVersion>
<device>
<deviceType>urn:schemas-upnp-org:device:MediaRenderer:1</deviceType>
<friendlyName>Volumio</friendlyName>
<manufacturer>Volumio</manufacturer>
<manufacturerURL>https://volumio.org</manufacturerURL>
<modelDescription>The Audiophile Music Player</modelDescription>
<modelName>Volumio</modelName>
<modelNumber>1.0</modelNumber>
<modelURL>https://volumio.org</modelURL>
<serialNumber>42</serialNumber>
<UDN>uuid:04255cb4-11f0-58db-0053-0017f700aae4</UDN>
<iconList>
<icon>
<mimetype>image/png</mimetype>
<width>64</width>
<height>64</height>
<depth>32</depth>
<url>/upmpd/icon.png</url>
</icon>
</iconList>
<serviceList>
<service>
<serviceType>urn:schemas-upnp-org:service:RenderingControl:1</serviceType>
<serviceId>urn:upnp-org:serviceId:RenderingControl</serviceId>
<SCPDURL>/upmpd/RenderingControl.xml</SCPDURL>
<controlURL>/ctl/RenderingControl</controlURL>
<eventSubURL>/evt/RenderingControl</eventSubURL>
</service>
<service>
<serviceType>urn:schemas-upnp-org:service:AVTransport:1</serviceType>
<serviceId>urn:upnp-org:serviceId:AVTransport</serviceId>
<SCPDURL>/upmpd/AVTransport.xml</SCPDURL>
<controlURL>/ctl/AVTransport</controlURL>
<eventSubURL>/evt/AVTransport</eventSubURL>
</service>
<service>
<serviceType>urn:schemas-upnp-org:service:ConnectionManager:1</serviceType>
<serviceId>urn:upnp-org:serviceId:ConnectionManager</serviceId>
<SCPDURL>/upmpd/ConnectionManager.xml</SCPDURL>
<controlURL>/ctl/ConnectionManager</controlURL>
<eventSubURL>/evt/ConnectionManager</eventSubURL>
</service>
<service>
<serviceType>urn:av-openhome-org:service:Product:1</serviceType>
<serviceId>urn:av-openhome-org:serviceId:Product</serviceId>
<SCPDURL>/upmpd/OHProduct.xml</SCPDURL>
<controlURL>/ctl/OHProduct</controlURL>
<eventSubURL>/evt/OHProduct</eventSubURL>
</service>
<service>
<serviceType>urn:av-openhome-org:service:Info:1</serviceType>
<serviceId>urn:av-openhome-org:serviceId:Info</serviceId>
<SCPDURL>/upmpd/OHInfo.xml</SCPDURL>
<controlURL>/ctl/OHInfo</controlURL>
<eventSubURL>/evt/OHInfo</eventSubURL>
</service>
<service>
<serviceType>urn:av-openhome-org:service:Time:1</serviceType>
<serviceId>urn:av-openhome-org:serviceId:Time</serviceId>
<SCPDURL>/upmpd/OHTime.xml</SCPDURL>
<controlURL>/ctl/OHTime</controlURL>
<eventSubURL>/evt/OHTime</eventSubURL>
</service>
<service>
<serviceType>urn:av-openhome-org:service:Volume:1</serviceType>
<serviceId>urn:av-openhome-org:serviceId:Volume</serviceId>
<SCPDURL>/upmpd/OHVolume.xml</SCPDURL>
<controlURL>/ctl/OHVolume</controlURL>
<eventSubURL>/evt/OHVolume</eventSubURL>
</service>
<service>
<serviceType>urn:av-openhome-org:service:Playlist:1</serviceType>
<serviceId>urn:av-openhome-org:serviceId:Playlist</serviceId>
<SCPDURL>/upmpd/OHPlaylist.xml</SCPDURL>
<controlURL>/ctl/OHPlaylist</controlURL>
<eventSubURL>/evt/OHPlaylist</eventSubURL>
</service>
<service>
<serviceType>urn:av-openhome-org:service:Radio:1</serviceType>
<serviceId>urn:av-openhome-org:serviceId:Radio</serviceId>
<SCPDURL>/upmpd/OHRadio.xml</SCPDURL>
<controlURL>/ctl/OHRadio</controlURL>
<eventSubURL>/evt/OHRadio</eventSubURL>
</service>
</serviceList>
<presentationURL>/upmpd/presentation.html</presentationURL>
</device>
<devicelist></devicelist>
<URLBase>http://192.168.1.53:49152/</URLBase>
</root>

log: Renderer Volumio Volumio ip 192.168.1.53 at urlbase http://192.168.1.53:49152/ has 9 services
log:   => OpenHome Playlist control url: '/ctl/OHPlaylist', AvTransport url: '/ctl/AVTransport'
.. urn:schemas-upnp-org:service:RenderingControl:1 urn:upnp-org:serviceId:RenderingControl /ctl/RenderingControl
.. urn:schemas-upnp-org:service:AVTransport:1 urn:upnp-org:serviceId:AVTransport /ctl/AVTransport
.. urn:schemas-upnp-org:service:ConnectionManager:1 urn:upnp-org:serviceId:ConnectionManager /ctl/ConnectionManager
.. urn:av-openhome-org:service:Product:1 urn:av-openhome-org:serviceId:Product /ctl/OHProduct
.. urn:av-openhome-org:service:Info:1 urn:av-openhome-org:serviceId:Info /ctl/OHInfo
.. urn:av-openhome-org:service:Time:1 urn:av-openhome-org:serviceId:Time /ctl/OHTime
.. urn:av-openhome-org:service:Volume:1 urn:av-openhome-org:serviceId:Volume /ctl/OHVolume
.. urn:av-openhome-org:service:Playlist:1 urn:av-openhome-org:serviceId:Playlist /ctl/OHPlaylist
.. urn:av-openhome-org:service:Radio:1 urn:av-openhome-org:serviceId:Radio /ctl/OHRadio
log: SSDP discovery complete
Got 1 renderers
Try capturing system audio
log: Capturing audio from: Speakers / Headphones (2- Realtek Audio)
log: Default audio SupportedStreamConfig { channels: 2, sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
log: The streaming server is listening on http://192.168.1.50:5901/stream/swyh.wav
Supported hosts:
  [Wasapi]
Available hosts:
  [Wasapi]
WASAPI
  Default Output Device:
    Some("Speakers / Headphones (2- Realtek Audio)")
  Devices:
  1. "Speakers / Headphones (2- Realtek Audio)"
    All supported output stream configs:
      1.1. SupportedStreamConfigRange { channels: 2, min_sample_rate: SampleRate(48000), max_sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
    Default output stream config:
      SupportedStreamConfig { channels: 2, sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
  2. "Hi-Fi Cable Input (VB-Audio Hi-Fi Cable)"
    All supported output stream configs:
      2.1. SupportedStreamConfigRange { channels: 2, min_sample_rate: SampleRate(48000), max_sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
    Default output stream config:
      SupportedStreamConfig { channels: 2, sample_rate: SampleRate(48000), buffer_size: Unknown, sample_format: F32 }
  3. "Microphone (Logitech Webcam C930e)"
  4. "Hi-Fi Cable Output (VB-Audio Hi-Fi Cable)"
  5. "Microphone (2- Realtek Audio)"
Audio source dropdown event: Enter
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Leave
Audio source dropdown event: Enter
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Move
Audio source dropdown event: Leave
Audio source dropdown event: Push
Pushed renderer #0 Volumio Volumio, state = ON
log: OH Start playing on Volumio host=192.168.1.53 port=49152 from 192.168.1.50 using OpenHome Playlist
OHPlaylist server URL: http://192.168.1.50:5901/stream/swyh.wav
url: http://192.168.1.53:49152/ctl/OHPlaylist,
=>SOAP Action: urn:av-openhome-org:service:Playlist:1#DeleteAll,
=>SOAP xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:DeleteAll xmlns:u="urn:av-openhome-org:service:Playlist:1"/></s:Body></s:Envelope>
<=SOAP response: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:DeleteAllResponse xmlns:u="urn:av-openhome-org:service:Playlist:1"></u:DeleteAllResponse>
</s:Body> </s:Envelope>

url: http://192.168.1.53:49152/ctl/OHPlaylist,
=>SOAP Action: urn:av-openhome-org:service:Playlist:1#Insert,
=>SOAP xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:Insert xmlns:u="urn:av-openhome-org:service:Playlist:1"><AfterId>0</AfterId><Uri>http://192.168.1.50:5901/stream/swyh.wav</Uri><Metadata>&lt;DIDL-Lite xmlns=&quot;urn:schemas-upnp-org:metadata-1-0/DIDL-Lite/&quot; xmlns:dc=&quot;http://purl.org/dc/elements/1.1/&quot; xmlns:upnp=&quot;urn:schemas-upnp-org:metadata-1-0/upnp/&quot;&gt;&lt;item id=&quot;1&quot; parentID=&quot;0&quot; restricted=&quot;0&quot;&gt;&lt;dc:title&gt;swyh-rs&lt;/dc:title&gt;&lt;res bitsPerSample=&quot;16&quot; nrAudioChannels=&quot;2&quot; protocolInfo=&quot;http-get:*:audio/l16;rate=48000;channels=2:DLNA.ORG_PN=LPCM&quot; sampleFrequency=&quot;48000&quot; duration=&quot;0&quot; &gt;http://192.168.1.50:5901/stream/swyh.wav&lt;/res&gt;&lt;upnp:class&gt;object.item.audioItem.musicTrack&lt;/upnp:class&gt;&lt;/item&gt;&lt;/DIDL-Lite&gt;</Metadata></u:Insert></s:Body></s:Envelope>
<=SOAP response: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:InsertResponse xmlns:u="urn:av-openhome-org:service:Playlist:1">
<NewId>84</NewId>
</u:InsertResponse>
</s:Body> </s:Envelope>

SeekId: 84
url: http://192.168.1.53:49152/ctl/OHPlaylist,
=>SOAP Action: urn:av-openhome-org:service:Playlist:1#SeekId,
=>SOAP xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:SeekId xmlns:u="urn:av-openhome-org:service:Playlist:1"><Value>84</Value></u:SeekId></s:Body></s:Envelope>
<=SOAP response: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:SeekIdResponse xmlns:u="urn:av-openhome-org:service:Playlist:1"></u:SeekIdResponse>
</s:Body> </s:Envelope>

url: http://192.168.1.53:49152/ctl/OHPlaylist,
=>SOAP Action: urn:av-openhome-org:service:Playlist:1#Play,
=>SOAP xml:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><s:Envelope s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><u:Play xmlns:u="urn:av-openhome-org:service:Playlist:1"/></s:Body></s:Envelope>
log: Received request /stream/swyh.wav from 192.168.1.53:53902
Now have 1 streaming clients
<=SOAP response: <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><s:Body>
<u:PlayResponse xmlns:u="urn:av-openhome-org:service:Playlist:1"></u:PlayResponse>
</s:Body> </s:Envelope>
dheijl commented 4 years ago

Conclusion: the push event gives an invalid dropdown index... I'll contact the fltk-rs guy. Your pc is probably too fast generating events.

Edit: https://github.com/MoAlyousef/fltk-rs/issues/311

MoAlyousef commented 4 years ago

Hi

I've been trying out the code, and the event handling works fine on my windows 10, even without the recursion check. The high value you might get is the -1 returned by butascc.value() after casting to usize. The -1 denotes nothing is chosen. (I should add a note in the docs). Also unhandled events should return false: ``` => false, ```

And I think I found OP's bug:

image

Menus in fltk treat forward slashes (as in "Speaker / Headphone (Realtek ...)") as submenus. So choosing "Speaker" gives an index of 0, and choosing "Headphone (Realtek ...)" gives an index of 1.

If we change the handling code to:

                let i = butas_cc.value();
                println!("{}", i);
                if i < 0 {
                    return false;
                }
                let name = devices[i as usize].name().unwrap();

This would panic if I choose "Headphone (Realtek...)" which gives an index of 1 and it's out of bounds and panics, and really Speaker/Headphone should only be 1 device only.

Other than that, I would be interested in OP's pc spec. What architecture is your machine? Some 64 bit programs might run on 32bit but 64 bit capable machines, I think. Maybe some of the libraries are built for different architectures. If it's also possible to build swyh-rs from source, also removing the fltk-bundled feature flag from the Cargo.toml. Sometimes minor abi problems arise from linking to prebuilt binaries.

I’ll also take a closer look tomorrow.

dheijl commented 4 years ago

Hopefully fixed in 0.8.9 (https://github.com/dheijl/swyh-rs/releases/tag/0.8.9) with the help of @MoAlyousef .

dkent600 commented 4 years ago

The dropdown selection problem is fixed! Thanks!

So now I am able to to test the low noise problem with the Hi-Fi driver. I find that the noise is gone, using that driver.

@dheijl Can you please review for me why you think the realtek driver would have such bad sound in this circumstance? It does not exhibit this behavior when playing straight from the computer (as opposed to through SWYH-rs and Volumio). Thanks!

dheijl commented 4 years ago

Glad that it finally works and thank you for the patience and the testing!

Laptop audio devices are not known for their quality, they try to make the sound acceptable for laptop speakers. And Realtek drivers do not have a good reputation in the Audacity forums. It also seems that you have to check exclusive mode in the sound control panel to avoid resampling by Windows (https://manual.audacityteam.org/man/tutorial_selecting_your_recording_device.html). I thought that WasApi bypassed the audio drivers but this does not seem to be the case giving that you have to match the sample frequencies. I always use HiFi cable as the default device and route applications to the real audio device in the sound mixer if necessary.

Edit : https://docs.microsoft.com/en-us/windows/win32/coreaudio/loopback-recording explains it: if the hardware supports it, the sound is captured from the hardware, otherwise you get the original source. So I think the Realtek supports it, giving you the bad sound.

Could you -as a last favour- post the specs of your laptop here for @MoAlyousef, I think he would like to hunt for the recursion problem .

dkent600 commented 4 years ago

@MoAlyousef

image

dheijl commented 4 years ago

Thanks!

dheijl commented 4 years ago

Is it OK to close this issue?