Dream, not what is, but what can be.

Real Ear Measurement using NAudio and Python.Net

Integrated Python For .Net and NAudio (ASIO sound drivers) for a Real Ear Measurement (REM) system.

Posted on Friday, August 19, 2016 7:24 PM


NAudio to record / play ASIO sound drivers

Using NAudio for record and play ASIO sound drivers

Posted on Friday, August 19, 2016 7:22 PM


Integrating Python into .Net app using Python For .Net

Using Python For .Net to call Python methods from C#

Also to call the methods from a class I had to decorate the Python class method with @ClassMethod

Also, still need to find a way to pass an array into the method. So far have to pass a List and convert in the Python method :(

PythonEngine.Initialize();
var lck = PythonEngine.AcquireLock();

PyObject pyportal = PythonEngine.ImportModule(@"SomePyFile"); // .py file
PyObject c = pyportal.GetAttr("ClassName"); // class name in .py file

PyList ls = new PyList(new PyObject[3] { new PyFloat(1.0), new PyFloat(1.0), new PyFloat(1.0) });
c.InvokeMethod("SomeMethod", ls).ToString(); // some method in ClassName

string fromPython = "";
for (int i = 0; i < 100; i++)
{
    fromPython = c.InvokeMethod("AnotherMethod").ToString();
}

PythonEngine.ReleaseLock(lck);
PythonEngine.Shutdown();

IronPython does not implement some CPython packages like scipy.fftpack - get cannot import multiarray from numpy.core error

Posted on Friday, August 12, 2016 2:42 PM


Tour de Tonka 2016

Rode 100 mile route with Kelly Fitz and Adrian Lister. Very fast - rode with the pack the whole way.

Posted on Saturday, August 06, 2016 6:49 PM


CSV with data containing comma

using Microsoft.VisualBasic.FileIO; //Microsoft.VisualBasic.dll
...
using (var csvReader = new TextFieldParser(fileName))
{
    csvReader.SetDelimiters(new string[] { "," });
    csvReader.HasFieldsEnclosedInQuotes = true;

    while (!csvReader.EndOfData)
     {
         string[] row = csvReader.ReadFields();
         ...
     }
}

Posted on Friday, June 17, 2016 12:20 PM


Azure Internet of Things (IoT)

Putting together an IoT concept app using Azure IoTHub, Service Bus, Event Hubs, Streaming Analytics, and Power BI using my MSDN credits. Good stuff. Next I will hook it up to a mobile app for an end to end demo.

Posted on Friday, April 22, 2016 6:40 AM


Azure Event Hub

Putting a ; at the end of an Azure Event Hub connection string causes an Invalid Token Error. Wow, frustrating.

Posted on Friday, April 22, 2016 6:39 AM


Clear IP addresses

To clear out cached IP addresses.

System.Diagnostics.Process.Start("ipconfig", "/renew");

// or to hide command window

System.Diagnostics.Process p = new System.Diagnostics.Process();
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.StartInfo.FileName = "ipconfig";
p.StartInfo.Arguments = "/renew";
p.Start();

Posted on Friday, April 08, 2016 8:51 AM


Get a registry value

Get a registry value, for instance the "version"

Version version = null;
using (Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(@"<path>"))
{
    if (key != null)
    {
        System.Object o = key.GetValue("version");
        if (o != null)
        {
            version = new Version(o as String);
        }
    }
}

Posted on Tuesday, December 08, 2015 2:05 PM


Infinity Symbol

PlatformKey typeDescription
PC windowsAlt+236Hold the ALT key and type 236 on the num-lock keypad.

Posted on Saturday, December 05, 2015 8:23 AM