[Csnd] about mincer

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

[Csnd] about mincer

Francesco Porta
Hello All,
a question about mincer.
i write a table with a 3 seconds of audio and a instrument that uses mincer to
slowing down the reading. the mincer time pointer is a oscil reading a table
that go from 0 to 3 (duration of audio file in table).
at the end of mincer output i hear something like a reverse reading of audio
(apologies for my poor language). i do not understand why.

i have tested mincer using a GEN 1 table with same sample and it seems ok.
i have tested reading audio table written by instr 12 and it seems ok.

Thanks for any help,
ciao,
francesco.

here is my minimal example csd. audio file is a single guitar note with duration
of 6 sec. but sampled only for 3 sec by instrs 10 and 12.

<CsoundSynthesizer>
<CsOptions>
-odac -+rtaudio=jack -d -m0
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 64
nchnls = 2
0dbfs  = 1

; GLOBALI
gaInput init 0

; durata della registrazione della nota
giNoteDur = 3
gkNoteNumber init 0
giTableLen = sr*giNoteDur

; intervallo tra i triggers di almeno 3 sec.
opcode Trigger, kk, a

ainput xin
iThresh = 0.1
iWait = kr*giNoteDur
kTimer init 1
kRms rms ainput, 20
iSampTim = 0.01
kRmsPrev delayk kRms, iSampTim
kChange = kRms - kRmsPrev

if(kTimer>iWait) then
        if kChange > iThresh then
                kTrig = 1
                gkNoteNumber += 1
        else
                kTrig = 0
        endif
        kTimer = kTrig == 1 ? 0 : kTimer
else
        kTimer += 1
        kTrig = 0
endif
xout kTrig, gkNoteNumber
endop

instr 1

gaInput diskin2 "guitar_C.wav", p4
endin

instr 10

ktrig, knote Trigger gaInput
schedkwhen ktrig, 0, 0, 12, 0, giNoteDur, knote
endin

instr 12

iTableNum = p4

iTable ftgen  iTableNum, 0, giTableLen, 2, 0

andx line 0, p3, giTableLen
tablew gaInput, andx, iTable

schedule 20 + p4/1000, 0, 10, iTable
endin

instr 20

ifn = p4
ilock = 1

iStart = 0
iEnd = 1

ifntime ftgen 0, 0, 2048, -7, giNoteDur*iStart, 2048, giNoteDur*iEnd

atime poscil 1, 1/p3, ifntime
audio mincer atime, 1, 1, ifn, ilock

outs audio, audio
endin

</CsInstruments>
<CsScore>

i 10 0 20

i 1 4 4 1

</CsScore>
</CsoundSynthesizer>


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

mincer_test.csd (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [Csnd] about mincer

jpff
Have you tried with a ksmps that is an exact divisor of sr?  Or set
--sample-accurate ? Just a thought


On Wed, 19 Sep 2018, Francesco Porta wrote:

> Hello All,
> a question about mincer.
> i write a table with a 3 seconds of audio and a instrument that uses mincer to
> slowing down the reading. the mincer time pointer is a oscil reading a table
> that go from 0 to 3 (duration of audio file in table).
> at the end of mincer output i hear something like a reverse reading of audio
> (apologies for my poor language). i do not understand why.
>
> i have tested mincer using a GEN 1 table with same sample and it seems ok.
> i have tested reading audio table written by instr 12 and it seems ok.
>
> Thanks for any help,
> ciao,
> francesco.
>
> here is my minimal example csd. audio file is a single guitar note with duration
> of 6 sec. but sampled only for 3 sec by instrs 10 and 12.
>
> <CsoundSynthesizer>
> <CsOptions>
> -odac -+rtaudio=jack -d -m0
> </CsOptions>
> <CsInstruments>
> sr = 44100
> ksmps = 64
> nchnls = 2
> 0dbfs  = 1
>
> ; GLOBALI
> gaInput init 0
>
> ; durata della registrazione della nota
> giNoteDur = 3
> gkNoteNumber init 0
> giTableLen = sr*giNoteDur
>
> ; intervallo tra i triggers di almeno 3 sec.
> opcode Trigger, kk, a
>
> ainput xin
> iThresh = 0.1
> iWait = kr*giNoteDur
> kTimer init 1
> kRms rms ainput, 20
> iSampTim = 0.01
> kRmsPrev delayk kRms, iSampTim
> kChange = kRms - kRmsPrev
>
> if(kTimer>iWait) then
> if kChange > iThresh then
> kTrig = 1
> gkNoteNumber += 1
> else
> kTrig = 0
> endif
> kTimer = kTrig == 1 ? 0 : kTimer
> else
> kTimer += 1
> kTrig = 0
> endif
> xout kTrig, gkNoteNumber
> endop
>
> instr 1
>
> gaInput diskin2 "guitar_C.wav", p4
> endin
>
> instr 10
>
> ktrig, knote Trigger gaInput
> schedkwhen ktrig, 0, 0, 12, 0, giNoteDur, knote
> endin
>
> instr 12
>
> iTableNum = p4
>
> iTable ftgen  iTableNum, 0, giTableLen, 2, 0
>
> andx line 0, p3, giTableLen
> tablew gaInput, andx, iTable
>
> schedule 20 + p4/1000, 0, 10, iTable
> endin
>
> instr 20
>
> ifn = p4
> ilock = 1
>
> iStart = 0
> iEnd = 1
>
> ifntime ftgen 0, 0, 2048, -7, giNoteDur*iStart, 2048, giNoteDur*iEnd
>
> atime poscil 1, 1/p3, ifntime
> audio mincer atime, 1, 1, ifn, ilock
>
> outs audio, audio
> endin
>
> </CsInstruments>
> <CsScore>
>
> i 10 0 20
>
> i 1 4 4 1
>
> </CsScore>
> </CsoundSynthesizer>
>
>
> 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] about mincer

