Csound Csound-dev Csound-tekno Search About

[Csnd] How to play a segment of audio file from disk?

Date2024-03-07 08:00
FromAnton Kholomiov
Subject[Csnd] How to play a segment of audio file from disk?
I can see that in diskin2 we can specify a skip time and play file not from the beginning. 
I wonder is it possible to play just a portion of the file with any opcode without loading the whole file to memory like loscil does?

So is it possible to specify not only file start but also loop length?
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

Date2024-03-07 12:12
Fromjoachim heintz
SubjectRe: [Csnd] How to play a segment of audio file from disk?
this would be done by setting the duration (p3) of the instrument.
or do you mean to play in a loop?


On 07/03/2024 09:00, Anton Kholomiov wrote:
> I can see that in diskin2 we can specify a skip time and play file not 
> from the beginning.
> I wonder is it possible to play just a portion of the file with any 
> opcode without loading the whole file to memory like loscil does?
> 
> So is it possible to specify not only file start but also loop length?
> 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

Date2024-03-07 12:16
FromRory Walsh
SubjectRe: [Csnd] How to play a segment of audio file from disk?
I think diskin2, or any of the file reading opcodes stream in blocks from disk using libsndfile. I don't think they load the entire sound file. 

On Thu, 7 Mar 2024 at 12:13, joachim heintz <jh@joachimheintz.de> wrote:
this would be done by setting the duration (p3) of the instrument.
or do you mean to play in a loop?


On 07/03/2024 09:00, Anton Kholomiov wrote:
> I can see that in diskin2 we can specify a skip time and play file not
> from the beginning.
> I wonder is it possible to play just a portion of the file with any
> opcode without loading the whole file to memory like loscil does?
>
> So is it possible to specify not only file start but also loop length?
> Csound mailing list Csound@listserv.heanet.ie
> <mailto:Csound@listserv.heanet.ie>
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> <https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND> Send bugs reports to
> https://github.com/csound/csound/issues
> <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
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

Date2024-03-07 12:23
FromAnton Kholomiov
SubjectRe: [Csnd] How to play a segment of audio file from disk?
I mean in a loop. But this suggests an interesting workaround if we have metro that triggers instrument with period that is equal to segment length we can emulate that.

My task is that I have stems of a track and I'd like to switch between sections. And be able to control stems individually. So each track is approx 1Gb, it would be hard to use loscil in this situation.

чт, 7 мар. 2024 г. в 15:13, joachim heintz <jh@joachimheintz.de>:
this would be done by setting the duration (p3) of the instrument.
or do you mean to play in a loop?


On 07/03/2024 09:00, Anton Kholomiov wrote:
> I can see that in diskin2 we can specify a skip time and play file not
> from the beginning.
> I wonder is it possible to play just a portion of the file with any
> opcode without loading the whole file to memory like loscil does?
>
> So is it possible to specify not only file start but also loop length?
> Csound mailing list Csound@listserv.heanet.ie
> <mailto:Csound@listserv.heanet.ie>
> https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> <https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND> Send bugs reports to
> https://github.com/csound/csound/issues
> <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
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

Date2024-03-07 12:38
Fromjoachim heintz
SubjectRe: [Csnd] How to play a segment of audio file from disk?
yes with a metro or even with automatic rescheduling:

instr Play
   aPlay diskin "myfile.wav",1
   if (chnget:i("loop-myfile") == 1) then
     schedule("Play",p3,p3)
   endif
endin
schedule("Play",0,2)

would play from sec 1 to sec 3 in a loop until you stop it via setting 
"loop-myfile" to zero.


On 07/03/2024 13:23, Anton Kholomiov wrote:
> I mean in a loop. But this suggests an interesting workaround if we have 
> metro that triggers instrument with period that is equal to segment 
> length we can emulate that.
> 
> My task is that I have stems of a track and I'd like to switch between 
> sections. And be able to control stems individually. So each track is 
> approx 1Gb, it would be hard to use loscil in this situation.
> 
> чт, 7 мар. 2024 г. в 15:13, joachim heintz  >:
> 
>     this would be done by setting the duration (p3) of the instrument.
>     or do you mean to play in a loop?
> 
> 
>     On 07/03/2024 09:00, Anton Kholomiov wrote:
>      > I can see that in diskin2 we can specify a skip time and play
>     file not
>      > from the beginning.
>      > I wonder is it possible to play just a portion of the file with any
>      > opcode without loading the whole file to memory like loscil does?
>      >
>      > So is it possible to specify not only file start but also loop
>     length?
>      > 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
> 
> 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

Date2024-03-07 12:42
FromVictor Lazzarini
SubjectRe: [Csnd] [EXTERNAL] [Csnd] How to play a segment of audio file from disk?
GEN1 can load a portion of a soundfile, just specify skip time and table size accordingly.
Then you can play from it, using poscil, tablei etc
========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 7 Mar 2024, at 12:23, Anton Kholomiov  wrote:
> 
> *Warning*
> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> I mean in a loop. But this suggests an interesting workaround if we have metro that triggers instrument with period that is equal to segment length we can emulate that.
> 
> My task is that I have stems of a track and I'd like to switch between sections. And be able to control stems individually. So each track is approx 1Gb, it would be hard to use loscil in this situation.
> 
> чт, 7 мар. 2024 г. в 15:13, joachim heintz :
> this would be done by setting the duration (p3) of the instrument.
> or do you mean to play in a loop?
> 
> 
> On 07/03/2024 09:00, Anton Kholomiov wrote:
> > I can see that in diskin2 we can specify a skip time and play file not 
> > from the beginning.
> > I wonder is it possible to play just a portion of the file with any 
> > opcode without loading the whole file to memory like loscil does?
> > 
> > So is it possible to specify not only file start but also loop length?
> > 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
> 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

