Csound Csound-dev Csound-tekno Search About

[Csnd] Reading and writing the same audio file with different instances

Date2019-04-10 14:50
Fromcybilsopsin
Subject[Csnd] Reading and writing the same audio file with different instances
Hello!

I'm looking to create a real-time audio mixing system based on running
several instances of csound at once. To pass audio between the programs, I'm
interested in the possibility of using simple audio files on my hard disk.
Essentially, I want to use audio files as realtime buffers.

The Csound program thats generating sound would be writing to a file.
Meanwhile, a different instance of csound would be reading the same file,
but several seconds behind where the first is writing (like a delay buffer).
Note that I am not aiming to read the new audio "instantaneously", but
rather a delay of several seconds (or more) is an expected and integrated
part of the system. So the two programs would be reading and writing at
locations many thousands of samples apart.

Also note that my end goal would be a system involving many instances of
csound running together and reading and writing to many audio files at the
same time. The goal is that each "track" in the music is being written in
realtime to its own audio file buffer, which is then being read by one
"channel" of my "virtual mixer". A typical song might have 5 or more of
these read-write pairs (so 10 instances of csound) doing their thing at any
one time.

My question is, am I courting disaster by doing things this way? Is there
anything I should know or precautions I should take? Are the fout and fin
opcodes the best for this purpose? I know I could make the system use the
audio device input/output channels, which is probably a saner method, but
I'm feeling kinda insane :)

Thanks in advance for your insight.



-----
***cybilopsin***
"We are all guilty of crime, the great crime of not living life to the full." - Henry Miller
--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2019-04-10 15:28
FromRory Walsh
SubjectRe: [Csnd] Reading and writing the same audio file with different instances
Did you try it out already? Does it work?  

On Wed, 10 Apr 2019 at 14:51, cybilsopsin <cybilopsin@gmail.com> wrote:
Hello!

I'm looking to create a real-time audio mixing system based on running
several instances of csound at once. To pass audio between the programs, I'm
interested in the possibility of using simple audio files on my hard disk.
Essentially, I want to use audio files as realtime buffers.

The Csound program thats generating sound would be writing to a file.
Meanwhile, a different instance of csound would be reading the same file,
but several seconds behind where the first is writing (like a delay buffer).
Note that I am not aiming to read the new audio "instantaneously", but
rather a delay of several seconds (or more) is an expected and integrated
part of the system. So the two programs would be reading and writing at
locations many thousands of samples apart.

Also note that my end goal would be a system involving many instances of
csound running together and reading and writing to many audio files at the
same time. The goal is that each "track" in the music is being written in
realtime to its own audio file buffer, which is then being read by one
"channel" of my "virtual mixer". A typical song might have 5 or more of
these read-write pairs (so 10 instances of csound) doing their thing at any
one time.

My question is, am I courting disaster by doing things this way? Is there
anything I should know or precautions I should take? Are the fout and fin
opcodes the best for this purpose? I know I could make the system use the
audio device input/output channels, which is probably a saner method, but
I'm feeling kinda insane :)

Thanks in advance for your insight.



-----
***cybilopsin***
"We are all guilty of crime, the great crime of not living life to the full." - Henry Miller
--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2019-04-10 16:15
FromJohn
SubjectRe: [Csnd] Reading and writing the same audio file with different instances
I think it would work unless you are writing WAV/AIFF which need a header 
update on closing.  But I have not tried.  I can imagine a way with a 
custom build program to implement the dey and writing/reading to a pipe 
(not on windows as they do not do ppes roperly at keast in my experience)

As Rory says, try it.


On Wed, 10 Apr 2019, Rory Walsh wrote:

> Did you try it out already? Does it work?  
>

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

Date2019-04-10 20:03
FromMichael Gogins
SubjectRe: [Csnd] Reading and writing the same audio file with different instances
Keep in mind that a 10 second delay of 96000 KHz float stereo samples is 7,680,000 bytes. You could have a hundred or so such delays going in memory in one instance of Csound on any reasonable workstation. 

Regards, 
Mike

On Thu, Apr 11, 2019, 03:15 John <jpff@codemist.co.uk> wrote:
I think it would work unless you are writing WAV/AIFF which need a header
update on closing.  But I have not tried.  I can imagine a way with a
custom build program to implement the dey and writing/reading to a pipe
(not on windows as they do not do ppes roperly at keast in my experience)

As Rory says, try it.


On Wed, 10 Apr 2019, Rory Walsh wrote:

> Did you try it out already? Does it work?  
>

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

Date2019-04-10 20:30
Fromcybilsopsin
SubjectRe: [Csnd] Reading and writing the same audio file with different instances
Thanks! I will try some concept tests soon and get back to you!

Mike - You are right, and hopefully economies of scale and modern computing
will come to my aid also when i try to implement this multi-instance /
hard-disk based version.

Swear I'm not re-inventing the DAW or Ableton Live! Hehe



-----
***cybilopsin***
"We are all guilty of crime, the great crime of not living life to the full." - Henry Miller
--
Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html

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

Date2019-04-10 20:48
From"C. R. Craig"
SubjectRe: [Csnd] Reading and writing the same audio file with different instances
I think Michael was hinting at the notion that it is unnecessary to write to disk since any workstation these days has more than enough RAM to handle many hundreds of such streams with delays . . . And I would add that you’re likely to significantly shorten the life of any hard disk you use for this purpose :-)

Robert

> On Apr 10, 2019, at 3:30 PM, cybilsopsin  wrote:
> 
> Thanks! I will try some concept tests soon and get back to you!
> 
> Mike - You are right, and hopefully economies of scale and modern computing
> will come to my aid also when i try to implement this multi-instance /
> hard-disk based version.
> 
> Swear I'm not re-inventing the DAW or Ableton Live! Hehe
> 
> 
> 
> -----
> ***cybilopsin***
> "We are all guilty of crime, the great crime of not living life to the full." - Henry Miller
> --
> Sent from: http://csound.1045644.n5.nabble.com/Csound-General-f1093014.html
> 
> 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