joachim-3
In reply to this post by Francesco Porta
hi francesco -

for what you want to do, i think it is better to use a linear pointer
instead of an oscillator in your instrument 20.

rather than
        atime poscil 1, 1/p3, ifntime
you can perhaps try
        apnter linseg 0, p3, 2047
        atime tablei apnter, ifntime

not tested, but perhaps worth to try.  it might also be good to have a
bigger table than 2048.

ciao -
        joachim



On 19/09/18 10:27, Francesco Porta wrote:

> Hello All,
> a question about mincer.
> i write a table with a 3 seconds of audio and a instrument that uses mincer to
> slowing down the reading. the mincer time pointer is a oscil reading a table
> that go from 0 to 3 (duration of audio file in table).
> at the end of mincer output i hear something like a reverse reading of audio
> (apologies for my poor language). i do not understand why.
>
> i have tested mincer using a GEN 1 table with same sample and it seems ok.
> i have tested reading audio table written by instr 12 and it seems ok.
>
> Thanks for any help,
> ciao,
> francesco.
>
> here is my minimal example csd. audio file is a single guitar note with duration
> of 6 sec. but sampled only for 3 sec by instrs 10 and 12.
>
> <CsoundSynthesizer>
> <CsOptions>
> -odac -+rtaudio=jack -d -m0
> </CsOptions>
> <CsInstruments>
> sr = 44100
> ksmps = 64
> nchnls = 2
> 0dbfs  = 1
>
> ; GLOBALI
> gaInput init 0
>
> ; durata della registrazione della nota
> giNoteDur = 3
> gkNoteNumber init 0
> giTableLen = sr*giNoteDur
>
> ; intervallo tra i triggers di almeno 3 sec.
> opcode Trigger, kk, a
>
> ainput xin
> iThresh = 0.1
> iWait = kr*giNoteDur
> kTimer init 1
> kRms rms ainput, 20
> iSampTim = 0.01
> kRmsPrev delayk kRms, iSampTim
> kChange = kRms - kRmsPrev
>
> if(kTimer>iWait) then
> if kChange > iThresh then
> kTrig = 1
> gkNoteNumber += 1
> else
> kTrig = 0
> endif
> kTimer = kTrig == 1 ? 0 : kTimer
> else
> kTimer += 1
> kTrig = 0
> endif
> xout kTrig, gkNoteNumber
> endop
>
> instr 1
>
> gaInput diskin2 "guitar_C.wav", p4
> endin
>
> instr 10
>
> ktrig, knote Trigger gaInput
> schedkwhen ktrig, 0, 0, 12, 0, giNoteDur, knote
> endin
>
> instr 12
>
> iTableNum = p4
>
> iTable ftgen  iTableNum, 0, giTableLen, 2, 0
>
> andx line 0, p3, giTableLen
> tablew gaInput, andx, iTable
>
> schedule 20 + p4/1000, 0, 10, iTable
> endin
>
> instr 20
>
> ifn = p4
> ilock = 1
>
> iStart = 0
> iEnd = 1
>
> ifntime ftgen 0, 0, 2048, -7, giNoteDur*iStart, 2048, giNoteDur*iEnd
>
> atime poscil 1, 1/p3, ifntime
> audio mincer atime, 1, 1, ifn, ilock
>
> outs audio, audio
> endin
>
> </CsInstruments>
> <CsScore>
>
> i 10 0 20
>
> i 1 4 4 1
>
> </CsScore>
> </CsoundSynthesizer>
>
>
> 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] about mincer

Francesco Porta
Thanks,

John using ksmps = 1 and --sample-accurate gives me same result.

Joachim You are right and i tried a linear time pointer getting same result.
but i would like to have the possibilities to reply
the note, i mean i use mincer to obtain a note with a duration almost
10 times the original but instrument with mincer will have a long
duration (i.e. 180 sec). So i need oscillating time pointer.
Hope i was clear ...

