heavy icon indicating copy to clipboard operation
heavy copied to clipboard

Soundfiler not supported? alternative?

Open amed982 opened this issue 9 years ago • 10 comments

How can i open an audio file without soundfiler? there is anything that can replace it?

amed982 avatar Oct 09 '16 20:10 amed982

HI @AndrelMedo. We don't support soundfiler because reading audio assets is inevitably a very platform- and framework-dependent operation. In general, you can load audio assets into tables and play them using a tabread~ object. You can do it like this in Unity. You can do the same thing using the C API as well.

What exactly are you trying to accomplish with Heavy?

mhroth avatar Oct 09 '16 22:10 mhroth

hey, I'm still learning the basics of pd, but all the documentation/tutorials I can find regarding tables and samples etc, seem to use soundfiler. Can you point to an example of how to do this without soundfiler?

For context; I'm attempting to load a significant number of samples into a patch and then trigger them with different types of cues.

Latimark avatar Jun 21 '17 20:06 Latimark

@Latimark What system are you trying to accomplish this on? As I wrote above, we don't support soundfiler because every platform has it's own may of dealing with samples. But we always provide a way to access the tables from outside of the patch.

mhroth avatar Jun 21 '17 20:06 mhroth

This is going to be on PCs with a VR setup built in unity

Latimark avatar Jun 22 '17 15:06 Latimark

wait i kind of understand now - I have to place a bunch of empty tables in my patch then fill them from a script in unity?

Latimark avatar Jun 22 '17 15:06 Latimark

Hey @Latimark are you using Unity? Fabric? Wwise?

In general to you can specify a [table] object in your patch to be accessible from the frameworks it's integrated into by using the @hv_table descriptor.

For example if you have [table myTable 100 @hv_table], you'll be able to fill it with an audio file when the patch get's loaded. Though this depends on which framework you're using.

As example for Unity see the documentation on accessing tables https://enzienaudio.com/docs/index.html#06.unity#accessing-audio-tables

In the above case you would create a script that would contain some code like:

public class MySampleLoader : MonoBehaviour {

    public AudioClip _clip; // attach a sample in the editor
    private Hv_sine_AudioLib _audio; 

    void Start() {
        _audio = GetComponent<Hv_sine_AudioLib>();
        _audio.FillTableWithMonoAudioClip("myTable", _clip);
    }
}

diplojocus avatar Jun 22 '17 15:06 diplojocus

wait i kind of understand now - I have to place a bunch of empty tables in my patch then fill them from a script in unity?

Yes exactly. It is possible to save the contents of the audio file directly into the pd patch before uploading it to heavy but this is discouraged over the @hv_table approach. Also the upload size limit 1MB to our servers.

diplojocus avatar Jun 22 '17 15:06 diplojocus

awesome! this method actually solves a lot of problems~ thanks!

Latimark avatar Jun 22 '17 15:06 Latimark

what's the best way of handling table resizing within the patch?

Latimark avatar Jun 22 '17 15:06 Latimark

Are you using the default Unity audio system?

If so, currently the best way would be to create a @hv_param for your table size update.

After loading the table call something like this:

_audio.SetFloatParameter(Hv_{{patch_name}}_AudioLib.Parameter.myTableSizeParam, _clip.samples/_clip.channels);

diplojocus avatar Jun 22 '17 15:06 diplojocus