Standalone not connecting to audio interface
Hi, I am trying to create a standalone app. I have created my patch and everything is working fine, it is making noise. I have it configured for presentation mode, everything is working fine and it is making noise. When I then create my standalone it no longer makes noise.
I can see the soundfiles playing in the audio meters and I have created a troubleshooting area where you can select the Scarlett Focusrite audio driver, it appears to be selected but there is no communication between the standalone and the Focusrite interface. What have I missed out?
I have gone through adding a standalone object and searched for missing files. I have re-written the app making extra sure the sound files have been copied in the application. I don't think it is a missing files problem
are you using macOS ?
yes I am using a mac M1 running Monterey and Max 8
did it ask you to grant permissions to use audio ?
it keeps asking for permission to access my documents folder and to use the mac microphone but not to use audio
that means you have permissions problem.
Maybe need to sign app
there are some instructions here in the forum.
for distribution
could you explain what 'sign app' means please?
read the stuff in the links.
all is explained there.
sorry, yes I am in the process of doing that now ...
to adhoc sign standalone, open terminal and :
sudo xattr -cr dropapphere
then
codesign -s - -f dropapphere
or for pre macOS 13
codesign -s - --deep -f dropapphere
thanks, it's late here now and I shall have a look at this in the morning. Thanks for your help thus far!
I ended up trying the adhoc sign you suggested and it did cause it to run a verification upon opening the app but it didn't solve the problem with the interface. I was also, again, asked for permission to access documents and microphone and no sound.
can you see your app listed in allowed software ?
In system settings ?
I am not using that new MacOS for exactly that problems, so can't tell you exactly where to look, it differs depending on MacOS version.
I guess you use latest max version ?
Hi -- having perhaps similar issue with standalone I just built from a project on Sonoma 14.5, Max 8.6.3.
The app opens and makes noise / works as expected. It's made of max objects and msp64 objects -- and gen~ codebox (which is apparently a max object).
However:
The app asks for permission (twice upon first open, usually just once upon subsequent opens, sometimes three times) to access documents (I "don't allow" permission and app still works). If left to run with DSP on for a few minutes, the app may ask again to access documents...
I use speakers but no microphone. I use sfplay~ to read audio from disk, which works fine (without permissions). If I do enable the microphone as input in audio settings, I am able to give the app permission just fine to use microphone, and the app appears in my system preferences/privacy/microphone.
When I open the standalone, Max console also shows error messages:
"newobj: no such file in collective" -- what does this mean?
shows "Gen working in runtime mode" as expected.
Then, when I turn on DSP, console reads:
"theme_constructor.js: Javascript ReferenceError: Dict is not defined, line 3" -- what does this mean? didn't think I was using any js.
"sprintf: no such file in collective" -- prints this message ~4x per second. I do not have a sprintf object anywhere in the project, so it makes sense that it is not in the collective.
I USED to have sprintf in an old version of the project AND I was using it to handle automatically reading a text file from the "data" folder of my project, all of which is ultimately in the "documents" folder. It did this on loadbang. I changed this when I made the standalone by simply including the file and referring to it by name alone, no path, also reading on loadbang. I wonder if somehow the standalone is remembering that a previous version of the project used sprintf to read from a folder in "documents."
@SOURCE AUDIO -- I have seen you mention elsewhere that you prefer to build standalones from patches without using projects. I am a complete beginner in programming. How would I go about doing this? I'd like to make my standalone as small as possible!
Thanks.
rjg
Only way I could help you is if you upload your patch.
Or zipped project if you have dependencies there.
Just guessing is a loss of time.
If you want to keep your project private, but trust me enough to allow me to peek inside
then we can figure out how to transfer the file(s).
thanks, I will have a deep look inside later today,
but allready a look at standalone inspector :
you did not specify app indentifier and preferences name.
Do you need to build this for your personal use, and for which platform / MacOS ?
I ask because of standalone size reduction.
What should standalone be named ?
App identifier -- I just now set it to com.rjg-123.toad_box but I have very little idea what this is. Checking online, I can see that an apple bundle identifier is formatted in reverse domain name notation, which I am guessing is this, which I am to understand is different from an app ID? And I have to actually register with apple as a developer if I want that identifier to mean anything to gatekeeper or SIP?
Preferences name -- I just now set it to "toad_box".
Standalone can be named "toad_box" or "toad box".
I'd like the standalone for personal use and very limited distribution via download or private transfer. It is ok if it only works on apple chip macs. Ideally I could also make separate versions of the app for windows and older macs.
Also, if you want to test the app, I recommend using an audio file containing only spoken word, like a chapter from an audio book or a poetry reading. Or you can load in any audio file and turn off "vocals" to listen to the patch alone. It won't make noise if you don't hit the first or second preset (both are the same right now, heh).
1- You need to name main patcher same as app should be named
2- Project format is bad for building standalones , at least for me and the way I prefer to do it.
I have built one standalone out of your patch, and have no problems with it on Sonoma MacOS. but I have no silicon mac, only intel.
Because of gen used, one needs to include clang.mxo extension which alone is
150 MB size.
If you would do without gen, either by using msp objects, or compiling RNBO external out of GEN code, one could reduce app size further.
now it is 209 MB, and has both Intel and arm processor included.
If you need only arm, one can remove Intel code and make it quite smaller.
I will modify app name, bundle indentifier, and compile it again.
Sorry but I don't want to inspect your programming, only help you to compile working standalone.
BUT - YOU MUST SET min - max values for ALL GUI Elements !
look at this

