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
Ardour Support #5
Comments
Thank you John for your help with git. I think I finally managed to have a local fork of the Ardour/aaf branch that is not detached, and which can be synced with Ardour/aaf. It's in ardour_aaf_support/aaf, note that the aaf branch is now set as default. I successfully did a bunch of commits last night.
I think it is due to my struggling with git and the ardour_aaf_support repos, I have also seen weird stuff at some point. Have you tried to start a brand new clone of the ardour_aaf_support/aaf branch ? |
Thanks for the quick response Adrien. I guess I could ditch my existing repo and clone it all over again but it's taken me the best part of 2 days to make 'adour_aaf_support buildable with MSVC - so I'd prefer to leave that as a last resort. In the first instance I'll try switching to the AAF branch. In theory, that should carry on working here and hopefully it'll accept your future updates. |
Yes, that's building fine here (though it'll be a few days before I get around to building the aaf branch that Robin's added...) In the meantime @agfline, did you manage to reproduce those problems I reported relating to 100_BARS.aaf? It'd be interesting to know if they're reproducible with your (Linux?) code - or if they're only showing up in Windows. |
Indeed, I got the |
Got it... |
missing pack attribute on riff chunk structures Ardour/ardour#805 (comment) #5 (comment)
Great news! I'll test it here later today and let you know. |
Hmmm... I tried 100_BARS.aaf here and it no longer shows me the strange sample rate and bit depth. It even creates a .ardour session now - BUT - I'm seeing exceptions now at line 212 in aafi_release() (in AAFIFace.c ) :-
and when I later try to load the generated .ardour session, it still contains no audio :-( |
Ok. No time to fix it before tonight, but meanwhile you can try to add |
Hi Adrien - I added a --media-location path and just for the hell of it, I configured my debugger to skip the crashing line temporarily. But although it then didn't crash, the created session still doesn't contain any audio when loaded into Ardour. Basically, media files still aren't getting created at the moment. |
Did you set |
No I didn't set --media-cache, only --media-location (I'd never needed to set either of them up to now...) I'm just closing down here for the night but here's the output i see when the problem occurs:-
|
Those are Ardour messages I don't have with Linux. Don't know if they are important or not.
Explicitly says media cache was not set. Before I made the Actually when you are working with embedded files you have to set |
I'm pretty sure they're not.
It seemed to work for me - but anyway... I've now set --media-cache to be F:/ here and it does produce an audio file called F:/100_BARS _1.wav - although it hasn't helped much. I see a problem now in the first two lines of import_sndfile_as_region(), namely:-
and needless to say, the code crashes almost immediately :-( My guess would be a possible problem with character encoding. Maybe you're assuming that strings here will either be narrow character or wide character? But if you're obtaining those strings from the Ardour code, they'll almost certainly be getting returned in UTF-8 format. |
It didn't occur to me yesterday but this morning I realised something:- F/10BR 1wv is in fact every alternate letter from F:/100_BARS _1.wav (and with the NULL terminator missing) So maybe not a problem with UTF-8 but surely this is some kinda problem with character encoding?? |
And something else just occurred to me...
By a stroke of luck I'd chosen F:/ as my extract location and I just noticed a huge bunch of spurious .wav files from the past few weeks (which I didn't put there...) So it's looking like the code wasn't set to the user's temp folder on Windows - but in fact it'd been trying to use the root folder of whichever drive the sessions were getting created on. And if that drive happened to be the user's C:\ drive, that'd definitely explain why the software wasn't being allowed to write its .wav files there. |
Indeed, that makes sense. The
I'm going to investigate this today. |
Since I don't know how to build Ardour on windows, I just made a small Cpp test program to reproduce your issue on windows, testing against the same 100_BARS.aaf file. |
Yes, in fact I updated it again this morning and I still see the problem. Whereabouts does audioEssence->usable_file_path get assigned? I'll try putting a breakpoint there and see if the assignment looks okay. |
In your case (embedded audio file extraction) : LibAAF/src/AAFIface/AAFIAudioFiles.c Line 1623 in 3bacf0f
|
Okay, I can see a couple of problems. Firstly, swprintf() expects the number of characters to print, not the number of bytes. So you don't need to multiply by sizeof(wchar_t)) And this surprised me a bit but L"%s", filePath doesn't seem to produce a wide-character string here. You'd think it would but it didn't when I tested it. In the end, I made it work by using:-
That corrected this particular issue but I then hit a new set of errors:-
and Windows tells me that 100 BARS _1.wav is an invalid WAV file. I'm really quite surprised that any of this works for you ! |
Thanks for pointing that out.
Well, it does actually work on my Linux and Windows VM. I didn't know about
Can you send me that wav file so I take a look ?
And yet, it does work pretty well ! And I hope it will be soon working for you as well ;) |
Yes, give me a few minutes and I'll send you 100 BARS _1.wav. In the meantime I found this article which explains why L"%s" doesn't work:- it seems that for the wprintf range of functions, L"%S" would need to use an upper-case 'S' to accommodate 'filePath' being a narrow character string. We're slowly getting there :-) |
Just made an hash comparison between your file and mine and... they are exactly the same. There are multiple ways to embed audio in AAF. In 100_BARS.aaf, each audio file is stored as a complete AIFC file. In such case, the extraction process is simply to take the file data stream, and to write it somewhere on your disk. There is still an issue with file extension being
Wouldn't be some reading persmission/access issue ? |
I suspect it's yelling about the fact that it's not a WAV file. For every other WAV file here (including your older ones) the first 12 bytes invariably look like this:-
But your newer ones don't have that section any more - so maybe there's some other header info missing too ? |
Like I said, it's not a WAV file, it's an AIFF/AIFC file with |
I just made a change to test that out. I have a lot of other uses of Also fixed the |
I'm afraid it's not good news Adrien. I built Ardour from last night's git and it compiled and linked fine. I then imported a very simple AAF here with only around 7 clips and that worked fine too. So I then tried a bigger import which used to import okay. The latest code does import a few clips but the majority are now producing errors which look like this:- [Edit...] BTW it seems to be creating the right number of audio files and they're the right size but it's not creating their timeline clips for some reason. Any ideas..? |
Well, don't know if that's related but there is obviously an issue with the construction of unique file names (with all those weird spaces...). |
This one's an embedded AAF file and too large to upload anywhere (> 400MB) so I've run the latest aaftool.exe and I'll email you the result in a few minutes. |
Thanks John. First, the log shows no error and that there is no problem with the building of unique essence name. Instead it shows that those white spaces in essence names are coming from the AAF file itself. Never seen such a thing, it seems that those white spaces fill a 31 bytes string length + 1 NULL termination in origination software. That is weird, but I doubt your final issue is coming from those spaces. Can you tell if the non-importing files actually exist ? If they where successfully extracted or not ? If they are playing well with any audio player ? |
I've got the same .ardour session here which got imported a few weeks ago, using Mixbus rather than Ardour. However, if I rename the newly created .ardour file from today and substitute the older one from Mixbus, all the expected regions will then appear on my timeline. And I do see the channel meters going up and down but unfortunately, I can't hear any actual audio. The Mixbus file references a Mixbus master channel but the Ardour / Mixbus master channels don't seem to be compatible any more (audio-wise) But having said that, if I navigate to today's files just using Explorer, they're all conventional .wav files so if I double-click them, Windows does play the expected audio (i.e. the media files all got imported fine...) |
Regarding Ardour logs and aaftool.exe, all files are embedded as AIFC so they should be extracted as .aif not .wav (eg. By any chance, do you have encountered the same issue with a smaller AAF file you could send ? |
I haven't encountered it yet in any smaller AAF's here but something just occurred to me... Might this be a consequence of us stripping space characters from the end of directory names? Windows won't allow a directory name to end with a space character - although they're obviously legal in a file's name. |
I don't think so... Stripping spaces doesn't consider file extension, in your case spaces are in the middle of the name, before file ext. Plus if you say that file was working before, it means that the issue is coming from the recent update, either in libaaf or in The AAF size does not matter here. I successfully import 52min/embedded documentary with no issue. Can you try to import |
I'll give it some thought overnight but I'm pretty sure this'll come down to the whitespace issue. e.g. instead of looking for a .wav file with a name like "TITLES<followed by 25 spaces>.wav" (which would be the correct name) we might now be expecting the .wav file to be called "TITLES.wav" (with no spaces in the name) and therefore the audio wouldn't get found, which might then prevent its region from getting created.. Hopefully Robin can offer his thoughts. It's a theory I can easily test but it'd need to wait until tomorrow. |
Is it a RIFF (.wav) or AIFF (.aif) file? What does sndfile-info say? |
It's embedded into the AAF as an AIFF file (essences are described with AIFCDescriptor and FileDescriptor::Summary is a valid AIFC header). It's common when exporting an AAF and forcing essences to a specific format (here, AIFF), that essence names remain as the original source file (here the original wav filename). Note that AAF says AIFC but standard does not support compression...
That's why libaaf appends .aif to essence name. |
What seems to happen during an import is that Session::import_files() gets called for files which have been created temporarily in a cache. But sometimes the cached file didn't get created. I've no idea why but I don't think it's connected with having spaces in the name. Adrien - can you let me know whereabouts the cached file would get created (I assume your code must do this??) If I know where it's getting created, that might help me to figure out why some creations fail. |
Cached files are created in OS dependent temp directory. In your case cache path is printed in Ardour logs : |
Sorry, I meant whereabouts in your code will the cached files be getting created? Each audio file seems to get initially created in the cache folder, then converted to wav (assuming it got successfully created) and then the cached version gets deleted before moving onto the next one. So I assume this is either under your control or Ardour's control? [Edit...] Could something like this be happening...
|
I think you're on the right path. Can you try replacing with
|
Thanks Adrien, that's fixed it. I temporarily went back to Mixbus (which I hadn't yet updated) and what used to happen was that a cache folder got created, then it got populated with lots of files, then at the end of the process, the whole folder got deleted. But what's happening now is that the cache folder only ever contains one file. So each file must've been getting deleted when it was in fact still needed for creating further regions. I haven't yet tried with a non-embedded AAF. Would they be likely to suffer from a similar issue? i.e. does this need a small rethink? |
There is no issue with non-embedded AAF, since we will never delete external existing files. You're right, before we waited for the all extraction process to finish before removing cached files. However, this caused serious memory overload and system freeze when extracting large embedded AAF to /tmp/ on linux. IMHO there are two solutions :
What do you think ? |
How about something like this (if it doesn't need a major revamp...)
That should guarantee that a region will always get created - but with only minimsal need to keep generating cache entries. Or if that'd involve too much of a revamp, I think your first option would be my preference. |
That's actually how it used to work in the previous version. If essence file were already extracted we used that file. However for this to work, the cache folder needed to be cleared after the import process had finished. The downside is the memory issue on Linux (system temp directory writes to the RAM). Consider an embedded AAF file with more than 2 or 3 GB of audio being extracted directly to RAM on a 4 or even 8 GB RAM computer... Maybe we can stick to option 1 for now, since it's guaranteed to work (with more or less performance drop depending on AAF file). Note that option 2 might also fail to preserve RAM in some very specific AAF compositions. @x42, any thought about it ? |
Only a minority of GNU/Linux systems use a tmpfs for
|
Of course if that's an option, it seems the most efficient. |
I've tried some further imports this morning and all seems to be working again. So while you're both deciding on a suitable way forward, can one of you commit that change to Ardour's version of libaaf? Even if it ends up being temporary it'll at least give Ardour a working AAF importer for users to test. |
Since this thread is already too long, here's a new one #28 |
This thread continues the discussion previously started here
The text was updated successfully, but these errors were encountered: