Community Forums Archive

Go Back

Subject:How to set MIDI Root Note (of a OneShot sample)
Posted by: bejj
Date:11/28/2012 3:53:24 PM

Hello,

I want to modify the MIDI Rootnote (not using ACIDInfo, but ISfFileSamplerInfo, see help about this)

When I do :

file.Sampler.RootNote = 50;

It doesn't work!

How to use the get / set methods, in order to set this value ?

Thanks

Message last edited on11/28/2012 4:17:13 PM bybejj.
Subject:RE: How to set MIDI Root Note (of a OneShot sample)
Reply by: roblesinge
Date:11/28/2012 4:32:41 PM

Can you post the rest of your code inside of a
 
block. There may be other clues as to why this isn't working as you're intending.

Rob.

Subject:RE: How to set MIDI Root Note (of a OneShot sample)
Reply by: bejj
Date:11/28/2012 4:48:57 PM

Hi,

Create a new file from an existing file :

ISfFileHost newfile = file.NewFile(range);
newfile.Sampler.RootNote=40;

If you stop the code here, then go to View > Metadata > Sampler Loops.
Look at MIDI Unity Note : it is E3. It works. :-)


Then if in your code, you add a "newfile.SaveAs", the MIDI Unity Note goes back to C5 :(

--

In order that the MIDI Unity Note is saved, you must also set
View > Metadata > Sampler Loops > Sample Type = something different to None. OneShot for example. Then if you Save, The RootNote will be saved.
How to do this in a script ? (It doesn't worked for me with ACIDinfo etc.)

Subject:RE: How to set MIDI Root Note (of a OneShot sample)
Reply by: roblesinge
Date:11/28/2012 5:11:26 PM

You may need to use a RenderOption with your SaveAs to save the metadata. There are several metadata render options available:

RenderOptions.DefaultMetadata (Save metadata)

RenderOptions.SaveMetadata (Save the metadata in the file if the format supports it, or in a separate file in the format doesn't support it.)

RenderOptions.SaveMetadataExternal (Save the metadata in a separate file.)

I would think the first or second option would be the one to try. See if that fixes your problem.

Rob.


Subject:RE: How to set MIDI Root Note (of a OneShot sample)
Reply by: bejj
Date:11/28/2012 5:39:26 PM

The solution was : adding :

newfile.Sampler.LoopCount = 1;
newfile.Sampler.LoopCount = 0;

==> it looks strange ;) but this remplaces SampleType=None (by default) to SampleType=OneShot

and then the RootNote will be saved during next SaveAs.

Go Back