I don't want to loose my time fixing it...
please upload main patch with all that fixed.
Also do you use mono or stereo input ?
.......
to remove java from app, one needs to reprogramm audio status patcher which is full
of bullshit dependencies.
Ok thanks, I will fix main patch name and number box min - max values and re-upload. hopefully tonight.
I use mono input.
Did you put those random values in there to show me that I should set min - max values (in which case, yes, makes sense), or was there something that triggered those values to appear?
I will also look into making a RNBO compile out of those gen~ patches, although... it will cost me $299. lol. Is that the only option for compiling gen patches? Or maybe I will need to spend some time learning to write a max external in C that does the same as my gen patches.
Is re-programming the audio status patcher a very involved thing? How much space would be saved? Diminishing returns? In any case I am curious...
Here's the updated patch. Fixed GUI min-max and name.
To clarify, I use mono insofar as adding channels 1 and 2 from the ADC together and then multiplying by a scaling factor is mono. So if you wanted to put two audio channels into the patch, it would work. But it's not important for the patch, and anyway input is treated as if it is mono. I don't mind using only channel 1 input if that makes a difference.
Output is in 2 channel stereo, and that's important.
Also, when I saved as project to re-name the main patch while preserving search paths, the "code" folder that holds the gen~ patches was not copied to the new project folder. And yet Max found the gen~ patchers just fine. How or why does this happen... anyway, I manually added the gen~ files to the zip folder.
Is it possible to add files or directories to the search path of just 1 patch without making it a project? I know you can add user search paths to max in general.
For the time being I am OK with including the huge clang.mxo extension. I will look into getting rid of it, but for now I need gen~ and I still would like to know how to package this app without all the other unnecessary stuff.
I would anyway go from project to simple, one folder for all files you need.
I used that to compile your first app.
All you need is to place ALL files for your project into a folder.
You can reduce number of files, by placing abstractions into
subpatchers,it is than easier to edit patchers on the fly.
Another question - why do you read chart_03.txt instead of
embedding coll ?
One can embed AND read external file if one wants to override embedded data.
One searches for a file, if it does not exist, use embedded,
if it is found read data from it.

grab is there to avoid sending of length out from coll
or only embedded - no need to querry length

..........
I can not test your patch really because it is so overloaded, I have no computer that can
run that CPU wise.
I7 quad core 4 x 3.9 Mhz is not enough.
.......
your min-max values seem not to fit, what should one do ?
it is wrong for most parameters...

if you need 4, 8 or 16, use umenu.


