[Csnd] How to play back audio file at arbitrary points in time within the audio file

Hello everyone,

I do very simple things in Csound and as such struggle when going past
playing back a sine wave, for example.

Here's what I'm hoping to do.

I have a .wav file that is 60 seconds long. I want to be able to have
a Csound score that will play back parts of that .wav file starting at
arbitrary points of time within the wav file. Here is what some code
might look like:

i 1 0 5 45
i 1 5 10 20

So from seconds 0 to 5, Csound would play back the .wav file starting
at 45 seconds of the wave file. And then for the next five seconds
play back the .wav file starting at the 20th second of the wav file.

If I can further control the amplitude of the playback in the score
section then that would be of huge help also.

I tried diskin2 but I don't think it has this capability, or at least
I couldn't figure it out.

I am running Csound 6.16 on Ubuntu 21.04.

Thanks!
Dave Bellows

Csound mailing list
Csound@listserv.heanet.ie
https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND
Send bugs reports to
        Issues · csound/csound · GitHub
Discussions of bugs and features can be posted here

Hi!

Still, diskin2 should do what you want, it is the skiptime option:

a1[, a2[, ... aN]] **diskin2** ifilcod[, kpitch[, iskiptim \ ...

So you could use in your instrument

iSkipTime = p4

aSignal diskin2 "file.wav", 1, iSkipTime

or use soundin that has the skiptime right after filename if you don't need anything else from diskin:

ar1[, ar2[, ar3[, ... a24]]] **soundin** ifilcod [, iskptim] [, iformat] \

greetings,

tarmo


Kontakt David Bellows (<davebellows@gmail.com>) kirjutas kuupäeval T, 24. august 2021 kell 08:41:

Hello everyone,

I do very simple things in Csound and as such struggle when going past
playing back a sine wave, for example.

Here’s what I’m hoping to do.

I have a .wav file that is 60 seconds long. I want to be able to have
a Csound score that will play back parts of that .wav file starting at
arbitrary points of time within the wav file. Here is what some code
might look like:

i 1 0 5 45
i 1 5 10 20

So from seconds 0 to 5, Csound would play back the .wav file starting
at 45 seconds of the wave file. And then for the next five seconds
play back the .wav file starting at the 20th second of the wav file.

If I can further control the amplitude of the playback in the score
section then that would be of huge help also.

I tried diskin2 but I don’t think it has this capability, or at least
I couldn’t figure it out.

I am running Csound 6.16 on Ubuntu 21.04.

Thanks!
Dave Bellows

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

Hello tarmo,

Still, diskin2 should do what you want, it is the skiptime option:

Oh man, I feel dumb. I actually tried that but I was using the wrong
wav file, one that was too short. Using the proper wav file with the
proper timings and now it works like I want.

Thanks for the help!

Dave