Date2024-03-07 16:12
FromAnton Kholomiov
SubjectRe: [Csnd] [EXTERNAL] [Csnd] How to play a segment of audio file from disk?
Thank you for your replies. I think I'll try to use Joachim's function.
I'd like to read from disk because the real scenario is that I have the whole stem file and I'd like to play
sections of it in the loop (group of stem files which add up to the whole track). Something similar to what we can do in Ableton
with clip launcher.

And as I've said one track is 1Gb and it's going to be about 16-20 tracks. So this way I will quickly eat up all the RAM.
And even 1Gb is small for RPi, which I would like to try out to use for live setup as sampler playback.

чт, 7 мар. 2024 г. в 15:42, Victor Lazzarini <Victor.Lazzarini@mu.ie>:
GEN1 can load a portion of a soundfile, just specify skip time and table size accordingly.
Then you can play from it, using poscil, tablei etc
========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 7 Mar 2024, at 12:23, Anton Kholomiov <anton.kholomiov@GMAIL.COM> wrote:
>
> *Warning*
> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> I mean in a loop. But this suggests an interesting workaround if we have metro that triggers instrument with period that is equal to segment length we can emulate that.
>
> My task is that I have stems of a track and I'd like to switch between sections. And be able to control stems individually. So each track is approx 1Gb, it would be hard to use loscil in this situation.
>
> чт, 7 мар. 2024 г. в 15:13, joachim heintz <jh@joachimheintz.de>:
> this would be done by setting the duration (p3) of the instrument.
> or do you mean to play in a loop?
>
>
> On 07/03/2024 09:00, Anton Kholomiov wrote:
> > I can see that in diskin2 we can specify a skip time and play file not
> > from the beginning.
> > I wonder is it possible to play just a portion of the file with any
> > opcode without loading the whole file to memory like loscil does?
> >
> > So is it possible to specify not only file start but also loop length?
> > Csound mailing list Csound@listserv.heanet.ie
> > <mailto:Csound@listserv.heanet.ie>
> > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> > <https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND> Send bugs reports to
> > https://github.com/csound/csound/issues
> > <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
> 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
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

Date2024-03-07 16:14
FromAnton Kholomiov
SubjectRe: [Csnd] [EXTERNAL] [Csnd] How to play a segment of audio file from disk?
This is a neat idea to use p3 as a delay in time to trigger next event.

чт, 7 мар. 2024 г. в 19:12, Anton Kholomiov <anton.kholomiov@gmail.com>:
Thank you for your replies. I think I'll try to use Joachim's function.
I'd like to read from disk because the real scenario is that I have the whole stem file and I'd like to play
sections of it in the loop (group of stem files which add up to the whole track). Something similar to what we can do in Ableton
with clip launcher.

And as I've said one track is 1Gb and it's going to be about 16-20 tracks. So this way I will quickly eat up all the RAM.
And even 1Gb is small for RPi, which I would like to try out to use for live setup as sampler playback.

чт, 7 мар. 2024 г. в 15:42, Victor Lazzarini <Victor.Lazzarini@mu.ie>:
GEN1 can load a portion of a soundfile, just specify skip time and table size accordingly.
Then you can play from it, using poscil, tablei etc
========================
Prof. Victor Lazzarini
Maynooth University
Ireland

> On 7 Mar 2024, at 12:23, Anton Kholomiov <anton.kholomiov@GMAIL.COM> wrote:
>
> *Warning*
> This email originated from outside of Maynooth University's Mail System. Do not reply, click links or open attachments unless you recognise the sender and know the content is safe.
> I mean in a loop. But this suggests an interesting workaround if we have metro that triggers instrument with period that is equal to segment length we can emulate that.
>
> My task is that I have stems of a track and I'd like to switch between sections. And be able to control stems individually. So each track is approx 1Gb, it would be hard to use loscil in this situation.
>
> чт, 7 мар. 2024 г. в 15:13, joachim heintz <jh@joachimheintz.de>:
> this would be done by setting the duration (p3) of the instrument.
> or do you mean to play in a loop?
>
>
> On 07/03/2024 09:00, Anton Kholomiov wrote:
> > I can see that in diskin2 we can specify a skip time and play file not
> > from the beginning.
> > I wonder is it possible to play just a portion of the file with any
> > opcode without loading the whole file to memory like loscil does?
> >
> > So is it possible to specify not only file start but also loop length?
> > Csound mailing list Csound@listserv.heanet.ie
> > <mailto:Csound@listserv.heanet.ie>
> > https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
> > <https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND> Send bugs reports to
> > https://github.com/csound/csound/issues
> > <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
> 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
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