..........
did you change anything else than standalone/name and ranges ?
I did add few things, like patcher window handling etc.
Do you need any informative print to max console other than errors ?
In the meantime , I'd post few infos about standalone building.
Project does not offer options to include files, or exclude externals,
like "normal" build procedure.
there is another wrong thing about it :
Standalone apps built from projects share Cycling '74 folder in user's
Library/Application Support to store preferences !
"normal" built apps have own folder.
For various reasons I build my apps like this:
keep all dependencies in one dedicated folder together with main patcher
1 set correct values in standalone inspector.
2 build app
3 delete mxf file
4 build mxf again using excludeexternals true line on top of build script.
4 run app and look into console for any errors, missing files etc.
depending on Max version all or some externals would allready have beeen copied ...
5 using list of all externals, abstractions etc that main patch uses,
check that all is in the app bundle
6 get rid of all unneeded files
frameworks, extensions, externals, packages , interfaces, simply everything that my app does not need.
7 edit info.plist file, insert custom icon ...
8 when all is ok, I sign it adhoc
if platform it needs to run is known, strip intel or arm code to reduce app size to half, but do so before signing.
.........
Sometimes I don't build app at all but collect pieces from Max app
and make it manually.
You copy/rename runtime binary and all other needed parts into folder and
add .app at end.
on Mac only 2 files need to be edited :
1 info.plist file
2 .rsrc file which is leftover from old days, and carries only
one single relevant string : name of preferences folder.
abstractions to subpatchers — will do. originally I was making subpatchers rather than abstractions. but while working I would often lose all contents of subpatchers when re-naming (triggering re-load... was I doing something wrong?) and was unable to retrieve content with "undo". so I saved all subpatchers as abstractions for safety.
embedding in coll — didn't know about @embed. originally was reading from multiple .txt files, now only one, though I'd like to have option to add more. I will embed chart_03.txt and make option to override as you say.
cpu-wise — yes so intensive... I think owing to the number of poly~ instances (500, down from 1000 lol) I use for main synth, plus other poly~ instances for other synths. could potentially use mc objects instead, as I think audio is active anyway for most instances of poly, most of the time. FYI on my M1 mac with signal vector = 1024, scheduler in overdrive, right now it does ~30-40% cpu. I've run it for hours with no problems. Is that crazy high?
grab — wow. I didn't know about this object. thank you.
GUI min-max — those parens are just recommended values. sorry; it's not obvious. added comment. I did adjust min-max on number boxes so that none of the values will break anything. I want to recommend some values but leave patch open to values outside of normal range. for fun.
changes — yes, I did add some more number boxes to display certain values (read-only). and now I have a made even a few more small edits.
max console — I don’t need it nor do I want it.
patcher window handling — what is this and how do you do it?
Is there a message I can send to max to switch in and out of presentation mode? for a button to press in standalone to get out of presentation mode.
I will try to stop making small edits, clean everything up, and build the standalone as you describe tomorrow. See where that gets me.
Thanks for this help. C74 should either pay you to do a standalone tutorial series or ban your account for speaking ill of projects.
here you can see window and presentation mode setup.

you have to keep 2 toggles at visible window coordinates.

on Mac you can select items and use command k / l
to hide or show them on lock. You hide 2 toggles before compiling.
I would suggest to remove big pannel, and use bgcolor in the patch because
selecting per drag is difficult.
here is what I added to your patch (removed big panel)
and here is java free audio setup patch.
place it into interfaces of your standalone
I actually have standalone ready to send to you,
but wanted to wait till you sort things out.
Best would be to give you root standalone with all it needs at this moment
and instructions how to easily compile mxf file to update it.
But that can work as is only as long you don't add more stuff
which suddenly needs more resources, like extensions or other stuff.
max console can be removed completely, but ...
it is helpfull to keep it as long as app gets added resources,
because any missing external or error otherwise can be seen there.
.......
arm64 only app is about 100 MB size
I added this icon just to have something to add into resources.

if you prefer something else post icon
or png 1024 x 1024
.....