Csound Csound-dev Csound-tekno Search About

[Csnd] sample phasor playback precision?

Date2018-05-18 19:15
Fromfauveboy
Subject[Csnd] sample phasor playback precision?
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
Csound@listserv.heanet.ie
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

Date2018-05-18 22:02
Fromjoachim heintz
SubjectRe: [Csnd] sample phasor playback precision?
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
> Csound@listserv.heanet.ie
> 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
Csound@listserv.heanet.ie
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

Date2018-05-18 22:12
Fromfauveboy
SubjectRe: [Csnd] sample phasor playback precision?
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
Csound@listserv.heanet.ie
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

Date2018-05-18 22:20
Fromjoachim heintz
SubjectRe: [Csnd] sample phasor playback precision?
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
> Csound@listserv.heanet.ie
> 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
Csound@listserv.heanet.ie
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

Date2018-05-19 11:38
Fromfauveboy
SubjectRe: [Csnd] sample phasor playback precision?
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
Csound@listserv.heanet.ie
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

Date2018-05-19 12:09
Fromjpff
SubjectRe: [Csnd] sample phasor playback precision?
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
Csound@listserv.heanet.ie
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

Date2018-05-19 12:21
Fromfauveboy
SubjectRe: [Csnd] sample phasor playback precision?
sampler_table.csd
  
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
Csound@listserv.heanet.ie
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

Date2018-05-19 12:56
FromMichael Gogins
SubjectRe: [Csnd] sample phasor playback precision?
Yes you can do expressions in the score, enclosed in [].

On Fri, May 18, 2018, 17:13 fauveboy <joel.ramsbottom@hotmail.co.uk> 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
Csound@listserv.heanet.ie
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 Csound@listserv.heanet.ie 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

Date2018-05-19 17:45
Fromfauveboy
SubjectRe: [Csnd] sample phasor playback precision?
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
Csound@listserv.heanet.ie
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

Date2018-05-19 17:56
Fromjpff
SubjectRe: [Csnd] sample phasor playback precision?
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



#define F #(1/3)0#

instr 101

   ipos = p4*$F
...

Csound mailing list
Csound@listserv.heanet.ie
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