Jump to content


Photo

Loading samples programmatically seems to fail


  • Please log in to reply
3 replies to this topic

#1 FruitieX

FruitieX

    New Member

  • Normal Members
  • Pip
  • 2 posts

Posted 17 May 2018 - 11:57

Hi,

 

I've tried using the renoise.app():load_instrument_sample() function for programmatically loading a generated sample from my custom Renoise Tool.

I haven't been able to get this function to do anything besides return false, with no further errors. Nothing else seems to happen.

 

Simplest test case that fails:

1. Open the Scripting Terminal & Editor
2. In the terminal, run  `renoise.app():load_instrument_sample("/path/to/test/sample.flac")`

3. Observe no sample is being loaded, also if you print the return value it's always `false`.

I tested with various .flac samples that come bundled with Renoise, as well as .wav samples. Neither worked for me.

Tested on both macOS and Linux.

 

Did anyone have any luck using this function?

 

- Rasmus



#2 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1524 posts
  • Gender:Male
  • Location:Spain

Posted 17 May 2018 - 14:04

Hi,

 

I've tried using the renoise.app():load_instrument_sample() function for programmatically loading a generated sample from my custom Renoise Tool.

I haven't been able to get this function to do anything besides return false, with no further errors. Nothing else seems to happen.

 

Simplest test case that fails:

1. Open the Scripting Terminal & Editor
2. In the terminal, run  `renoise.app():load_instrument_sample("/path/to/test/sample.flac")`

3. Observe no sample is being loaded, also if you print the return value it's always `false`.

I tested with various .flac samples that come bundled with Renoise, as well as .wav samples. Neither worked for me.

Tested on both macOS and Linux.

 

Did anyone have any luck using this function?

 

- Rasmus

 

I have never used it but I think I understand what is necessary here, because in other sections of Renoise it is very similar:

  1. It is necessary for the tool to first order a free sample slot inside the selected instrument. Make sure there is a sample slot. When you load Renoise for the first time, no instrument has any sample slots loaded: Renoise: Sampler: Sample Box (left), "Insert a new sample" (slot empty) (the API will have something equivalent to do it).
  2. Ok, once you have resolved point 1, make sure that the FLAC file address exists. "/path/to/test/sample.flac" is not a subfolder inside the main folder of your tool?

In summary, first you prepare a place where to place the sample, and then you load it. In theory, renoise.app():load_instrument_sample() should previously create a sample slot to load.

 

I hope this helps...

:excl: Development of my tools: KangarooX120SamRenderPhraseTouch  |  GT16-Colors (old)

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler

#3 FruitieX

FruitieX

    New Member

  • Normal Members
  • Pip
  • 2 posts

Posted 17 May 2018 - 14:12

 

I have never used it but I think I understand what is necessary here, because in other sections of Renoise it is very similar:

  1. It is necessary for the tool to first order a free sample slot inside the selected instrument. Make sure there is a sample slot. When you load Renoise for the first time, no instrument has any sample slots loaded: Renoise: Sampler: Sample Box (left), "Insert a new sample" (slot empty) (the API will have something equivalent to do it).
  2. Ok, once you have resolved point 1, make sure that the FLAC file address exists. "/path/to/test/sample.flac" is not a subfolder inside the main folder of your tool?

In summary, first you prepare a place where to place the sample, and then you load it. In theory, renoise.app():load_instrument_sample() should previously create a sample slot to load.

 

I hope this helps...

 

Thanks for the reply,

 

I'll try this out when I get time.

 

Just to be clear, "/path/to/test/sample.flac" is an example of an absolute path (starting from the filesystem root) to a file that (in my case) does exist.



#4 Raul (ulneiz)

Raul (ulneiz)

    Guruh Motha Fakka is Levitating and Knows Everything About Renoise Member

  • Normal Members
  • PipPipPipPipPipPipPipPipPipPipPipPipPip
  • 1524 posts
  • Gender:Male
  • Location:Spain

Posted 17 May 2018 - 14:25

-- Insert a new empty sample. returns the new renoise.Sample object.
-- Every newly inserted sample has a default mapping, which covers the 
-- entire key and velocity range, or it gets added as drum kit mapping 
-- when the instrument used a drum-kit mapping before the sample got added.
renoise.song().instruments[]:insert_sample_at(index)
  -> [new renoise.Sample object]
-- Delete an existing sample.
renoise.song().instruments[]:delete_sample_at(index)
-- Swap positions of two samples.
renoise.song().instruments[]:swap_samples_at(index1, index2)

Step 1: renoise.song().instruments[]:insert_sample_at(index)   --->  renoise.song().selected_instrument:insert_sample_at( 1 )

Step 2: renoise.app():load_instrument_sample( the path )


:excl: Development of my tools: KangarooX120SamRenderPhraseTouch  |  GT16-Colors (old)

 

:excl: My API wishlist R3.1 (updated 24 July 2017):

Spoiler

 

:excl: My Renoise 3.1 wishlist (updated 26 September 2017):

Spoiler