Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem processing stereo source as individual mono channels #3

Open
digi-chris opened this issue Nov 29, 2021 · 8 comments
Open

Problem processing stereo source as individual mono channels #3

digi-chris opened this issue Nov 29, 2021 · 8 comments

Comments

@digi-chris
Copy link

Hi,

I'm using a Raspberry Pi with a HifiBerry DAC2 Pro running Elk Audio OS and Sushi with VST plugins. This all works fine, but what I'd like to be able to do is treat the two input channels as individual sources, run independent VSTs on each source and then output to the outputs as if they are also two mono output channels.

Whatever I do, I can't get Sushi to run in this configuration.

To try to simplify this down and make sure it wasn't something to do with the VST plugins I was using, I set up what I think should be a properly-formatted configuration that treats the inputs as two separate sources and simply passes them through to the outputs. In theory, if this works, then I can just swap out the passthrough plugin for a VST and I should expect similar results.

Here is my config:

{
    "host_config" : {
        "samplerate" : 48000
    },
    "tracks" : [
        {
            "name" : "main",
            "mode" : "mono",
            "inputs" : [
                {
                    "engine_channel" : 0,
                    "track_channel" : 0
                }
            ],
            "outputs" : [
                {
                    "engine_channel" : 0,
                    "track_channel" : 0
                }
            ],
            "plugins" : [
                {
                    "uid" : "sushi.testing.passthrough",
                    "name" : "passthrough",
                    "type" : "internal"
                }
            ]
        },
        {
            "name" : "main2",
            "mode" : "mono",
            "inputs" : [
                {
                    "engine_channel" : 1,
                    "track_channel" : 1
                }
            ],
            "outputs" : [
                {
                    "engine_channel" : 1,
                    "track_channel" : 1
                }
            ],
            "plugins" : [
                {
                    "uid" : "sushi.testing.passthrough",
                    "name" : "passthrough",
                    "type" : "internal"
                }
            ]
        }
    ],
    "midi" : {
        "cc_mappings": [
        ]
    }
}

This setup simply responds with:

Failed to load tracks from Json config file

If I remove the second track (main2), it works fine.

Am I doing something wrong here, or is this an issue with Sushi?

Thanks,

Chris.

@stez-mind
Copy link
Contributor

HI @digi-chris ,
the plugin names should be unique.

Try to rename "passthrough" to e.g. "passthrough_1"

@digi-chris
Copy link
Author

@stez-mind, thanks for the quick reply.

I spent a lot of time looking at this, even reading through Sushi's code and still didn't spot this - thank you! I'll try it out tonight but that definitely sounds like the problem.

@noizebox
Copy link
Contributor

noizebox commented Nov 29, 2021

Hi @digi-chris, If you have a look at the sushi log file (in /tmp/sushi.log) it usually can provide more info on what's wrong in case the json config fails to load.

In addition, for your main2 track, I think that what you want is something like the config below, if I understand your intentions correctly. As this will connect the engine's 2nd channel to the 1st (and only) channel of the track.

    "inputs" : [
    {
          "engine_channel" : 1,
          "track_channel" : 0
     }
     ],
     "outputs" : [
     {
           "engine_channel" : 1,
           "track_channel" : 0
     }
     ],

@digi-chris
Copy link
Author

digi-chris commented Nov 30, 2021

HI @noizebox , thanks for the additional information... unfortunately I'm still not getting this set up how I'd like it. Basically I'm just trying to have the following:

Input 1 -> Passthrough -> Output 1
Input 2 -> Passthrough -> Output 2

But I don't want these passed through as stereo, I want to process them as individual tracks, so eventually I can have:

Input 1 -> VST_1 -> Output 1
Input 2 -> VST_2 -> Output 2

I should be able to process each input independently and then output them to separate outputs.

Changing the names of the passthroughs alone as per @stez-mind's suggestion got me closer to a fix, but still failed to load the tracks.

Using the additional information from @noizebox makes both inputs passthrough to the same output, like they are being mixed together.

As far as I can see, it should work if I just keep my original config but change the passthrough names, however I get the error message Failed to load tracks from Json config file.

sushi.log gives this additional piece of information:

[jsonconfig] Error connecting input bus to track "main2", error 10

@noizebox
Copy link
Contributor

Maybe you've misunderstood how the inputs and outputs to the tracks are configured. "engine_channel" in the list of connections refers to audio inputs/output to sushi itself, with the hifiberry stereo dac as 0 and 1 (left and right). "track_channel" refers to channels on the track you're connecting to or from. And mono track only have 1 channel, which is why using anything other than 0 for "track_channel" gives an error.

I tried your config (with "track_channel" set to 0 on main2) on the latest sushi build (0.12.0) running with jack, and it does what you want. I.e. 2 completely separate mono tracks with no crosstalk between them. It should on the raspberry too.

@digi-chris
Copy link
Author

digi-chris commented Nov 30, 2021

@noizebox thanks, yes I see what you are saying and I had misunderstood how to identify the tracks (I was assuming it was a 'global' track number, rather than a track number related to the engine channel).

I'm using Sushi v0.12.0 here, and using the following config, I'm getting both input channels out of the same output channel:

{
    "host_config" : {
        "samplerate" : 48000
    },
    "tracks" : [
        {
            "name" : "main",
            "mode" : "mono",
            "inputs" : [
                {
                    "engine_channel" : 0,
                    "track_channel" : 0
                }
            ],
            "outputs" : [
                {
                    "engine_channel" : 0,
                    "track_channel" : 0
                }
            ],
            "plugins" : [
                {
                    "uid" : "sushi.testing.passthrough",
                    "name" : "passthrough_1",
                    "type" : "internal"
                }
            ]
        },
        {
            "name" : "main2",
            "mode" : "mono",
            "inputs" : [
                {
                    "engine_channel" : 1,
                    "track_channel" : 0
                }
            ],
            "outputs" : [
                {
                    "engine_channel" : 1,
                    "track_channel" : 0
                }
            ],
            "plugins" : [
                {
                    "uid" : "sushi.testing.passthrough",
                    "name" : "passthrough_2",
                    "type" : "internal"
                }
            ]
        }
    ],
    "midi" : {
        "cc_mappings": [
        ]
    }
}

So, it appears to be working like this:

Input 1 -> passthrough_1 -\
                          |--> Output 1
Input 2 -> passthrough_2 -/

Can't really figure out why. If I set it up in a more normal configuration using a single stereo track, then both tracks are utilized correctly.

Thanks for your help with this, really appreciate it.

@noizebox
Copy link
Contributor

Then that sounds really strange. It shouldn't behave like that. The only thing I could think of then is some issue with the underlying driver for the hifiberry. I would have to test on one of those and then get back to you.

If you're able to get stereo separation with other configuration, then I would assume that it's not a purely electrical issue with the dac/output amp.

@digi-chris
Copy link
Author

Thanks @noizebox, at least I know I'm on the right track now. I was wondering if it could be an electrical issue in terms of a bad connection with the cables I'm using, but even that doesn't make sense because I can get stereo with a standard setup. I'll do some more testing just to rule out me being an idiot by using different cables and double-checking all the connections... but if not then I guess it could be a driver issue with the HifiBerry.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants