Remembering VST presets in Max/Msp - audio

I am trying to get Max/MSP to remember vst presets for my patch. Every time I close the patch and re-open, the vst goes to default. The vst I am trying to use is called alchemy (free version). Does anyone know how to get max/msp to remember vst presets, does it vary for different vst's and audio unit plugins? Here is the link to download alchemy player.
http://www.camelaudio.com/AlchemyPlayer.php

The only way I know is to
get the vst~ object to list all its parameters,
get their values,
store them in a coll and save that coll to disk,
like so:
----------begin_max5_patcher----------
811.3ocyWtrbaBCEFdM9ofgt00CRb0sq5KP2zkc53Q1n5nLXAUR33lLoO6U5
HHgbwDriJ0K.acj.8qOet46l4Ert5.UF3+I+u664c2LOOvjwfW6XufcjCaJI
RXYAb5MUquNXtcJE8fBLWKn0Tdg+MBlh1M6Oq3JI6VpYEH7hvVyUMpRpR86Z
pciCB7+Q6T0D0lqX7sqDzMJ6rnjk5mzGmEa9HOBFDtH7gmgU.JPqpOhy5u0b
xNXGB9hfQJ6lg2riw06ObbPOZzpJqUiw6mMyba96iKRxdZgd2q1dxPYt8ZMg
ucL.JNwbOMeP9j5D9D4N9n7K8WeNnYrXIK0bOBuHY.rj3DrfOCrX.w5Fkphe
t9GLtpGGDTIkqHJVEuOKRiVfSyhSR0dHfeRX6sQPPDD3gBCGzyJ9LQXMQnWr
hJVQ4j0kviE9bujuoihBblq3NpTR1ReguXkNC16H00qidbL3.hv4iE63TD7D
HXwQYvf7if8nSD6Xmkv6XTrtrYqSK.fwPvaGOhFjG3+a73HI31TUVdtg1v0f
nw5b0VaTGtNTRtPmjjKt0JTXak9EqEyJhRIX5zX1VI7dfPdAzcqofFBAC.Sc
DY6Z4PppDtskiNrl.Ah4ICk3CEdo0xQGW1RUNlJ1J.XfGYCRkkWZPo4V1oBC
nCi4O94SKz9J7A01aJ30z5BcD9j6jzTNrOLg90R8+X7YkpZDTAkA0wRvCQkL
mPErCKloigNGnLXWUY8KmEiFpbVzkV0r8R0eNUZHYa4F81+alqRlT0EWM1Bd
cvy5Ggz9VCTwC4D5k2qfW6I5Ce0HTKKzmiJRQCm8qFpdu0c2oM8Y8gnGzAwo
Ou7m+WsgSnw9S+kPV0H1zsYccW6+3YrfJULNzoY+Ek9jEcEqnfx62NcASZ5v
9wxwuvmXz5IcL5IY5zS1XzS3zomjwnmroUOn2POQSmbhFAdPSlbzEi8wugZV
NcvAeQAGT3kUnU1H7jQSmbL+PD8FxY5hyWdQ45Lljx4SlZ9WlywVfmTWumJj
suRPH5lpttRXFlNGFx31gve3IPP2y5VucADgtkGktemFgsckC4oAyL6y8y9K
LRzZPA
-----------end_max5_patcher-----------
When loading the patch, you read the text file and send the parameter values to the vst~ object.
Hth

The read & write messages to vst~ open dialog boxes you can save your effects files in.
In Max 5, Windows 7 64-bit, I had to write the following message to read a file directly:
(read C:/myvsts/presets/quiet.fxp)
Likewise there's the following vst~ messages to interact with saving:
read
write
writepgm
writebank
These are shown in the vst~ helpfile and further in the reference.

Related

How to force reimport of texture in godot?

I have a sample.png file which is being changed outside godot
and after it's modified, godot recives a signal and when that signal is received
I want that specific sample.png file to be reimported
I tried this answer but I want to reimport in my script itself not create a plugin for it
(atleast that's what I'm assuming it does)
I also tried this from the documents but I'm not sure how to use it exactly
EditorFileSystem.update_file("res://Assets/sample.png")
so how do I achieve the desired result?
The class EditorFileSystem is intended for plugins.
You would call get_editor_interface() from an EditorPlugin (which would be where you would be writing code if you were making a plugin). And that gives you an EditorInterface object, on which you can call get_resource_filesystem() which gives you an EditorFileSystem object.
So the intended use is something like this:
extends EditorPlugin
func example() -> void:
var editor_file_system := get_editor_interface().get_resource_filesystem()
editor_file_system.scan_sources()
# editor_file_system.update_file("res://icon.png")
By the way, EditorInterface also has a filesystem_changed signal. Although I don't know how reliable it is.
Usually you don't have to do that. When you restore the Godot window, it will scan for changes in the project folder. So you might minimize Godot while you are working on something else and when you bring the Godot window back it will pick on the changes.
In practice, the only situations when I had to use scan or scan_sources was when I had a tool script that write a resource file which should be imported, and I wanted it to reflect right away.
Instead of making a custom plugin, I'll remind you that form a tool script (as long as it is running in the editor) you can simply create an EditorPlugin object. For example:
var ep = EditorPlugin.new()
ep.get_editor_interface().get_resource_filesystem().scan()
ep.free()
I had also shared this example in another answer I wrote for you a while back here, it is under the title "About saving resources from tool scripts".

HTML5 Audio long buffering before playing

I'm currently making an electron app that needs to play some 40Mbyte audio file from the file system, maybe it's wrong to do this but I found that the only way to play from anywhere in the file system is to convert the file to a dataurl in the background script and then transfer it using icp, after that I simply do
this.sound = new Audio(dataurl);
this.sound.preload = "metadata"
this.sound.play()
(part of a VueJS component hence the this)
I did a profling inside electron and this is what came out:
Note that actually transferring the 40Mbytes audio file doesn't take that long (around 80ms) what is extremely annoying is the "Second Task" which is probably buffering (I have no idea) which last around 950ms, this is way too long and ideally would need it under <220ms
I've already tried changing the preload option to all available options and while I'm using the native html5 audio right now I've also tried howlerjs with similar results (seemed a bit faster tho).
I would guess that loading the file directly might be faster but even after disabling security measures put by electron to block the file:/// it isn't recognized as a valid URI by XHR
Is there a faster way to load the dataurl since all the data is there it just needs to be converted to a buffer or something like that ?
Note: I can not "pre-buffer" every file in advance since there is about 200 of them it just wouldn't make sense in my opinion.
Update:
I found this post Electron - throws Not allowed to load local resource when using showOpenDialog
don't know how I missed it, so I followed step 1 and I now can load files inside electron with the custom protocol, however, nor Audio nor howlerjs is faster, it's actually slower at around 6secs from click to first sound, is it that it needs to buffer the whole file before playing ?
Update 2:
It appears that the 6sec loading time is only effective on the first instance of audio that is created. I do not know why tho. After that the use of two instances (one playing and one pre-buffering) work just fine, however even loading a file that isn't loaded is instantaneous. Seems weird that it only is the firs one.

LD_PRELOAD with file functions

I have a rather peculiar file format to work with:
Every line begins with the checksum of its content, followed by a new-line-character.
It looks like this:
[CHECKSUM OF LINE_1][LINE_1]\n
[CHECKSUM OF LINE_2][LINE_2]\n
[CHECKSUM OF LINE_3][LINE_3]\n
...
My goal: To allow any application to work with these files like they would work with any other text file - unaware of the additional checksums at the beginning of each line.
Since I work on a linux machine with debian wheezy (kernel 3.18.26) I want to use the LD_PRELOAD-mechanism to override the relevant file functions.
I have seen something like this with zlibc on https://zlibc.linux.lu/index.html - with an explanation of how it works ( https://zlibc.linux.lu/zlibc.html#SEC8 ).
But I dont get it. They only replace the file-opening functions. No read. No write. no fseek. Nothing. So how does it work?
Or - which functions would I have to intercept to handle every read or write operation on this file and handle them accordingly?
I didn't exactly check how it works but the reason seems to be quite simple.
Possible implementation:
zlibc open:
uncompress file you wanted to open to some temporary file
open this temporary file instead of yours
zlibc close:
Compress temporary file
Override original file
In this case you don't need to override read/write/etc because you can use original ones.
In your case you have two possible solutions:
open, that make a copy of your file with striped checksums. close that calculates checksums and override original file
read and write that are able to skip/calculate checksums.
Ad 2.
From What is the difference between read() and fread()?:
fread() is part of the C library, and provides buffered reads. It is
usually implemented by calling read() in order to fill its buffer
In this case I believe that overriding open and close will be less error prone because you can safely reuse original read, write, fread, fseek etc.

Import data to OMNET++

I am trying to model a network in OMNET++. What I have is a text file (can be in an Excel file format) with nodes' names, list of interfaces, and interface connections. What I like to do is to write a program (perhaps a plug-in) to feed this file to OMNET++ and (automatically) create .ned and .cc based on this file. The rationale is that there is a long list of nodes/interfaces, that makes it difficult to do it manually, and possibly a change in the connections makes it difficult to recreate it, undelss it is done automatically. Could you point to some links/websites/documents, so that I learn how to write a plugin to read the information and create the nodes and their connections automatically? Obviously, the node types and characteristics could be modified in the plugin as necessary later.
An example is like:
(some other information there)...
cr1.atl-cr1.hst cr1.atl cr1.hst 2488
cr1.kcy-cr1.wdc cr1.kcy cr1.wdc 2488
cr1.atl-cr2.atl cr1.atl cr2.atl 10000
cr2.atl-cr1.wdc cr1.wdc cr2.atl 2488
...
where the second column is the source node, the third column is the destination node, and the first column is the link (firstNode-secondNode). The 4th column is the capacity/delay or other information of the link.
If you want this to be as flexible as possible, I would recommend writing a small Python script that reads a .csv file and renders .ned files as needed.
You might even consider using a templating engine like Mako. Quoting from its website, Mako is pretty straightforward to use:
from mako.template import Template
print(Template("hello ${data}!").render(data="world"))

Windows mobile 6.5 - best way to read and write from and to a config file

I have a handheld device running WM6.5 and trying to put together an application that should prompt the user for some information (login, password) and save it to a file for later use.
Have tried app.config files but unfortunately it requires System::Configuration, I can add the DLL but can't get the code to run, it requires CRL or something like that which I can't configure this being a mobile app - the required option is missing from the project/solution configuration section.
I am using Visual Studio 2008 C++
What's the best way to make this happen? Precisely, 1) write a string somewhere and 2) read it back later on.
TIA
Later edit:
I have tried using a binary file, like this
// write to config file
std::string s="helloworldhelloworldhelloworld";
ofstream ofile("test.txt",ios::binary);
ofile.write((char*)s.c_str(),strlen(s.c_str()));
ofile.close();
And then I have tried reading it back like this
// read config file
char read_str[60];
ifstream inf("test.txt",ios::binary);
inf.read(read_str,60);
inf.close();
LPCTSTR application_settings = CA2W(read_str);
What happens is it adds some garbage at the end of the string, if the string is longer less garbage, otherwise more.
Is there a way to sort out this conversion issue?
Turns out, project was using Unicode and had to use wifstream and wofstream to be able to properly read the strings, rather than attempt to convert them from ANSI to unicode.
This should be a reminder for me to stay away from strong typed languages in the future. Too bad there's no other significant choice for Windows Mobile. Spent a bunch of hours on this, I could have used that time for something else.

Resources