Example #1
0
        public override AudioSamples ReadMonoSamplesFromFile(string pathToSourceFile, int sampleRate, double seconds, double startAt)
        {
            int stream = streamFactory.CreateStream(pathToSourceFile);

            float[] samples = resampler.Resample(stream, sampleRate, seconds, startAt, mixerStream => new BassSamplesProvider(proxy, mixerStream));
            return(new AudioSamples(samples, pathToSourceFile, sampleRate));
        }
        public float[] ReadMonoSamples(int sampleRate, int secondsToRecord)
        {
            if (!IsRecordingSupported())
            {
                throw new BassException("No recording device could be found un running machine");
            }

            int stream = streamFactory.CreateStreamFromMicrophone(sampleRate);

            return(bassResampler.Resample(stream, sampleRate, secondsToRecord, 0, mixerStream => new ContinuousStreamSamplesProvider(new BassSamplesProvider(proxy, mixerStream))));
        }
Example #3
0
        public override AudioSamples ReadMonoSamplesFromFile(string pathToSourceFile, int sampleRate, int seconds, int startAt)
        {
            int stream = streamFactory.CreateStream(pathToSourceFile);

            float[] samples = resampler.Resample(stream, sampleRate, seconds, startAt, mixerStream => new BassSamplesProvider(proxy, mixerStream));
            return(new AudioSamples
            {
                Samples = samples,
                Origin = pathToSourceFile,
                SampleRate = sampleRate,
                Duration = (double)samples.Length / sampleRate
            });
        }
        public float[] ReadMonoSamplesFromFile(string pathToSourceFile, int sampleRate, int seconds, int startAt)
        {
            int stream = streamFactory.CreateStream(pathToSourceFile);

            return(bassResampler.Resample(stream, sampleRate, seconds, startAt, mixerStream => new BassSamplesProvider(proxy, mixerStream)));
        }
Example #5
0
        public float[] ReadMonoSamples(string url, int sampleRate, int secondsToRead)
        {
            int stream = streamFactory.CreateStreamFromStreamingUrl(url);

            return(bassResampler.Resample(stream, sampleRate, secondsToRead, 0, mixerStream => new ContinuousStreamSamplesProvider(new BassSamplesProvider(proxy, mixerStream))));
        }