Override overloaded method

Hi all

After a post on it.discourse about making a script play a sound, I tried to script this

But was unable to translate this class to IronPython

public class SineWaveProvider32 : WaveProvider32
{
    int sample;

    public SineWaveProvider32()
    {
        Frequency = 1000;
        Amplitude = 0.25f; // let's not hurt our ears            
    }

    public float Frequency { get; set; }
    public float Amplitude { get; set; }

    public override int Read(float[] buffer, int offset, int sampleCount)
    {
        int sampleRate = WaveFormat.SampleRate;
        for (int n = 0; n < sampleCount; n++)
        {
            buffer[n+offset] = (float)(Amplitude * Math.Sin((2 * Math.PI * sample * Frequency) / sampleRate));
            sample++;
            if (sample >= sampleRate) sample = 0;
        }
        return sampleCount;
    }
}

The problem, as far as I can tell, is I don’t know how to make IP override the right overload of

Read()

Looks like it is overriding

WaveProvider32.Read( byte[], ... )

instead of

WaveProvider32.Read( float[], ... )

( Well … at least this is my understanding of the problem … )

Is there a way in IP to specify which method from an imported C# library it has to override ? ( For overloaded methods )

This is the IP code that fails, complaining about an impossible cast from float to byte:

import math
import time
import clr

clr.AddReferenceToFileAndPath( 'C:\\lib\\NAudio.dll' )

import NAudio as nau

class SineWaveProvider32( nau.Wave.WaveProvider32 ):

  def __init__( self ):
    self.Frequency = 1000
    self.Amplitude = 0.25
    self.sample = 0

  def Read( self, buffer, offset, sampleCount ):
    sampleRate = self.WaveFormat.SampleRate
    for n in range( sampleCount ):
###### offending statement below
      buffer[ n + offset ] = float( 
          self.Amplitude * math.sin( 2 * math.pi * self.sample *
          self.Frequency / sampleRate ) )
      self.sample += 1
      if self.sample > sampleRate:
        self.sample = 0
    return sampleCount

waveOut = None

def StartStopSineWave():
    global waveOut
    if not waveOut:
        sineWaveProvider = SineWaveProvider32()
        sineWaveProvider.SetWaveFormat(16000, 1) # 16kHz mono
        sineWaveProvider.Frequency = 1000
        sineWaveProvider.Amplitude = 0.25
        waveOut = nau.Wave.WaveOut()
        waveOut.Init( sineWaveProvider )
        waveOut.Play()
    else:
        waveOut.Stop()
        waveOut.Dispose()
        waveOut = None

seconds = 2
t0 = time.time()
StartStopSineWave()
while True:
  t1 = time.time()
  if ( t1 - t0 ) > seconds:
    break

Thanks