[hv_table_resize] might not be working correctly
In our PD patch, we have a table with an explicit length of 604800, which we're using for a looping sample. These lengths are set to accommodate the sample at 44.1Khz = 604800 samples.
When our project is running on a platform at 48Khz, we're loading in an upsampled sample which when played sounds correct, but is longer at 658000 samples, and the loop gets truncated at the end.
Shouldn't hv_table_resize be taking care of this, and expand the table size to the required length?
Or do we need to pre-set our tables large enough to store the maximum sample rate that our patch could conceivably run at?
as a side note, when we resize the table to 658000 samples, we get correct looping :)
Is this in unity?
Sorry, yes - Unity / Android + OSX.
Are you calling FillTableWithMonoAudioClip?
FillTableWithFloatBuffer - which I can see has a call to hv_table_resize
And how are you looping in your patch? Is it with [tabplay~]? Or some other mechanism?
@ylevtov wrote the patch, but it's played back via s_playtable2. Looping's handled via a bang every 8 bars (or so) which comes from a central timebase.
There is an known issue where certain objects don't update their knowledge of the table's length when hv_resize_table is called. Potentially you're running into this issue, and not that the function itself doesn't work. Ideally we could get some feedback from @ylevtov about his implementation and see about fixing the issue if possible.
@mhroth is correct, the table is updated, but the tabread isn't.
@owenhindley directly after your call to FillTableWithFloatBuffer, I suggest you send in a message to a receiver to set the s_playtable2 playback length manually.
@owenhindley I'm mark this as solved, unless there's still some issue you're experiencing.
We've got a ticket to properly implement table resizing but for now the workaround is to mainly send the resize message into the patch.
I'm having a similar issue. I I use (float)_clip.samples; to get the audio clip's amount of samples, Unity gives the samples in the rate of 44,100 Hz, but when I press play the resulting printed values and sound indicate a samplerate of 48,000 Hz. The op mentioned "hv_table_resize", but what is that? I don't see it on the list of Heavy-compatible abstractions: https://github.com/enzienaudio/heavylib
@diemildefreude would you mind making a separate issue for this?
@diplojocus Not at all.