[Csnd] sample phasor playback precision?

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

[Csnd] sample phasor playback precision?

fauveboy
I'm using a phasor that ramps from 0 - 1 to scan through a lookup table to
play back a sample.

In the music I'm making, I'm jumping to different parts of the sample by
adjusting the phasors phase.

However, as the samples I use last longer its harder to jump to more precise
parts of the sample because the phase is always 0 -1 whether the sample is a
couple seconds or the full length of a song.

Is there anything that can be done to maintain the precision between using
the phasor the indicate where i want to be in the sample?

Many thanks



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] sample phasor playback precision?

joachim-3
what is your way to tell csound the position?  how do you calculate it?

i would think that the internal float (or actually double precision
float) should be far enough precise.  so i would assume you are doing
some rounding or similar.

        joachim



On 18/05/18 20:15, fauveboy wrote:

> I'm using a phasor that ramps from 0 - 1 to scan through a lookup table to
> play back a sample.
>
> In the music I'm making, I'm jumping to different parts of the sample by
> adjusting the phasors phase.
>
> However, as the samples I use last longer its harder to jump to more precise
> parts of the sample because the phase is always 0 -1 whether the sample is a
> couple seconds or the full length of a song.
>
> Is there anything that can be done to maintain the precision between using
> the phasor the indicate where i want to be in the sample?
>
> Many thanks
>
>
>
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
> Csound mailing list
> [hidden email]
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] sample phasor playback precision?

fauveboy
I'm dividing the sample by the number of quarter notes it has and then taking
the number 1 divided by that result. This value I use to times by however
many beats into the sample I need to be. But when the sample is longer im
finding its not exactly on a beat when it would be on a smaller sample?

Is there a way to do expressions in the score?



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] sample phasor playback precision?

joachim-3
hm — if it is a real sample (played from humans) you cannot expect that
the division is always the same (ok, depending on the music you may).
did you check whether your calculation is right in an audio editor?  for
instance, if your sample is 60 seconds, with one beat per second, is
there really a beat at second 57, 58, 59?



On 18/05/18 23:12, fauveboy wrote:

> I'm dividing the sample by the number of quarter notes it has and then taking
> the number 1 divided by that result. This value I use to times by however
> many beats into the sample I need to be. But when the sample is longer im
> finding its not exactly on a beat when it would be on a smaller sample?
>
> Is there a way to do expressions in the score?
>
>
>
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
>
> Csound mailing list
> [hidden email]
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> Send bugs reports to
>         https://github.com/csound/csound/issues
> Discussions of bugs and features can be posted here
>

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] sample phasor playback precision?

fauveboy
I'm getting quite odd results actually.

I have a sample from Ableton that is 15 seconds long.

The sound is at 40 bpm and the time signiture is 5/4.
The sample lasts for 10 whole beats.

In the csound score I've placed "t 0 40" so it is the correct bpm.

I've then been trying to reach the correct beat by doing say...

beat 6 * (1/11).  I've used 11 because ten whole beats ends on the 11th beat
(not totally confident thats the correct thing to do?)

the 6th beat = 0.54545454 recurring

my i statment says (using p4 to set the phase)

i101 0 10 0.545 < this doesn't work. The sample just plays from the
beginning, not sure why?

i101 0 10 0.5 < this seems to start where expected in the 6th beat which is
coincidently neatly half way.

so I tried something else by looking for the "8.5" beat.

The result is 0.7727272 recurring and so i put this in an i statement:

i101 0 10 0.772 < the sample just played from the beginning like the first i
statement. The same thing also
happened with:

i101 0 10 0.7 (in that the sample just played from the beginning)?

So now I'm very unsure as to whats happening especially as this is a small
sample compared to the ones i need to use?



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] sample phasor playback precision?

jpff
On Sat, 19 May 2018, fauveboy wrote:

>
> beat 6 * (1/11).  I've used 11 because ten whole beats ends on the 11th beat
> (not totally confident thats the correct thing to do?)
>
> the 6th beat = 0.54545454 recurring
>
> my i statment says (using p4 to set the phase)
>

Remember to count from zero, so first note lasts from 0 to 1.  The 11 must
be wrong.

I do not seem to have a copy of your instrument to check.

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] sample phasor playback precision?

fauveboy
sampler_table.csd
<http://csound.1045644.n5.nabble.com/file/t339654/sampler_table.csd>  
Compos0002h40bpm5_4_10beats.wav
<http://csound.1045644.n5.nabble.com/file/t339654/Compos0002h40bpm5_4_10beats.wav>  

I've attached all the files I'm using



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] sample phasor playback precision?

Michael Gogins-2
In reply to this post by fauveboy
Yes you can do expressions in the score, enclosed in [].

On Fri, May 18, 2018, 17:13 fauveboy <[hidden email]> wrote:
I'm dividing the sample by the number of quarter notes it has and then taking
the number 1 divided by that result. This value I use to times by however
many beats into the sample I need to be. But when the sample is longer im
finding its not exactly on a beat when it would be on a smaller sample?

Is there a way to do expressions in the score?



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Csound mailing list [hidden email] https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] sample phasor playback precision?

fauveboy
Ah yes remembering to count from zero and letting csound process algorithm.
seems to have worked well.

I've used this statement with the longer sample too:

i 101 0 10 [5*(1/130)].

I guess inaccuracies would only occur due to the sample length when values
begin to exceed the precision of 64-bit floats?

Instead of writing algorithms in the score for each i statement can I assign
1/130 (for example) to a variable that can be used instead?



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] sample phasor playback precision?

jpff
You could use a macro i the score

#define F #(1/3)0#

and use

i 101 0 10 [5*$F]

or yoy couls adject in the orchestra

<orc code>

#define F #(1/3)0#

instr 101

   ipos = p4*$F
...

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] sample phasor playback precision?

jpff
In reply to this post by fauveboy
ilookup tableng 5 ; get length of sample in samples
Without the file loaded as table 5 it is rather hard to be certain
what you are doing, or the relationship between the phasor and the
audio files you read
asigL table aindex, ilftchnfunc, 0, 0, 1 ; index reads from table
asigR table aindex, irghchnfunc, 0, 0, 1

==John ffitch

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] sample phasor playback precision?

fauveboy
Ah yes, I need to rethink the design there.
Well, I'm using samples that are all the same length in the orchestra.

But I suppose I need another p-field that reads from the respective sample
used in the score at the time.



--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

Csound mailing list
[hidden email]
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        https://github.com/csound/csound/issues
Discussions of bugs and features can be posted here