the solution i found is to setting the time pointer ending to 0.95 *
note duration,
if i'm correct that means reading the sample from 0 to 95% jumping the
final 5% of sample duration.
Only i cannot understand why this happens.

(please refer to my csd in first mail)

if i use mincer loading the sampled guitar note i obtain the right result.

instr 20

ifn ftgen 0, 0, 0, 1, "guitar_C.wav", 0, 0, 0
ilock = 1

ifntime ftgen 0, 0, 2048, -7, 0, 2048, giNoteDur

atime poscil 1, 1/10, ifntime
audio mincer atime, 1, 1, ifn, ilock
outs audio, audio
endin


if i read recorded table of sampled sound with a oscillator i have it right.

where p4 is table number created by instr 12

instr 20

ifn = p4
audio poscil 1, 1/giNoteDur, ifn
outs audio, audio
endin


it seems that in my workflow something is wrong.

thanks,
ciao,
francesco.

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] about mincer

Oeyvind Brandtsegg-3
Could it be that you are using an interpolating time pointer, such that it will also interpolate when wrapping around from the end to the beginning? If you get a quick sweep of going backwards through the whole file, this might be an explanation. It could happen in the time pointer you generate, or in the way mincer treats the time pointer. Writing the time pointer you generate to an audio file and examine what it looks lie might give you additional clues. 
I did not look into details of your code, so, sorry if I misunderstood anything. It is just that I recognise the perceived artifact from other contexts.

best
Oeyvind

Den tor. 20. sep. 2018 kl. 13:19 skrev fra <[hidden email]>:
Thanks,

John using ksmps = 1 and --sample-accurate gives me same result.

Joachim You are right and i tried a linear time pointer getting same result.
but i would like to have the possibilities to reply
the note, i mean i use mincer to obtain a note with a duration almost
10 times the original but instrument with mincer will have a long
duration (i.e. 180 sec). So i need oscillating time pointer.
Hope i was clear ...

the solution i found is to setting the time pointer ending to 0.95 *
note duration,
if i'm correct that means reading the sample from 0 to 95% jumping the
final 5% of sample duration.
Only i cannot understand why this happens.

(please refer to my csd in first mail)

if i use mincer loading the sampled guitar note i obtain the right result.

instr 20

ifn ftgen 0, 0, 0, 1, "guitar_C.wav", 0, 0, 0
ilock = 1

ifntime ftgen 0, 0, 2048, -7, 0, 2048, giNoteDur

atime poscil 1, 1/10, ifntime
audio mincer atime, 1, 1, ifn, ilock
outs audio, audio
endin


if i read recorded table of sampled sound with a oscillator i have it right.

where p4 is table number created by instr 12

instr 20

ifn = p4
audio poscil 1, 1/giNoteDur, ifn
outs audio, audio
endin


it seems that in my workflow something is wrong.

thanks,
ciao,
francesco.

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] about mincer

joachim-3
In reply to this post by Francesco Porta
the reson for the 95% might be that mincer uses fft.  the default window
size is 2048 samples, so i would assume that if you point to end minus
2048 samples (certainly not 100%), you point to the end of the table.

victor can certainly tell more precise.

        j



On 20/09/18 13:19, fra wrote:

> Thanks,
>
> John using ksmps = 1 and --sample-accurate gives me same result.
>
> Joachim You are right and i tried a linear time pointer getting same
> result.
> but i would like to have the possibilities to reply
> the note, i mean i use mincer to obtain a note with a duration almost
> 10 times the original but instrument with mincer will have a long
> duration (i.e. 180 sec). So i need oscillating time pointer.
> Hope i was clear ...
>
> the solution i found is to setting the time pointer ending to 0.95 *
> note duration,
> if i'm correct that means reading the sample from 0 to 95% jumping the
> final 5% of sample duration.
> Only i cannot understand why this happens.
>
> (please refer to my csd in first mail)
>
> if i use mincer loading the sampled guitar note i obtain the right result.
>
> instr 20
>
> ifn ftgen 0, 0, 0, 1, "guitar_C.wav", 0, 0, 0
> ilock = 1
>
> ifntime ftgen 0, 0, 2048, -7, 0, 2048, giNoteDur
>
> atime poscil 1, 1/10, ifntime
> audio mincer atime, 1, 1, ifn, ilock
> outs audio, audio
> endin
>
>
> if i read recorded table of sampled sound with a oscillator i have it
> right.
>
> where p4 is table number created by instr 12
>
> instr 20
>
> ifn = p4
> audio poscil 1, 1/giNoteDur, ifn
> outs audio, audio
> endin
>
>
> it seems that in my workflow something is wrong.
>
> thanks,
> ciao,
> francesco.
>
> 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] about mincer

Francesco Porta
Thanks,
You are right. In fact my calculations give me near 0.5%.
Assuming sr 44100:

2048/44100 = 0.046439909.

Am i right?

Many Thanks All,
ciao,
francesco.

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