Csound Csound-dev Csound-tekno Search About

[CSOUND-DEV] How does csound deal with audio?

Date2015-10-13 20:05
FromPeter Burgess
Subject[CSOUND-DEV] How does csound deal with audio?
I know csound has a good number of dependencies, and I was wondering what libraries exactly csound uses to play audio, and to tightly time the sequences? I know port audio is one of the dependencies so I wondered if csound might use port audio for that. Or does it the whole system change depending on the options you've set? I know CsoundQt at least lets you change the audio output settings.

I ask, because my current project utilizes csound for some complex synth/sample playing, but I also need a basic wav player in my project. Due to how my wav player works, csound itself isn't ideal for the task so I have been looking into alternatives just for that part of the program. Ideally I would like to use one of the dependencies of csound, as that will already be a part of my project. This will avoid adding more dependencies and extra hard-disk space

At the moment, I am using SDL mixer for this (because I've build my GUI in SDL), which is super basic! It is almost exactly what I need, except I need to know how far through the wav playback is. Sadly, there doesn't appear to be a way of doing this with SDL.

Cheers in advance!

Pete

Date2015-10-13 20:16
FromRory Walsh
SubjectRe: [CSOUND-DEV] How does csound deal with audio?
I believe the only dependency Csound has is libsndfile. However, if you wish to output audio live to speakers then you need portaudio. But surely Csound could be utilised as a wav player. I've build Csound file players before, and I know a few people that have even built them with Cabbage. You must be looking to do more than simple stream audio from disk?  

On 13 October 2015 at 22:05, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
I know csound has a good number of dependencies, and I was wondering what libraries exactly csound uses to play audio, and to tightly time the sequences? I know port audio is one of the dependencies so I wondered if csound might use port audio for that. Or does it the whole system change depending on the options you've set? I know CsoundQt at least lets you change the audio output settings.

I ask, because my current project utilizes csound for some complex synth/sample playing, but I also need a basic wav player in my project. Due to how my wav player works, csound itself isn't ideal for the task so I have been looking into alternatives just for that part of the program. Ideally I would like to use one of the dependencies of csound, as that will already be a part of my project. This will avoid adding more dependencies and extra hard-disk space

At the moment, I am using SDL mixer for this (because I've build my GUI in SDL), which is super basic! It is almost exactly what I need, except I need to know how far through the wav playback is. Sadly, there doesn't appear to be a way of doing this with SDL.

Cheers in advance!

Pete


Date2015-10-13 20:40
FromPeter Burgess
SubjectRe: [CSOUND-DEV] How does csound deal with audio?
You're right, it's maybe not as simple as I made it sound. Basically the wav player isn't entirely user controlled (beyond play/pause/stop) and it has no idea what wavs it is playing until runtime. There is no definite rule to what the file names will be, and there are a near infinite number of possible file names, so it has to be given file names and paths by the c++ program as it goes along. I did experiment with doing this in csound for a while, but I couldn't find a convenient way to set up c++/csound to handle this, and I also suspected that using an instance of csound just for wav play back might using alot of unessacary horsepower. I will also already have an instance of csound doing complex stuff in the background while the wavs are being played. Thoughts?

Pete

On Tue, Oct 13, 2015 at 8:16 PM, Rory Walsh <rorywalsh@ear.ie> wrote:
I believe the only dependency Csound has is libsndfile. However, if you wish to output audio live to speakers then you need portaudio. But surely Csound could be utilised as a wav player. I've build Csound file players before, and I know a few people that have even built them with Cabbage. You must be looking to do more than simple stream audio from disk?  

On 13 October 2015 at 22:05, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
I know csound has a good number of dependencies, and I was wondering what libraries exactly csound uses to play audio, and to tightly time the sequences? I know port audio is one of the dependencies so I wondered if csound might use port audio for that. Or does it the whole system change depending on the options you've set? I know CsoundQt at least lets you change the audio output settings.

I ask, because my current project utilizes csound for some complex synth/sample playing, but I also need a basic wav player in my project. Due to how my wav player works, csound itself isn't ideal for the task so I have been looking into alternatives just for that part of the program. Ideally I would like to use one of the dependencies of csound, as that will already be a part of my project. This will avoid adding more dependencies and extra hard-disk space

At the moment, I am using SDL mixer for this (because I've build my GUI in SDL), which is super basic! It is almost exactly what I need, except I need to know how far through the wav playback is. Sadly, there doesn't appear to be a way of doing this with SDL.

Cheers in advance!

Pete



Date2015-10-13 20:47
FromRory Walsh
SubjectRe: [CSOUND-DEV] How does csound deal with audio?
Surely you can do all this with SDL seen as you are already using it for the GUI?

On 13 October 2015 at 22:40, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
You're right, it's maybe not as simple as I made it sound. Basically the wav player isn't entirely user controlled (beyond play/pause/stop) and it has no idea what wavs it is playing until runtime. There is no definite rule to what the file names will be, and there are a near infinite number of possible file names, so it has to be given file names and paths by the c++ program as it goes along. I did experiment with doing this in csound for a while, but I couldn't find a convenient way to set up c++/csound to handle this, and I also suspected that using an instance of csound just for wav play back might using alot of unessacary horsepower. I will also already have an instance of csound doing complex stuff in the background while the wavs are being played. Thoughts?

Pete

On Tue, Oct 13, 2015 at 8:16 PM, Rory Walsh <rorywalsh@ear.ie> wrote:
I believe the only dependency Csound has is libsndfile. However, if you wish to output audio live to speakers then you need portaudio. But surely Csound could be utilised as a wav player. I've build Csound file players before, and I know a few people that have even built them with Cabbage. You must be looking to do more than simple stream audio from disk?  

On 13 October 2015 at 22:05, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
I know csound has a good number of dependencies, and I was wondering what libraries exactly csound uses to play audio, and to tightly time the sequences? I know port audio is one of the dependencies so I wondered if csound might use port audio for that. Or does it the whole system change depending on the options you've set? I know CsoundQt at least lets you change the audio output settings.

I ask, because my current project utilizes csound for some complex synth/sample playing, but I also need a basic wav player in my project. Due to how my wav player works, csound itself isn't ideal for the task so I have been looking into alternatives just for that part of the program. Ideally I would like to use one of the dependencies of csound, as that will already be a part of my project. This will avoid adding more dependencies and extra hard-disk space

At the moment, I am using SDL mixer for this (because I've build my GUI in SDL), which is super basic! It is almost exactly what I need, except I need to know how far through the wav playback is. Sadly, there doesn't appear to be a way of doing this with SDL.

Cheers in advance!

Pete




Date2015-10-13 20:59
FromPeter Burgess
SubjectRe: [CSOUND-DEV] How does csound deal with audio?
SDL audio functions are very basic, even with SDL Mixer. My main issue is I need to accurately time when wav files start compared to other wav files. There is a function that I thought looked promising that allows you to build your own basic wav player with a callback function. It sounded like you might be able to keep track of the buffer. But my experimentation got me no-where, the SDL Mixer documentation isn't very clear, and posting in SDL forums didn't yield any response. The port audio documentation looks much clearer, and I'm sure i could knock up what I need with it if I fiddled around for a day.

If I was sure that the function actually did what I wanted, I would struggle on with SDL, but it's not totally clear (to me at least) and the last few reads through the docs have raised some doubts.

On Tue, Oct 13, 2015 at 8:47 PM, Rory Walsh <rorywalsh@ear.ie> wrote:
Surely you can do all this with SDL seen as you are already using it for the GUI?

On 13 October 2015 at 22:40, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
You're right, it's maybe not as simple as I made it sound. Basically the wav player isn't entirely user controlled (beyond play/pause/stop) and it has no idea what wavs it is playing until runtime. There is no definite rule to what the file names will be, and there are a near infinite number of possible file names, so it has to be given file names and paths by the c++ program as it goes along. I did experiment with doing this in csound for a while, but I couldn't find a convenient way to set up c++/csound to handle this, and I also suspected that using an instance of csound just for wav play back might using alot of unessacary horsepower. I will also already have an instance of csound doing complex stuff in the background while the wavs are being played. Thoughts?

Pete

On Tue, Oct 13, 2015 at 8:16 PM, Rory Walsh <rorywalsh@ear.ie> wrote:
I believe the only dependency Csound has is libsndfile. However, if you wish to output audio live to speakers then you need portaudio. But surely Csound could be utilised as a wav player. I've build Csound file players before, and I know a few people that have even built them with Cabbage. You must be looking to do more than simple stream audio from disk?  

On 13 October 2015 at 22:05, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
I know csound has a good number of dependencies, and I was wondering what libraries exactly csound uses to play audio, and to tightly time the sequences? I know port audio is one of the dependencies so I wondered if csound might use port audio for that. Or does it the whole system change depending on the options you've set? I know CsoundQt at least lets you change the audio output settings.

I ask, because my current project utilizes csound for some complex synth/sample playing, but I also need a basic wav player in my project. Due to how my wav player works, csound itself isn't ideal for the task so I have been looking into alternatives just for that part of the program. Ideally I would like to use one of the dependencies of csound, as that will already be a part of my project. This will avoid adding more dependencies and extra hard-disk space

At the moment, I am using SDL mixer for this (because I've build my GUI in SDL), which is super basic! It is almost exactly what I need, except I need to know how far through the wav playback is. Sadly, there doesn't appear to be a way of doing this with SDL.

Cheers in advance!

Pete





Date2015-10-13 21:01
FromPeter Burgess
SubjectRe: [CSOUND-DEV] How does csound deal with audio?
Unless there's a workaround. I guess SDL has it's own dependencies right? Maybe I can keep my program as is with SDL mixer and use one of SDL's dependencies to monitor the audio buffer instead?

On Tue, Oct 13, 2015 at 8:59 PM, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
SDL audio functions are very basic, even with SDL Mixer. My main issue is I need to accurately time when wav files start compared to other wav files. There is a function that I thought looked promising that allows you to build your own basic wav player with a callback function. It sounded like you might be able to keep track of the buffer. But my experimentation got me no-where, the SDL Mixer documentation isn't very clear, and posting in SDL forums didn't yield any response. The port audio documentation looks much clearer, and I'm sure i could knock up what I need with it if I fiddled around for a day.

If I was sure that the function actually did what I wanted, I would struggle on with SDL, but it's not totally clear (to me at least) and the last few reads through the docs have raised some doubts.

On Tue, Oct 13, 2015 at 8:47 PM, Rory Walsh <rorywalsh@ear.ie> wrote:
Surely you can do all this with SDL seen as you are already using it for the GUI?

On 13 October 2015 at 22:40, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
You're right, it's maybe not as simple as I made it sound. Basically the wav player isn't entirely user controlled (beyond play/pause/stop) and it has no idea what wavs it is playing until runtime. There is no definite rule to what the file names will be, and there are a near infinite number of possible file names, so it has to be given file names and paths by the c++ program as it goes along. I did experiment with doing this in csound for a while, but I couldn't find a convenient way to set up c++/csound to handle this, and I also suspected that using an instance of csound just for wav play back might using alot of unessacary horsepower. I will also already have an instance of csound doing complex stuff in the background while the wavs are being played. Thoughts?

Pete

On Tue, Oct 13, 2015 at 8:16 PM, Rory Walsh <rorywalsh@ear.ie> wrote:
I believe the only dependency Csound has is libsndfile. However, if you wish to output audio live to speakers then you need portaudio. But surely Csound could be utilised as a wav player. I've build Csound file players before, and I know a few people that have even built them with Cabbage. You must be looking to do more than simple stream audio from disk?  

On 13 October 2015 at 22:05, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
I know csound has a good number of dependencies, and I was wondering what libraries exactly csound uses to play audio, and to tightly time the sequences? I know port audio is one of the dependencies so I wondered if csound might use port audio for that. Or does it the whole system change depending on the options you've set? I know CsoundQt at least lets you change the audio output settings.

I ask, because my current project utilizes csound for some complex synth/sample playing, but I also need a basic wav player in my project. Due to how my wav player works, csound itself isn't ideal for the task so I have been looking into alternatives just for that part of the program. Ideally I would like to use one of the dependencies of csound, as that will already be a part of my project. This will avoid adding more dependencies and extra hard-disk space

At the moment, I am using SDL mixer for this (because I've build my GUI in SDL), which is super basic! It is almost exactly what I need, except I need to know how far through the wav playback is. Sadly, there doesn't appear to be a way of doing this with SDL.

Cheers in advance!

Pete






Date2015-10-13 21:15
FromPeter Burgess
SubjectRe: [CSOUND-DEV] How does csound deal with audio?
I'm probably out of my depth with that kind of caper mind... I struggle to use csound api without calling for help every 2 seconds :D I'm also already finding portaudio a little overwhelming, lol! Oh well, I'll figure it out one way or another.

Date2015-10-13 21:25
FromRory Walsh
SubjectRe: [CSOUND-DEV] How does csound deal with audio?
If you want to use a complete toolkit for audio and GUI then I suggest looking at JUCE. It has no dependencies. And can do most of what the other audio and GUI toolkits do. Plus it's very easy to add Csound to it. 

On 13 October 2015 at 23:15, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
I'm probably out of my depth with that kind of caper mind... I struggle to use csound api without calling for help every 2 seconds :D I'm also already finding portaudio a little overwhelming, lol! Oh well, I'll figure it out one way or another.


Date2015-10-14 11:37
FromPeter Burgess
SubjectRe: [CSOUND-DEV] How does csound deal with audio?
That's not a bad idea, I actually downloaded juce a while back and deleted it again in favour of Qt, which I've since ditched in favour of SDL + OpenGL. That was back when Csound was entirely responsible for all the audio. Juce would possibly make my life easier, I'll have another look at that. Thanks!

On Tue, Oct 13, 2015 at 9:25 PM, Rory Walsh <rorywalsh@ear.ie> wrote:
If you want to use a complete toolkit for audio and GUI then I suggest looking at JUCE. It has no dependencies. And can do most of what the other audio and GUI toolkits do. Plus it's very easy to add Csound to it. 

On 13 October 2015 at 23:15, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
I'm probably out of my depth with that kind of caper mind... I struggle to use csound api without calling for help every 2 seconds :D I'm also already finding portaudio a little overwhelming, lol! Oh well, I'll figure it out one way or another.



Date2015-10-14 13:19
Fromjpff
SubjectRe: [CSOUND-DEV] How does csound deal with audio?
Csound uses libsndfile foe file-based audio.  For playing it can use any 
of many systems depending on platform.  Of these portaudio is cross 
platform, but other may be better in efficiency
ALSA, Jack, auhal, pulse, winmm at least

Date2015-10-14 16:49
FromPeter Burgess
SubjectRe: [CSOUND-DEV] How does csound deal with audio?
Thanks for the info! It's good to know there's a lot of options available. I've been thinking this whole time about cross platform libraries, but I do roughly know these days how to define different behaviour for different systems, so I probably shouldn't totally overlook that as an option.

On Wed, Oct 14, 2015 at 1:19 PM, jpff <jpff@codemist.co.uk> wrote:
Csound uses libsndfile foe file-based audio.  For playing it can use any of many systems depending on platform.  Of these portaudio is cross platform, but other may be better in efficiency
ALSA, Jack, auhal, pulse, winmm at least

==John


Date2015-10-15 02:52
FromAndres Cabrera
SubjectRe: [CSOUND-DEV] How does csound deal with audio?
I believe you can also use Csound through the API to do the audio computation without going out to the hardware. Is that correct?

Cheers,
Andrés

On Wed, Oct 14, 2015 at 8:49 AM, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Thanks for the info! It's good to know there's a lot of options available. I've been thinking this whole time about cross platform libraries, but I do roughly know these days how to define different behaviour for different systems, so I probably shouldn't totally overlook that as an option.

On Wed, Oct 14, 2015 at 1:19 PM, jpff <jpff@codemist.co.uk> wrote:
Csound uses libsndfile foe file-based audio.  For playing it can use any of many systems depending on platform.  Of these portaudio is cross platform, but other may be better in efficiency
ALSA, Jack, auhal, pulse, winmm at least

==John



Date2015-10-15 08:11
FromRory Walsh
SubjectRe: [CSOUND-DEV] How does csound deal with audio?

Correct. So many ways of using this wonderful software ;)

On 15 Oct 2015 02:52, "Andres Cabrera" <mantaraya36@gmail.com> wrote:
I believe you can also use Csound through the API to do the audio computation without going out to the hardware. Is that correct?

Cheers,
Andrés

On Wed, Oct 14, 2015 at 8:49 AM, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
Thanks for the info! It's good to know there's a lot of options available. I've been thinking this whole time about cross platform libraries, but I do roughly know these days how to define different behaviour for different systems, so I probably shouldn't totally overlook that as an option.

On Wed, Oct 14, 2015 at 1:19 PM, jpff <jpff@codemist.co.uk> wrote:
Csound uses libsndfile foe file-based audio.  For playing it can use any of many systems depending on platform.  Of these portaudio is cross platform, but other may be better in efficiency
ALSA, Jack, auhal, pulse, winmm at least

==John