Giter Club home page Giter Club logo

jacksharp's Introduction

Due to Github's determination to be the "world’s leading AI-powered developer platform" I will move my projects to Codeberg

Jack-Sharp

Jack-Sharp is a .NET/mono binding for Jack, and contains multiple: JackSharp, Jack.NAudio, and Jack.CSCore. The latter projects are bindings of JackSharp for NAudio and CSCore.

Tested Platforms

  • Debian GNU/Linux sid amd64 and i386
  • Windows 8.1

Dependencies

  • Jack
  • .NET >= 3.5 or Mono >= 2.4.0

JackSharp

C# Wrapper around libjack API. Uses the following classes to structure the API into manageable chunks. Abstracts away all pointers.

Install via NuGet: nuget install JackSharp.

Client: Base Class for Processor and Controller

Emits events on general Jack information, that consumers can subscribe to. See the source code comments for details.

Processor

Audio and MIDI client. Useful for creating an application with inputs and outputs.

Add your logic for processing a buffer on audio and MIDI input and output by adding a Func<JackSharp.Processing.ProcessBuffer> to ProcessFunc of an instance of JackSharp.Processor. Multiple methods can be added and removed.

Controller

Client for controlling the Jack server and connections. Useful for creating a control application.

Can connect and disconnect ports of different applications.

If your application needs functionality from both Processor and Controller, then you must create instances of both classes in your consumer with different names.

Jack.NAudio

Binding for JackSharp.Processor for NAudio. It contains implementations for IWavePlayer and IWaveIn.

Install via NuGet: nuget install Jack.NAudio.

Jack.CSCore

Binding for JackSharp.Processor for CSCore. It contains implementations for ISoundOut and ISoundIn.

Install via NuGet: nuget install Jack.CSCore.

Running Unit Tests

Running unit tests can be a bit tricky, as some unit tests require an already running instance of Jack, while others require, that Jack must be started by the tested objects themselves.

The following test class from the project JackSharpTest must be run without Jack:

  • ServerStartTest

jacksharp's People

Contributors

residuum avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

jacksharp's Issues

MIDI-In not working correctly.

Bug reported via email:

Hi,

is MIDI-in working with JackSharp? I'm trying to just receive MIDI
from my controller. I receive events, but they don't contain any data.
Here is what I do:

 foreach (MidiEventCollection<MidiInEvent> eventCollection in items.MidiIn)
 {
     foreach (MidiInEvent midiEvent in eventCollection)
     {
         if (midiEvent.MidiData.Length > 0)
         {
             Console.WriteLine ("Hurray!");
         }
         Console.WriteLine( BitConverter.ToString (midiEvent.MidiData) );
     }
 }

midiEvent.MidiData is always empty (and 0 bytes long).

Rerouting audio output of some applications

I would like to reroute output of some applications to selected device. For example the output from game to headphones, output from browser to loudspeakers, etc. How I can realize that idea, and this possible with this library or not?

Process Audio

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!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.