[Csnd] set different start and stop playing a file
Date | 2011-11-18 16:00 |
From | Michele Nasti |
Subject | [Csnd] set different start and stop playing a file |
Hi all, I am using
to read a file into a function table. Then I pass this function table to
fsig0 pvstanal kstretch, giamp, gipitch, gifil0, gidet, giwrap, giskip, gifftsiz, giovlp, githresh to do some time-stretching operation.
Is it possible to set a custom start and stop point in the file? for example, if the file plays for 300 seconds, I want to play only from sec 15 to sec 30. I see the "giskip" to set the starting point; i can't however see the end loop code. Ideas? suggestions?
Michele
|
Date | 2011-11-18 16:54 |
From | Victor Lazzarini |
Subject | Re: [Csnd] set different start and stop playing a file |
There is no end loop code. Maybe what you need is something like mincer? It has a time position instead of a stretch factor. By controlling the time position you can loop to your content. On 18 Nov 2011, at 16:00, Michele Nasti wrote: Hi all, Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie |
Date | 2011-11-18 17:06 |
From | Michele Nasti |
Subject | Re: [Csnd] set different start and stop playing a file |
What if I use a f-statement? there is a time argoument.. but in the manual it is never specified what it is, and when I try to use it I get a "audio buffer underrun". 2011/11/18 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
|
Date | 2011-11-18 17:44 |
From | Victor Lazzarini |
Subject | Re: [Csnd] set different start and stop playing a file |
The time means creation time, so it's the time the table is created. I don't think it's what you want. On 18 Nov 2011, at 17:06, Michele Nasti wrote: What if I use a f-statement? there is a time argoument.. but in the manual it is never specified what it is, and when I try to use it I get a "audio buffer underrun". Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie |
Date | 2011-11-18 17:46 |
From | Michele Nasti |
Subject | Re: [Csnd] set different start and stop playing a file |
No.. i'all check the opcode you said. Thank you. Il giorno 18/nov/2011 18:41, "Victor Lazzarini" <Victor.Lazzarini@nuim.ie> ha scritto:
|
Date | 2011-11-19 10:39 |
From | Michele Nasti |
Subject | Re: [Csnd] set different start and stop playing a file |
The mincer opcode doesn't seem to do what I need. Maybe I didn't express clearly my problem. I have to play only a part of a file and loop it, with time stretching. It seems impossible that Csound can't put only a part of the file in a ftable. Any suggestions or ideas?
2011/11/18 Michele Nasti <michele.nasti@gmail.com>
|
Date | 2011-11-19 11:27 |
From | Victor.Lazzarini@nuim.ie |
Subject | Re: [Csnd] set different start and stop playing a file |
Attachments | None |
Date | 2011-11-19 11:40 |
From | Iain McCurdy |
Subject | RE: [Csnd] set different start and stop playing a file |
As Victor says, you can achieve what you describe using mincer and can then modulate the loop start and end points during performance if you like. If you really prefer to edit the audio stored in the function table you can still do this also. You can then loop and timestretch the whole function table using something like temposcal, as below. instr 1iloopstart = 1;(in seconds)iloopend = 2ktimescal = 1 ;time scaling factorifile ftgen 0,0,-(iloopend-iloopstart)*sr,1,"soundfile.wav",iloopstart,0,1idur = iloopend-iloopstarta1 temposcal ktimescal, 0.1, 1, ifile, 0out a1endin Iain > From: Victor.Lazzarini@nuim.ie > To: csound@lists.bath.ac.uk > Date: Sat, 19 Nov 2011 11:27:07 +0000 > Subject: Re: [Csnd] set different start and stop playing a file > > Minced does exactly that , all you need to do is control its read position to start end or loop the playback > > > > > ----- Original Message ----- From: Michele Nasti |
Date | 2011-11-19 11:45 |
From | Iain McCurdy |
Subject | RE: [Csnd] set different start and stop playing a file |
oops, that didn't come out right, try this: instr 1 iloopstart = 1;(in seconds) iloopend = 2 ktimescal = 1 ;time scaling factor ifile ftgen 0,0,-(iloopend-iloopstart)*sr,1,"ClassicalGuitar.wav",iloopstart,0,1 idur = iloopend-iloopstart a1 temposcal ktimescal, 0.1, 1, ifile, 0 out a1 endin ---------------------------------------- > From: i_mccurdy@hotmail.com > To: csound@lists.bath.ac.uk > Date: Sat, 19 Nov 2011 11:40:15 +0000 > Subject: RE: [Csnd] set different start and stop playing a file > > > As Victor says, you can achieve what you describe using mincer and can then modulate the loop start and end points during performance if you like. If you really prefer to edit the audio stored in the function table you can still do this also. You can then loop and timestretch the whole function table using something like temposcal, as below. > instr 1iloopstart = 1;(in seconds)iloopend = 2ktimescal = 1 ;time scaling factorifile ftgen 0,0,-(iloopend-iloopstart)*sr,1,"soundfile.wav",iloopstart,0,1idur = iloopend-iloopstarta1 temposcal ktimescal, 0.1, 1, ifile, 0out a1endin > Iain > > From: Victor.Lazzarini@nuim.ie > > To: csound@lists.bath.ac.uk > > Date: Sat, 19 Nov 2011 11:27:07 +0000 > > Subject: Re: [Csnd] set different start and stop playing a file > > > > Minced does exactly that , all you need to do is control its read position to start end or loop the playback > > > > > > > > > > ----- Original Message ----- From: Michele Nasti <michele.nasti@gmail.com> Date: Saturday, November 19, 2011 10:39 am Subject: Re: [Csnd] set different start and stop playing a file To: csound@lists.bath.ac.uk > The mincer opcode doesn't seem to do what I need. > Maybe I didn't express clearly my problem. I have to play only a part of a file and loop it, with time stretching. It seems impossible that Csound can't put only a part of the file in a ftable. Any suggestions or ideas? > > 2011/11/18 Michele Nasti <michele.nasti@gmail.com> > No.. i'all check the opcode you said. Thank you. Il giorno 18/nov/2011 18:41, "Victor Lazzarini" <Victor.Lazzarini@nuim.ie> ha scritto: > The time means creation time, so it's the time the table is created. I don't think it's what you want. > On 18 Nov 2011, at 17:06, Michele Nasti wrote: > > What if I use a f-statement? there is a time argoument.. but in the manual it is never specified what it is, and when I try to use it I get a "audio buffer underrun". > 2011/11/18 Victor Lazzarini <Victor.Lazzarini@nuim.ie> > There is no end loop code. Maybe what you need is something like mincer? It has a time position instead of a stretch factor. By controlling the time position you can loop to your content. > On 18 Nov 2011, at 16:00, Michele Nasti wrote:> > Hi all, I am using > > gifil0 ftgen 0, 0, 0, 1, "GioPro01.aif", 0, 0, 1 > > to read a file into a function table. Then I pass this function table to > > fsig0 pvstanal kstretch, giamp, gipitch, gifil0, gidet, giwrap, giskip, gifftsiz, giovlp, githresh > > to do some time-stretching operation. > > Is it possible to set a custom start and stop point in the file? for example, if the file plays for 300 seconds, I want to play only from sec 15 to sec 30. I see the "giskip" to set the starting point; i can't however see the end loop code. > Ideas? suggestions? > > Michele > > > > Dr Victor Lazzarini> Senior Lecturer> Dept. of Music> NUI Maynooth Ireland> tel.: +353 1 708 3545 > Victor dot Lazzarini AT nuim dot ie> > > > > > Dr Victor Lazzarini> Senior Lecturer> Dept. of Music> NUI Maynooth Ireland> tel.: +353 1 708 3545 > Victor dot Lazzarini AT nuim dot ie> > > > Dr Victor Lazzarini, Senior Lecturer, Dept. of Music, National University of Ireland, Maynooth > > > > > > Send bugs reports to the Sourceforge bug tracker > > https://sourceforge.net/tracker/?group_id=81968&atid=564599 > > Discussions of bugs and features can be posted here > > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" > > > > > Send bugs reports to the Sourceforge bug tracker > https://sourceforge.net/tracker/?group_id=81968&atid=564599 > Discussions of bugs and features can be posted here > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" > |
Date | 2011-11-19 14:04 |
From | k_o_m_p |
Subject | Re: [Csnd] set different start and stop playing a file |
If you prefer you could also use a table with phasor. With some maths it would do what you want. Luis Am 19.11.11 12:40, schrieb Iain McCurdy: > As Victor says, you can achieve what you describe using mincer and can then modulate the loop start and end points during performance if you like. If you really prefer to edit the audio stored in the function table you can still do this also. You can then loop and timestretch the whole function table using something like temposcal, as below. > instr 1iloopstart = 1;(in seconds)iloopend = 2ktimescal = 1 ;time scaling factorifile ftgen 0,0,-(iloopend-iloopstart)*sr,1,"soundfile.wav",iloopstart,0,1idur = iloopend-iloopstarta1 temposcal ktimescal, 0.1, 1, ifile, 0out a1endin > Iain >> From: Victor.Lazzarini@nuim.ie >> To: csound@lists.bath.ac.uk >> Date: Sat, 19 Nov 2011 11:27:07 +0000 >> Subject: Re: [Csnd] set different start and stop playing a file >> >> Minced does exactly that , all you need to do is control its read position to start end or loop the playback >> >> >> >> |
Date | 2011-11-19 15:48 |
From | Victor Lazzarini |
Subject | Re: [Csnd] set different start and stop playing a file |
But will not do timestretching. On 19 Nov 2011, at 14:04, k_o_m_p wrote: > If you prefer you could also use a table with phasor. With some maths it would do what you want. > Luis > > Am 19.11.11 12:40, schrieb Iain McCurdy: >> As Victor says, you can achieve what you describe using mincer and can then modulate the loop start and end points during performance if you like. If you really prefer to edit the audio stored in the function table you can still do this also. You can then loop and timestretch the whole function table using something like temposcal, as below. >> instr 1iloopstart = 1;(in seconds)iloopend = 2ktimescal = 1 ;time scaling factorifile ftgen 0,0,-(iloopend-iloopstart)*sr,1,"soundfile.wav",iloopstart,0,1idur = iloopend-iloopstarta1 temposcal ktimescal, 0.1, 1, ifile, 0out a1endin >> Iain >>> From: Victor.Lazzarini@nuim.ie >>> To: csound@lists.bath.ac.uk >>> Date: Sat, 19 Nov 2011 11:27:07 +0000 >>> Subject: Re: [Csnd] set different start and stop playing a file >>> >>> Minced does exactly that , all you need to do is control its read position to start end or loop the playback >>> >>> >>> >>> > > -- > -- > http://luisantunespena.eu > > > > Send bugs reports to the Sourceforge bug tracker > https://sourceforge.net/tracker/?group_id=81968&atid=564599 > Discussions of bugs and features can be posted here > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" > Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie Send bugs reports to the Sourceforge bug tracker https://sourceforge.net/tracker/?group_id=81968&atid=564599 Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound" |
Date | 2011-11-19 17:15 |
From | Tito Latini |
Subject | Re: [Csnd] set different start and stop playing a file |
Attachments | None |
Date | 2011-11-19 18:00 |
From | Tito Latini |
Subject | Re: [Csnd] set different start and stop playing a file |
Attachments | None |
Date | 2011-11-19 19:20 |
From | Michele Nasti |
Subject | Re: [Csnd] set different start and stop playing a file |
The fact is that I have already build a very complex program and I generate the csd on the fly, so if I can integrate this loop part with the code I wrote before it is great, else I have to rebuild/rewrite a big part of my program only for this (that means debug etc.). I have to experiment all your suggestions; I hope tomorrow or Monday I will try your codes. The csound community is great! Michele Nasti Sent from my Android phone Il giorno 19/nov/2011 18:58, "Tito Latini" <tito.01beta@gmail.com> ha scritto:
Sorry, 1/p3 is calculated 4 times in the previous csd file |
Date | 2011-11-20 01:15 |
From | Justin Glenn Smith |
Subject | Re: [Csnd] set different start and stop playing a file |
mincer does what you want - just provide the right signal for atimpt for example if you want to loop a table from 1.0 to 2.0 seconds repeatedly: istart = 1.0 ; the offset in seconds for the starting point iend = 2.0 ; the offset in seconds for the ending point ioffset = istart idur = iend - istart ispeed = 0.5 ; play back at half speed aphs phasor (1/idur)*ispeed ; play back at half speed atimpt = ioffset + (idur * aphs) ; our actual desired index Michele Nasti wrote: > The mincer opcode doesn't seem to do what I need. > > Maybe I didn't express clearly my problem. I have to play only a part of a > file and loop it, with time stretching. It seems impossible that Csound > can't put only a part of the file in a ftable. Any suggestions or ideas? > > 2011/11/18 Michele Nasti |
Date | 2011-11-21 15:17 |
From | Michele Nasti |
Subject | Re: [Csnd] set different start and stop playing a file |
Hi Justin, your code is helping me a lot. I only have a problem, I have to set ispeed, istart and iend dinamically via chnget. How can this be done, since they are i-variables? (sorry for the easy question if this is easy, but it's only 2 months that I am playing with csound!!)
Michele 2011/11/20 Justin Glenn Smith <noisesmith@gmail.com> mincer does what you want - just provide the right signal for atimpt |
Date | 2011-11-21 16:59 |
From | Victor Lazzarini |
Subject | Re: [Csnd] set different start and stop playing a file |
just make them kvars and it will be fine. On 21 Nov 2011, at 15:17, Michele Nasti wrote: Hi Justin, Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie |
Date | 2011-11-21 17:04 |
From | Michele Nasti |
Subject | Re: [Csnd] set different start and stop playing a file |
Yes Victor, in the end I did it and it was working. My last problem is a way to stop the loop via a variable. Something like, if I set loop to 0, it should not loop it and play the file only once. If gkloop is set to 1, it should loop.
I can't find the place where to put it. This is my code now, it plays two files and mixes it to the output: instr 1
gkstart =15.0; gkend = 20.0; gkspeed = 3; gkloop = 0; kpitch = 1; il pitch è l'altezza della frequenza klock = 1; lock sul pitch ? kamp = 1; segnale di amplificazione koffset = gkstart kdur = gkend - gkstart
aphs phasor (1/kdur)*gkspeed; play back at gispeed speed atimpt = koffset + (kdur * aphs) ; our actual desired index aout0 mincer atimpt , kamp, kpitch, 1, klock aout1 mincer atimpt , kamp, kpitch, 2, klock
endin
2011/11/21 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
|
Date | 2011-11-21 18:21 |
From | Victor Lazzarini |
Subject | Re: [Csnd] set different start and stop playing a file |
What you need then is two things 1) switch out the phasor sig 2) construct a line from the current position to the end position in the current duration To do 1), you can if gkloop == 0 then .... else aphs phasor (1/kdur)*gkspeed; play back at gispeed speed atimpt = koffset + (kdur * aphs) ; our actual desired index endif To do 2) you will need a UDO like this (I don't think there's any opcode that can do the job): opcode OnlyOnce,a,akk kval init 0 kend1 init 0 setksmps 1 apos,kdur,kend xin if kval == 0 then kval downsamp apos kpos = kval kincr = (kend-kpos)/kdur kend1 = kend endif kval = kval + kincr/kr if kval > kend1 then kval = kend1 endif aval upsamp kval xout aval endop which will be called if gkloop == 0 then atimpt OnlyOnce atimpt, kdur, gkend else ... endif I think this should work Victor On 21 Nov 2011, at 17:04, Michele Nasti wrote: Yes Victor, in the end I did it and it was working. Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie |
Date | 2011-11-22 16:01 |
From | Michele Nasti |
Subject | Re: [Csnd] set different start and stop playing a file |
Victor, pardon me if I only use your code and suggestions without really understanding completely them. The fact is that I need this code for my final project at university and I want it to work rapidly, otherwise I can't graduate :/
At the moment I have copied the opcode OnlyOnce you wrote me, and I have used it in this way: if gkloop == 1 then
else
endif
aout0 mincer atimpt , kamp, kpitch, 1, klock aout1 mincer atimpt , kamp, kpitch, 2, klock
Using it this way, if I set gkloop = 1, The loop runs only once, but when it reaches the end it stops on the last audio signal runing forever. How can I avoid this? I want that if the end of the loop is reached, It has to stop completely. Maybe this is because I set the instrument to run for 3600 seconds? I did this because I need CSound stay alive while I modify some parameters with a Java application.
2011/11/21 Victor Lazzarini <Victor.Lazzarini@nuim.ie>
|
Date | 2011-11-22 16:16 |
From | Adam Puckett |
Subject | Re: [Csnd] set different start and stop playing a file |
You can use f0 3600 in the score and it will run for 1 hour, and you can create a JButton whenever you want the instrument activated. On 11/22/11, Michele Nasti |
Date | 2011-11-22 17:14 |
From | Victor Lazzarini |
Subject | Re: [Csnd] set different start and stop playing a file |
yes, I think the problem is that mincer will keep playing the last frame at time position kpos. What you need to do is to switch the mincer off at that point with another conditional. Maybe kstop init 1 if gkloop == 1 then ... ktimpt downsamp atimpt if ktimpt >= kpos then kstop = 0 kstop port kstop, 0.01 endif else ... endif aout0 ... aout1 ... aout0 = aout0*kstop aout1 = aout1*kstop On 22 Nov 2011, at 16:01, Michele Nasti wrote: Victor, pardon me if I only use your code and suggestions without really understanding completely them. The fact is that I need this code for my final project at university and I want it to work rapidly, otherwise I can't graduate :/ Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie |