Diego Villaseñor <
diego....@gmail.com> writes:
> There are some errors in your code.
>
> The arg of ab-player-sweep is called bufnum, but you are setting the :buf-num key, so your synth is using the default buffer, which is the first one you loaded (i.e. buffer 0). You are also passing a synth as an arg, but you should be passing the hyperrat-sample.
>
> In the end buffers for sc are are just ids (integers) that represent a
> buffer in the server. You could just as well pass a number in there
> that represents the bufnum. If you log in the console the samples you
> loaded, you should be able to see their bufnum in there, and you
> should be able to use that instead of the map, but for convenience you
> can use them map as well.
>
>> On 23 Feb 2024, at 16:02,
joa...@verona.se wrote:
>>
>>
>> I want to use buf-rd to play samples, but it doesnt play the buffer I
>> expect.
>>
>>
>> (def babble-samples (load-samples "/home/joakim/roles/music/overtone-sylt/sylt2023/bark_samples/*wav"))
>> (def hyperrat-sample (load-sample "/home/joakim/roles/Creative/music/hyperrat2/output.wav"))
>> (definst hyperrat [rate 0.5](play-buf :rate rate :num-channels 1 :bufnum hyperrat-sample :loop false))
>>
>> ;; this plays hyperrat fine, as expected
>> (hyperrat :rate 0.6)
>>
>> (definst ab-player-sweep [bufnum 0 offset 0 dur 1 t-trig 1 run 1]
>> (let [phasor1 (sweep:ar :trig t-trig
>> :rate (/ run dur);;(buf-rate-scale bufnum)
>> )
>> phasor2 (lin-lin phasor1 0 1 0 (buf-frames bufnum))]
>> (buf-rd :bufnum bufnum
>> :phase (+ offset phasor2))))
>>
>> ;; this doesnt play hyperrat, it plays babble!
>> (ab-player-sweep :buf-num hyperrat :dur 80)
>>
>>
>> What did I miss?
>>
>>
>> Joakim Verona
>>
joa...@verona.se
>>
>> --
>> You received this message because you are subscribed to the Google Groups "Overtone" group.
>> To unsubscribe from this group and stop receiving emails from it, send an email to
overtone+u...@googlegroups.com.
>> To view this discussion on the web visit
https://groups.google.com/d/msgid/overtone/87h6hyrg9x.fsf%40tanaka.verona.se.