How to add Audio

Thanks for the info, I couldn’t find a DAW that supports JACK on all platforms, but I don’t have much experience outside REAPER (and other commercial DAWs).

I don’t want to start implementing JACK and down the road we find out that platform X is not supported or does not have any JACK-ed applications available.

Anyway, will read some docs etc, just wanted to know if anyone in the community had any “hands-on” experience with JACK on Win/Mac.

Currently Jack for Windows only supports 32-bit applications, but a new version is currently being tested that supports both 32-bit and 64-bit audio applications.

If this info is correct then the project is a no-go from the start.

I think that info is quite outdated. If this page is anything to be believed then 64-bit Windows Jack was being tested back in 2011 64bit JACK for windows: TESTERS NEEDED. | NI Community Forum

There’s a download for 64-bit Jack on their download page Downloads | JACK Audio Connection Kit

I’ll hopefully be in front of a Windows machine in the next couple of weeks so can test a couple of DAWs (Reaper and Ardour perhaps).

Ok, probably outdated then. I will tested myself as well, I think REAPER only support ASIO on Windows (REAPER+JACK works perfectly on Linux), If I read the docs correctly this does not matter as JACK supports ASIO, so any ASIO app should be able to connect to JACK.

The goal should be to just make a basic app that can control a DAW/player through JACK on all platforms, then start getting this integrated into Natron.

1 Like

After discussing audio sync on the facebook group I decided to hack a very basic JACK transport into Natron just for fun, it kind of works… The biggest issue is the latency from play in Natron to play in Reaper, I doubt it can be used as a perfect audio reference. I have also considered MIDI (MTC etc) to avoid the JACK overhead, but I’m not sure it’s worth my time going that route.

2 Likes

MIDI is the way to go!

Probably, will look more into this a the end of the week (mostly busy this week).

2 Likes

Out of interest why MIDI instead of Jack?

Did JACK transport ever get implemented?

Only on my laptop… I’m not satisfied with JACK, first I get a weird delay no matter what, and the solution (JACK) must be usable on all platforms supported by Natron.

I would like to try a pure MIDI solution instead (we should support MIDI anyway for “control panels”). Sadly I have been very busy this month, so progress is slow.

Are you using a real-time kernel with JACK? That might be your problem.

I’m using a regular kernel and have no issues with JACK using MIDI or regular recording, seems to be related to the JACK transport functions, the DAW’s (or any “client”) all have a delay when I trigger play/stop etc, JACK itself register my changes instantly.

It seemed to be a really wonderful solution, unfortunatelly in Blender 2.8 it doesn’t work anymore. :pensive:

Has anything happened with audio support since this thread?
Is it possible to render movs/mp4s with audio in any way?
I don’t need it in the UI, just when I use NatronRenderer, effectively copying a wav file into whatever mov/mp4 Natron renders.

No, audio is not on the roadmap.

You can make a Python script that does this for you in Natron, or mux the audio after render with ffmpeg.

Yup, found that solution last night, thanks!

To clarify in case others need it:
I added a user parameter to the Write node called “audio_file” with the python expression “audio_input”.
In ~/.Natron/init.py I defined this function:

import subprocess

def add_audio(aborted, thisNode, app):
    print("Adding audio...")
    audio_file = thisNode.getParam("audio_file").get()
    out_file = thisNode.filename.get()
    cmd = ["ffmpeg"]
    cmd.append("-i")
    cmd.append(out_file)
    cmd.append("-i")
    cmd.append(audio_file)
    cmd.extend(["-y", "-c", "copy", "-map", "0:v:0", "-map", "1:a:0", "/tmp/natron/test_with_audio.mov"])
    print("executing: {}".format(" ".join(cmd)))
    subprocess.Popen(cmd).communicate()
    print("Done")

Then I added the above function to the Write node’s post render callback:
image

With this setup I can use NatronRender to feed any audio file into the output mov.

EDIT:
Due to the user parameter erroring after a restart I ended up using an AudioCurve file’s audio parameter instead. The updated post-render script now looks like this:

import subprocess

def add_audio(aborted, thisNode, app):
    print("Adding audio...")
    audio_file = AudioCurve1.getParam("audio").get()
    out_file = thisNode.filename.get()
    cmd = ["ffmpeg"]
    cmd.append("-i")
    cmd.append(out_file)
    cmd.append("-i")
    cmd.append(audio_file)
    cmd.extend(["-y", "-c", "copy", "-map", "0:v:0", "-map", "1:a:0", "/tmp/natron/test_with_audio.mov"])
    print("executing: {}".format(" ".join(cmd)))
    subprocess.Popen(cmd).communicate()
    print("Done")

Cheers,
frank

1 Like