Problem with sleep sample_duration

i tried this:

define :take do |name, sleepoffset=0.0|
  sample name
  sleep ((sample_duration name) +sleepoffset)

take ["D:/asdasd/asdasd/", "file", "name"]

The code should play a file with the pattern and sleep for the length of the sample (corrected by the sleepoffset).
In my eyes the code looks good, but i get a “Hash can’t be coerced into Float” on the sleep-line.
Can you help me please?
Thank you very much!

Hi @synchron,

thanks for the question :slight_smile:

IT seems to me that your fn take expects one argument name which should be a string or symbol representing a sample name and an optional argument sleepoffset . However, when you call it with an array of three strings. If I call take with a single symbol, it works just fine for me:

take :ambi_lunar_land

Does this help?

OMG…sorry…i tried your version and it worked…i cant believe it, and made a step back.
my call was different.
I called it with:
take [ort, “1”, “Mann”], amp: 6, attack: 2, release: 2, finish: 0.2
If i remove the additional parameters and only call
take [ort, “1”, “Mann”]
Everything worked fine.
Now i dont understand why it worked before :smiley:
The amp/attack/etc take effekt on the sample inside the take-method. I dont know why, and dont know, why i was doing this, but this is my problem.
Thank you very much!

You’re very welcome! Thanks so much for asking your question here.

Oddly enough @samaaron & @synchron - I was just about to mention that it seemed to work fine for me with the array of strings passed in - but in addition to this, I think I’ve just uncovered a bug in sample_duration! I’ll hopefully get working on a fix within the next day or so.