Csound Csound-dev Csound-tekno Search About

[Csnd] filescal and fout trouble

Date2018-11-15 09:44
FromFrancesco Porta
Subject[Csnd] filescal and fout trouble
Hello all,
i was testing filescal. The realtime output is ok but
the audio file created by fout has a distorted and pitch shifted
second note (a low frequency note).
What i'm doing wrong?

i try to attach a mp3 file with original sample, recorded samples,
rtout from filescal and fout output. Near 1.10 you will hear the
distorted note.

for testing you will need a sample. sorry.

(ubuntu 16.04, csound builded today)

Thanks,
ciao,
francesco



-odac -+rtaudio=jack -m0 -d


sr = 44100
ksmps = 128
nchnls = 2
0dbfs  = 1

gaudio init 0
giNoteDur init 2.972
giTableLen init 131072
gkNoteNumber init 0

opcode Trigger, kk, a
ainput xin
iThresh = 0.1
iWait = kr*giNoteDur
kTimer init (kr*giNoteDur) + 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

gaudio diskin2 "guitar_C.wav", p4
endin

schedule(1, 0, 5, 1)
schedule(1, 14, 5, 0.5)


instr 11

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

instr 12

iTableNum = p4

Sfile sprintf "sample%03d.wav", iTableNum
fout Sfile, 6, gaudio

event_i "i", 200, giNoteDur, 60, iTableNum
endin

instr 200

itable = p4
iamp = 1
ipitch = 1
itimescal = giNoteDur/p3
ilock = 0

ifftsize = 2048
idecim = 4 ; default

Sfile sprintf "sample%03d.wav", itable
aout filescal itimescal, iamp, ipitch, Sfile, ilock, ifftsize, idecim

outs aout, aout
fout "filescalTest.wav", 6, aout, aout
endin




i 11 0 90





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-11-15 16:32
Fromjpff
SubjectRe: [Csnd] filescal and fout trouble
The manua is unclear.  If klock 0/1 for on/off or the other way?

"klock -- 0 or 1, to switch phase-locking on/off " suggests 0 is on but 
normal practice would hae it 1 for on.

==John ff

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-11-15 16:39
Fromjpff
SubjectRe: [Csnd] filescal and fout trouble
Another thought.  I think fout does not mix output like outs, so if there 
are more than one instnce of instr200 I might expect troubles.  And dac 
would not be like the file.  If I am anywhere near right it suggests use 
onf monitor instead of fout.

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-11-15 17:27
Fromfra
SubjectRe: [Csnd] filescal and fout trouble
> Another thought.  I think fout does not mix output like outs, so if 
> there are more than one instnce of instr200 I might expect troubles.

Yes, you are right. This is the problem.

Thanks,

ciao,

francesco.

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