Skip to content
This repository was archived by the owner on Nov 18, 2023. It is now read-only.
This repository was archived by the owner on Nov 18, 2023. It is now read-only.

Process Audio #3

@alvaroBT

Description

@alvaroBT

Hi, thank for this project.
My idea is get sound of the micro of my computer, distortion it and send the distortion sound to the output (Speaker).
This is my code:

        private Jack.CSCore.AudioIn _soundIn;
        private Jack.CSCore.AudioOut _soundOut;
        private JackSharp.Processor _client;
        CSCore.Streams.Effects.DmoDistortionEffect _distortionEffect;
        private CSCore.Streams.SoundInSource _source;

        private void StartProcess()
        {
            try
            {
                _client = new JackSharp.Processor("TESTING", 2, 2, 0, 0, true);
                _soundIn = new Jack.CSCore.AudioIn(_client);
                _soundIn.Initialize();
                
                
                _source = new CSCore.Streams.SoundInSource(_soundIn);
                _distortionEffect = new CSCore.Streams.Effects.DmoDistortionEffect(_source);
                _distortionEffect.Edge = 10;
                _distortionEffect.PreLowpassCutoff = 4800;

                _soundOut = new Jack.CSCore.AudioOut(_client);
                _soundOut.Initialize(_distortionEffect);

                _client.Start();
                _soundOut.Play();    
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception in StartProcess: " + ex.Message);
            }

        }

        private void StopFullDuplex()
        {
            if (_client != null)
            {
                _client.Stop();
                _client.Dispose();
            }
            if (_soundOut != null) _soundOut.Dispose();
            if (_soundIn != null) _soundIn.Dispose();
        }

These are the JAckAudio connections:
image 1

This code don't work. I don't listen the micro by the Blackwire (headphones) output.
Only listen the sound by the output if I add the event CopyInToOut to the Processor (without distortion)

JackSharpTest.Dummies.ClientReceiver receiver = new JackSharpTest.Dummies.ClientReceiver();
_client.ProcessFunc += receiver.CopyInToOutAction;
void CopyInToOut (ProcessBuffer processItems)
{     
	for (int i = 0; i < Math.Min (processItems.AudioIn.Length, processItems.AudioOut.Length); i++) {
		Array.Copy (processItems.AudioIn [i].Audio, processItems.AudioOut [i].Audio, processItems.AudioIn [i].BufferSize);
	}
	Called++;
}

How must I process the sound through CSCore for distorsion the input and send the result to the output of the 'TESTING' JackSharp.Processor?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions