Csound Csound-dev Csound-tekno Search About

[Csnd] making a wav file from live midi input

Date2009-04-04 23:07
FromStefan Thomas
Subject[Csnd] making a wav file from live midi input
Dear community,
I have succesfully made my first few patches and I can play it live
via midi, using  "-odevaudio -M1 -b400" as csounds options.
Now I would like to record what I'm playinf directly to a wave file,
but I don't know how to do it.
Maybee I should mention, that I'm using a linux machine, with kubuntu studio.
Thanks for Your support
Stefan

Date2009-04-05 01:40
Fromvictor
Subject[Csnd] Re: making a wav file from live midi input
Try using the opcode 'fout'.
----- Original Message ----- 
From: "Stefan Thomas" 
To: 
Sent: Saturday, April 04, 2009 11:07 PM
Subject: [Csnd] making a wav file from live midi input


> Dear community,
> I have succesfully made my first few patches and I can play it live
> via midi, using  "-odevaudio -M1 -b400" as csounds options.
> Now I would like to record what I'm playinf directly to a wave file,
> but I don't know how to do it.
> Maybee I should mention, that I'm using a linux machine, with kubuntu 
> studio.
> Thanks for Your support
> Stefan
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
> csound" 


Date2009-04-05 09:42
Fromjoachim heintz
Subject[Csnd] Re: making a wav file from live midi input
If you use QuteCsound as frontend, you can simply push the Record  
button for this.
Best -
	joachim


Am 05.04.2009 um 00:07 schrieb Stefan Thomas:

> Dear community,
> I have succesfully made my first few patches and I can play it live
> via midi, using  "-odevaudio -M1 -b400" as csounds options.
> Now I would like to record what I'm playinf directly to a wave file,
> but I don't know how to do it.
> Maybee I should mention, that I'm using a linux machine, with  
> kubuntu studio.
> Thanks for Your support
> Stefan
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"


Date2009-04-05 10:37
FromStefan Thomas
Subject[Csnd] Re: Re: making a wav file from live midi input
Dear all,
thanks for Your fast answers. I have been able to play live while
making a wav-file at the same time, but the quality of the wav-file is
terrible. I don't know where I could change this.
Here is the code:


-odevaudio -M1 -b400


sr = 44100
kr = 4410
ksmps = 10
nchnls = 2

instr 1
;READ RT-MIDI NOTE NUMBERS, CONVERT TO CPS
icps    cpsmidi
;READ RT-MIDI VELOCITY, CONVERT TO AMP VALUES WITHIN THE RANGE 0-10000
iamp    ampmidi    10000
;CREATE A SINE TONE
asig    oscili    iamp, icps, 1
;SEND AUDIO TO OUTPUTS
outs    asig, asig
ga1 = asig
ga2 = asig
fout    "test.wav", 4, ga1, ga2
endin


f1 0 1024 10 1 0 .25 0 .17
i1 0 600  ;let dummy instrument run so performance doesn't end




2009/4/5 joachim heintz :
> If you use QuteCsound as frontend, you can simply push the Record button for
> this.
> Best -
>        joachim
>
>
> Am 05.04.2009 um 00:07 schrieb Stefan Thomas:
>
>> Dear community,
>> I have succesfully made my first few patches and I can play it live
>> via midi, using  "-odevaudio -M1 -b400" as csounds options.
>> Now I would like to record what I'm playinf directly to a wave file,
>> but I don't know how to do it.
>> Maybee I should mention, that I'm using a linux machine, with kubuntu
>> studio.
>> Thanks for Your support
>> Stefan
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>


Date2009-04-05 11:24
FromIain McCurdy
Subject[Csnd] RE: Re: Re: making a wav file from live midi input
Hi Stefan,

There are a few thing to change in your example.
You should place the fout (sound file recording) line in an separate always on instrument. This will then record the entire performance including overlapping notes correctly.
You only need to use global variables (one beginning with 'g') when you want to use the same variable across two or more instruments. Non-global variables only have scope within the instrument within which they have been created. Non-global variables with the same name in different instruments are different variables probably with different values.
In the amended version of your code (below) a global variable is used to accumulate the audio from all instr 1 instances, thereby allowing overlapping notes/polyphony to be recorded.
A single instance of instr 2, the file recording instrument, runs for the entire duration of our realtime performance. Do not run more that one instance of the same fout line! I think this was what was messing up the signal quality of your original code - every time a new note was played a new instance of the same fout line would be created.
Our global variable needs to be initialised just (just after the header block) as will be needed in instr 2 before we have had a chance to play any notes on the keyboard and therefore give it a different value in instr 1.
It needs to be cleared (set to zero) when we are finished with it at the end of instr 2 because of the accumulation thing that we are doing in instr 1. If you forget to do this you will very quickly end up with an unpleasant sound in your sound file recording (try it!).

Hope this helps,
Iain

<CsoundSynthesizer>
<CsOptions>
-odevaudio -M1 -b400
</CsOptions>
<CsInstruments>
sr = 44100
kr = 4410
ksmps = 10
nchnls = 2
 
;SET INITIAL VALUE FOR gasend (SILENCE)
gasend init 0

instr 1 ;OSCILLATOR INSTRUMENT
;READ RT-MIDI NOTE NUMBERS, CONVERT TO CPS
icps    cpsmidi
;READ RT-MIDI VELOCITY, CONVERT TO AMP VALUES WITHIN THE RANGE 0-10000
iamp    ampmidi    10000
;CREATE A HARMONIC TONE
asig    oscili    iamp, icps, 1
;SEND AUDIO TO OUTPUTS
outs    asig, asig
;ACCUMULATE ALL NOTES TO THE GLOBAL VARIABLE gasend
;THIS WILL PERMIT OVERLAPPING NOTES
gasend = gasend + asig
endin

instr 2 ;RECORDS ALL SOUND
;RECORD A MONO 16 BIT SOUND FILE
fout    "test.wav", 4, gasend
;CLEAR GLOBAL VARIABLE (I.E. ASSIGN IT TO ZERO)
gasend = 0
endin








</CsInstruments>
<CsScore>
;FUNCTION TABLE OF A HARMONIC TIMBRE
f1 0 1024 10 1 0 .25 0 .17
i2 0 600  ;RECORDING INSTRUMENT RUNS CONTINUOUSLY
</CsScore>
</CsoundSynthesizer>

> Date: Sun, 5 Apr 2009 11:37:07 +0200
> From: kontrapunktstefan@googlemail.com
> To: csound@lists.bath.ac.uk
> Subject: [Csnd] Re: Re: making a wav file from live midi input
>
> Dear all,
> thanks for Your fast answers. I have been able to play live while
> making a wav-file at the same time, but the quality of the wav-file is
> terrible. I don't know where I could change this.
> Here is the code:
> <CsoundSynthesizer>
> <CsOptions>
> -odevaudio -M1 -b400
> </CsOptions>
> <CsInstruments>
> sr = 44100
> kr = 4410
> ksmps = 10
> nchnls = 2
>
> instr 1
> ;READ RT-MIDI NOTE NUMBERS, CONVERT TO CPS
> icps cpsmidi
> ;READ RT-MIDI VELOCITY, CONVERT TO AMP VALUES WITHIN THE RANGE 0-10000
> iamp ampmidi 10000
> ;CREATE A SINE TONE
> asig oscili iamp, icps, 1
> ;SEND AUDIO TO OUTPUTS
> outs asig, asig
> ga1 = asig
> ga2 = asig
> fout "test.wav", 4, ga1, ga2
> endin
> </CsInstruments>
> <CsScore>
> f1 0 1024 10 1 0 .25 0 .17
> i1 0 600 ;let dummy instrument run so performance doesn't end
> </CsScore>
> </CsoundSynthesizer>
>
>
> 2009/4/5 joachim heintz <jh@joachimheintz.de>:
> > If you use QuteCsound as frontend, you can simply push the Record button for
> > this.
> > Best -
> >        joachim
> >
> >
> > Am 05.04.2009 um 00:07 schrieb Stefan Thomas:
> >
> >> Dear community,
> >> I have succesfully made my first few patches and I can play it live
> >> via midi, using  "-odevaudio -M1 -b400" as csounds options.
> >> Now I would like to record what I'm playinf directly to a wave file,
> >> but I don't know how to do it.
> >> Maybee I should mention, that I'm using a linux machine, with kubuntu
> >> studio.
> >> Thanks for Your support
> >> Stefan
> >>
> >>
> >> Send bugs reports to this list.
> >> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> >> csound"
> >
> >
> >
> > Send bugs reports to this list.
> > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> > csound"
> >
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Rediscover Hotmail®: Get e-mail storage that grows with you. Check it out.

Date2009-04-05 11:25
Fromvictor
Subject[Csnd] Re: Re: Re: making a wav file from live midi input
The best thing is to put fout in a different instrument and route audio to 
it:




-odevaudio -M1 -b400


sr = 44100
kr = 4410
ksmps = 10
nchnls = 2
ga1 init 0
ga2 init 0

instr 1
;READ RT-MIDI NOTE NUMBERS, CONVERT TO CPS
icps    cpsmidi
;READ RT-MIDI VELOCITY, CONVERT TO AMP VALUES WITHIN THE RANGE 0-10000
iamp    ampmidi    10000
;CREATE A SINE TONE
asig    oscili    iamp, icps, 1
;SEND AUDIO TO OUTPUTS
outs    asig, asig
ga1 = asig + ga1
ga2 = asig + ga1
endin

instr 100
fout    "test.wav", 4, ga1, ga2
ga1 = 0
ga2 = 0
endin



f1 0 1024 10 1 0 .25 0 .17
i100 0 600  ;run rec instr for the length of performance



----- Original Message ----- 
From: "Stefan Thomas" 
To: 
Sent: Sunday, April 05, 2009 10:37 AM
Subject: [Csnd] Re: Re: making a wav file from live midi input


Dear all,
thanks for Your fast answers. I have been able to play live while
making a wav-file at the same time, but the quality of the wav-file is
terrible. I don't know where I could change this.
Here is the code:


-odevaudio -M1 -b400


sr = 44100
kr = 4410
ksmps = 10
nchnls = 2

instr 1
;READ RT-MIDI NOTE NUMBERS, CONVERT TO CPS
icps    cpsmidi
;READ RT-MIDI VELOCITY, CONVERT TO AMP VALUES WITHIN THE RANGE 0-10000
iamp    ampmidi    10000
;CREATE A SINE TONE
asig    oscili    iamp, icps, 1
;SEND AUDIO TO OUTPUTS
outs    asig, asig
ga1 = asig
ga2 = asig
fout    "test.wav", 4, ga1, ga2
endin


f1 0 1024 10 1 0 .25 0 .17
i1 0 600  ;let dummy instrument run so performance doesn't end




2009/4/5 joachim heintz :
> If you use QuteCsound as frontend, you can simply push the Record button 
> for
> this.
> Best -
> joachim
>
>
> Am 05.04.2009 um 00:07 schrieb Stefan Thomas:
>
>> Dear community,
>> I have succesfully made my first few patches and I can play it live
>> via midi, using "-odevaudio -M1 -b400" as csounds options.
>> Now I would like to record what I'm playinf directly to a wave file,
>> but I don't know how to do it.
>> Maybee I should mention, that I'm using a linux machine, with kubuntu
>> studio.
>> Thanks for Your support
>> Stefan
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"
>


Send bugs reports to this list.
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe 
csound"= 


Date2009-04-05 19:30
FromDiego Saá
Subject[Csnd] RE: Re: Re: Re: making a wav file from live midi input
Hello Victor,

For some reason, I'm getting the following error with this code: 

INIT ERROR in instr 100: error opening sound file 'test.wav'

fout "test.wav" 4 ga1 ga2

B 0.000 - note deleted. i100 had 1 init errors


I'm using qutecsound on my imac.
Any ideas?

Best regards,
Diego Saa

> From: Victor.Lazzarini@nuim.ie
> To: csound@lists.bath.ac.uk
> Date: Sun, 5 Apr 2009 11:25:57 +0100
> Subject: [Csnd] Re: Re: Re: making a wav file from live midi input
>
> The best thing is to put fout in a different instrument and route audio to
> it:
>
>
> <CsoundSynthesizer>
> <CsOptions>
> -odevaudio -M1 -b400
> </CsOptions>
> <CsInstruments>
> sr = 44100
> kr = 4410
> ksmps = 10
> nchnls = 2
> ga1 init 0
> ga2 init 0
>
> instr 1
> ;READ RT-MIDI NOTE NUMBERS, CONVERT TO CPS
> icps cpsmidi
> ;READ RT-MIDI VELOCITY, CONVERT TO AMP VALUES WITHIN THE RANGE 0-10000
> iamp ampmidi 10000
> ;CREATE A SINE TONE
> asig oscili iamp, icps, 1
> ;SEND AUDIO TO OUTPUTS
> outs asig, asig
> ga1 = asig + ga1
> ga2 = asig + ga1
> endin
>
> instr 100
> fout "test.wav", 4, ga1, ga2
> ga1 = 0
> ga2 = 0
> endin
>
> </CsInstruments>
> <CsScore>
> f1 0 1024 10 1 0 .25 0 .17
> i100 0 600 ;run rec instr for the length of performance
>
> </CsScore>
> </CsoundSynthesizer>
> ----- Original Message -----
> From: "Stefan Thomas" <kontrapunktstefan@googlemail.com>
> To: <csound@lists.bath.ac.uk>
> Sent: Sunday, April 05, 2009 10:37 AM
> Subject: [Csnd] Re: Re: making a wav file from live midi input
>
>
> Dear all,
> thanks for Your fast answers. I have been able to play live while
> making a wav-file at the same time, but the quality of the wav-file is
> terrible. I don't know where I could change this.
> Here is the code:
> <CsoundSynthesizer>
> <CsOptions>
> -odevaudio -M1 -b400
> </CsOptions>
> <CsInstruments>
> sr = 44100
> kr = 4410
> ksmps = 10
> nchnls = 2
>
> instr 1
> ;READ RT-MIDI NOTE NUMBERS, CONVERT TO CPS
> icps cpsmidi
> ;READ RT-MIDI VELOCITY, CONVERT TO AMP VALUES WITHIN THE RANGE 0-10000
> iamp ampmidi 10000
> ;CREATE A SINE TONE
> asig oscili iamp, icps, 1
> ;SEND AUDIO TO OUTPUTS
> outs asig, asig
> ga1 = asig
> ga2 = asig
> fout "test.wav", 4, ga1, ga2
> endin
> </CsInstruments>
> <CsScore>
> f1 0 1024 10 1 0 .25 0 .17
> i1 0 600 ;let dummy instrument run so performance doesn't end
> </CsScore>
> </CsoundSynthesizer>
>
>
> 2009/4/5 joachim heintz <jh@joachimheintz.de>:
>> If you use QuteCsound as frontend, you can simply push the Record button
>> for
>> this.
>> Best -
>> joachim
>>
>>
>> Am 05.04.2009 um 00:07 schrieb Stefan Thomas:
>>
>>> Dear community,
>>> I have succesfully made my first few patches and I can play it live
>>> via midi, using "-odevaudio -M1 -b400" as csounds options.
>>> Now I would like to record what I'm playinf directly to a wave file,
>>> but I don't know how to do it.
>>> Maybee I should mention, that I'm using a linux machine, with kubuntu
>>> studio.
>>> Thanks for Your support
>>> Stefan
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> csound"
>>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
> csound"=
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"


Posteingang immer voll? Der erste Speicher, der mitwächst: Unbegrenzter Speicher bei Windows Live Hotmail!

Date2009-04-05 19:59
FromOeyvind Brandtsegg
Subject[Csnd] Re: RE: Re: Re: Re: making a wav file from live midi input
This could happen if you don't have write permission to the file (or
directory where the files should be placed).
Try setting the sound file output directory (SFDIR if I remember
correctly) to a location wher you are sure you have permission to put
new files.
It could also happen if the sound file is open in another application,
and this application have write protected the file temporary to
prevent it changing while it is under this application's control.
Oeyvind

2009/4/5 Diego Saá :
> Hello Victor,
> For some reason, I'm getting the following error with this code:
>
> INIT ERROR in instr 100: error opening sound file 'test.wav'
>
> fout "test.wav" 4 ga1 ga2
>
> B 0.000 - note deleted. i100 had 1 init errors
>
> I'm using qutecsound on my imac.
> Any ideas?
> Best regards,
> Diego Saa
>> From: Victor.Lazzarini@nuim.ie
>> To: csound@lists.bath.ac.uk
>> Date: Sun, 5 Apr 2009 11:25:57 +0100
>> Subject: [Csnd] Re: Re: Re: making a wav file from live midi input
>>
>> The best thing is to put fout in a different instrument and route audio to
>> it:
>>
>>
>> 
>> 
>> -odevaudio -M1 -b400
>> 
>> 
>> sr = 44100
>> kr = 4410
>> ksmps = 10
>> nchnls = 2
>> ga1 init 0
>> ga2 init 0
>>
>> instr 1
>> ;READ RT-MIDI NOTE NUMBERS, CONVERT TO CPS
>> icps cpsmidi
>> ;READ RT-MIDI VELOCITY, CONVERT TO AMP VALUES WITHIN THE RANGE 0-10000
>> iamp ampmidi 10000
>> ;CREATE A SINE TONE
>> asig oscili iamp, icps, 1
>> ;SEND AUDIO TO OUTPUTS
>> outs asig, asig
>> ga1 = asig + ga1
>> ga2 = asig + ga1
>> endin
>>
>> instr 100
>> fout "test.wav", 4, ga1, ga2
>> ga1 = 0
>> ga2 = 0
>> endin
>>
>> 
>> 
>> f1 0 1024 10 1 0 .25 0 .17
>> i100 0 600 ;run rec instr for the length of performance
>>
>> 
>> 
>> ----- Original Message -----
>> From: "Stefan Thomas" 
>> To: 
>> Sent: Sunday, April 05, 2009 10:37 AM
>> Subject: [Csnd] Re: Re: making a wav file from live midi input
>>
>>
>> Dear all,
>> thanks for Your fast answers. I have been able to play live while
>> making a wav-file at the same time, but the quality of the wav-file is
>> terrible. I don't know where I could change this.
>> Here is the code:
>> 
>> 
>> -odevaudio -M1 -b400
>> 
>> 
>> sr = 44100
>> kr = 4410
>> ksmps = 10
>> nchnls = 2
>>
>> instr 1
>> ;READ RT-MIDI NOTE NUMBERS, CONVERT TO CPS
>> icps cpsmidi
>> ;READ RT-MIDI VELOCITY, CONVERT TO AMP VALUES WITHIN THE RANGE 0-10000
>> iamp ampmidi 10000
>> ;CREATE A SINE TONE
>> asig oscili iamp, icps, 1
>> ;SEND AUDIO TO OUTPUTS
>> outs asig, asig
>> ga1 = asig
>> ga2 = asig
>> fout "test.wav", 4, ga1, ga2
>> endin
>> 
>> 
>> f1 0 1024 10 1 0 .25 0 .17
>> i1 0 600 ;let dummy instrument run so performance doesn't end
>> 
>> 
>>
>>
>> 2009/4/5 joachim heintz :
>>> If you use QuteCsound as frontend, you can simply push the Record button
>>> for
>>> this.
>>> Best -
>>> joachim
>>>
>>>
>>> Am 05.04.2009 um 00:07 schrieb Stefan Thomas:
>>>
>>>> Dear community,
>>>> I have succesfully made my first few patches and I can play it live
>>>> via midi, using "-odevaudio -M1 -b400" as csounds options.
>>>> Now I would like to record what I'm playinf directly to a wave file,
>>>> but I don't know how to do it.
>>>> Maybee I should mention, that I'm using a linux machine, with kubuntu
>>>> studio.
>>>> Thanks for Your support
>>>> Stefan
>>>>
>>>>
>>>> Send bugs reports to this list.
>>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>>> csound"
>>>
>>>
>>>
>>> Send bugs reports to this list.
>>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>>> csound"
>>>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"=
>>
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>
> ________________________________
> Posteingang immer voll? Der erste Speicher, der mitwächst: Unbegrenzter
> Speicher bei Windows Live Hotmail!


Date2009-04-05 22:21
FromStefan Thomas
Subject[Csnd] Re: RE: Re: Re: making a wav file from live midi input
Dear Iain,
thanks very much, I was able to do what I wanted!

2009/4/5 Iain McCurdy :
> Hi Stefan,
>
> There are a few thing to change in your example.
> You should place the fout (sound file recording) line in an separate always
> on instrument. This will then record the entire performance including
> overlapping notes correctly.
> You only need to use global variables (one beginning with 'g') when you want
> to use the same variable across two or more instruments. Non-global
> variables only have scope within the instrument within which they have been
> created. Non-global variables with the same name in different instruments
> are different variables probably with different values.
> In the amended version of your code (below) a global variable is used to
> accumulate the audio from all instr 1 instances, thereby allowing
> overlapping notes/polyphony to be recorded.
> A single instance of instr 2, the file recording instrument, runs for the
> entire duration of our realtime performance. Do not run more that one
> instance of the same fout line! I think this was what was messing up the
> signal quality of your original code - every time a new note was played a
> new instance of the same fout line would be created.
> Our global variable needs to be initialised just (just after the header
> block) as will be needed in instr 2 before we have had a chance to play any
> notes on the keyboard and therefore give it a different value in instr 1.
> It needs to be cleared (set to zero) when we are finished with it at the end
> of instr 2 because of the accumulation thing that we are doing in instr 1.
> If you forget to do this you will very quickly end up with an unpleasant
> sound in your sound file recording (try it!).
>
> Hope this helps,
> Iain
>
> 
> 
> -odevaudio -M1 -b400
> 
> 
> sr = 44100
> kr = 4410
> ksmps = 10
> nchnls = 2
>
> ;SET INITIAL VALUE FOR gasend (SILENCE)
> gasend init 0
>
> instr 1 ;OSCILLATOR INSTRUMENT
> ;READ RT-MIDI NOTE NUMBERS, CONVERT TO CPS
> icps    cpsmidi
> ;READ RT-MIDI VELOCITY, CONVERT TO AMP VALUES WITHIN THE RANGE 0-10000
> iamp    ampmidi    10000
> ;CREATE A HARMONIC TONE
> asig    oscili    iamp, icps, 1
> ;SEND AUDIO TO OUTPUTS
> outs    asig, asig
> ;ACCUMULATE ALL NOTES TO THE GLOBAL VARIABLE gasend
> ;THIS WILL PERMIT OVERLAPPING NOTES
> gasend = gasend + asig
> endin
>
> instr 2 ;RECORDS ALL SOUND
> ;RECORD A MONO 16 BIT SOUND FILE
> fout    "test.wav", 4, gasend
> ;CLEAR GLOBAL VARIABLE (I.E. ASSIGN IT TO ZERO)
> gasend = 0
> endin
>
>
>
>
>
>
>
>
> 
> 
> ;FUNCTION TABLE OF A HARMONIC TIMBRE
> f1 0 1024 10 1 0 .25 0 .17
> i2 0 600  ;RECORDING INSTRUMENT RUNS CONTINUOUSLY
> 
> 
>
>> Date: Sun, 5 Apr 2009 11:37:07 +0200
>> From: kontrapunktstefan@googlemail.com
>> To: csound@lists.bath.ac.uk
>> Subject: [Csnd] Re: Re: making a wav file from live midi input
>>
>> Dear all,
>> thanks for Your fast answers. I have been able to play live while
>> making a wav-file at the same time, but the quality of the wav-file is
>> terrible. I don't know where I could change this.
>> Here is the code:
>> 
>> 
>> -odevaudio -M1 -b400
>> 
>> 
>> sr = 44100
>> kr = 4410
>> ksmps = 10
>> nchnls = 2
>>
>> instr 1
>> ;READ RT-MIDI NOTE NUMBERS, CONVERT TO CPS
>> icps cpsmidi
>> ;READ RT-MIDI VELOCITY, CONVERT TO AMP VALUES WITHIN THE RANGE 0-10000
>> iamp ampmidi 10000
>> ;CREATE A SINE TONE
>> asig oscili iamp, icps, 1
>> ;SEND AUDIO TO OUTPUTS
>> outs asig, asig
>> ga1 = asig
>> ga2 = asig
>> fout "test.wav", 4, ga1, ga2
>> endin
>> 
>> 
>> f1 0 1024 10 1 0 .25 0 .17
>> i1 0 600 ;let dummy instrument run so performance doesn't end
>> 
>> 
>>
>>
>> 2009/4/5 joachim heintz :
>> > If you use QuteCsound as frontend, you can simply push the Record button
>> > for
>> > this.
>> > Best -
>> >        joachim
>> >
>> >
>> > Am 05.04.2009 um 00:07 schrieb Stefan Thomas:
>> >
>> >> Dear community,
>> >> I have succesfully made my first few patches and I can play it live
>> >> via midi, using  "-odevaudio -M1 -b400" as csounds options.
>> >> Now I would like to record what I'm playinf directly to a wave file,
>> >> but I don't know how to do it.
>> >> Maybee I should mention, that I'm using a linux machine, with kubuntu
>> >> studio.
>> >> Thanks for Your support
>> >> Stefan
>> >>
>> >>
>> >> Send bugs reports to this list.
>> >> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>> >> "unsubscribe
>> >> csound"
>> >
>> >
>> >
>> > Send bugs reports to this list.
>> > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> > csound"
>> >
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>
> ________________________________
> Rediscover Hotmail®: Get e-mail storage that grows with you. Check it out.


Date2009-04-05 22:41
FromStefan Thomas
Subject[Csnd] Re: RE: Re: Re: making a wav file from live midi input
Sorry,
one last question: how can I record a stereo-file with fout?

2009/4/5 Iain McCurdy :
> Hi Stefan,
>
> There are a few thing to change in your example.
> You should place the fout (sound file recording) line in an separate always
> on instrument. This will then record the entire performance including
> overlapping notes correctly.
> You only need to use global variables (one beginning with 'g') when you want
> to use the same variable across two or more instruments. Non-global
> variables only have scope within the instrument within which they have been
> created. Non-global variables with the same name in different instruments
> are different variables probably with different values.
> In the amended version of your code (below) a global variable is used to
> accumulate the audio from all instr 1 instances, thereby allowing
> overlapping notes/polyphony to be recorded.
> A single instance of instr 2, the file recording instrument, runs for the
> entire duration of our realtime performance. Do not run more that one
> instance of the same fout line! I think this was what was messing up the
> signal quality of your original code - every time a new note was played a
> new instance of the same fout line would be created.
> Our global variable needs to be initialised just (just after the header
> block) as will be needed in instr 2 before we have had a chance to play any
> notes on the keyboard and therefore give it a different value in instr 1.
> It needs to be cleared (set to zero) when we are finished with it at the end
> of instr 2 because of the accumulation thing that we are doing in instr 1.
> If you forget to do this you will very quickly end up with an unpleasant
> sound in your sound file recording (try it!).
>
> Hope this helps,
> Iain
>
> 
> 
> -odevaudio -M1 -b400
> 
> 
> sr = 44100
> kr = 4410
> ksmps = 10
> nchnls = 2
>
> ;SET INITIAL VALUE FOR gasend (SILENCE)
> gasend init 0
>
> instr 1 ;OSCILLATOR INSTRUMENT
> ;READ RT-MIDI NOTE NUMBERS, CONVERT TO CPS
> icps    cpsmidi
> ;READ RT-MIDI VELOCITY, CONVERT TO AMP VALUES WITHIN THE RANGE 0-10000
> iamp    ampmidi    10000
> ;CREATE A HARMONIC TONE
> asig    oscili    iamp, icps, 1
> ;SEND AUDIO TO OUTPUTS
> outs    asig, asig
> ;ACCUMULATE ALL NOTES TO THE GLOBAL VARIABLE gasend
> ;THIS WILL PERMIT OVERLAPPING NOTES
> gasend = gasend + asig
> endin
>
> instr 2 ;RECORDS ALL SOUND
> ;RECORD A MONO 16 BIT SOUND FILE
> fout    "test.wav", 4, gasend
> ;CLEAR GLOBAL VARIABLE (I.E. ASSIGN IT TO ZERO)
> gasend = 0
> endin
>
>
>
>
>
>
>
>
> 
> 
> ;FUNCTION TABLE OF A HARMONIC TIMBRE
> f1 0 1024 10 1 0 .25 0 .17
> i2 0 600  ;RECORDING INSTRUMENT RUNS CONTINUOUSLY
> 
> 
>
>> Date: Sun, 5 Apr 2009 11:37:07 +0200
>> From: kontrapunktstefan@googlemail.com
>> To: csound@lists.bath.ac.uk
>> Subject: [Csnd] Re: Re: making a wav file from live midi input
>>
>> Dear all,
>> thanks for Your fast answers. I have been able to play live while
>> making a wav-file at the same time, but the quality of the wav-file is
>> terrible. I don't know where I could change this.
>> Here is the code:
>> 
>> 
>> -odevaudio -M1 -b400
>> 
>> 
>> sr = 44100
>> kr = 4410
>> ksmps = 10
>> nchnls = 2
>>
>> instr 1
>> ;READ RT-MIDI NOTE NUMBERS, CONVERT TO CPS
>> icps cpsmidi
>> ;READ RT-MIDI VELOCITY, CONVERT TO AMP VALUES WITHIN THE RANGE 0-10000
>> iamp ampmidi 10000
>> ;CREATE A SINE TONE
>> asig oscili iamp, icps, 1
>> ;SEND AUDIO TO OUTPUTS
>> outs asig, asig
>> ga1 = asig
>> ga2 = asig
>> fout "test.wav", 4, ga1, ga2
>> endin
>> 
>> 
>> f1 0 1024 10 1 0 .25 0 .17
>> i1 0 600 ;let dummy instrument run so performance doesn't end
>> 
>> 
>>
>>
>> 2009/4/5 joachim heintz :
>> > If you use QuteCsound as frontend, you can simply push the Record button
>> > for
>> > this.
>> > Best -
>> >        joachim
>> >
>> >
>> > Am 05.04.2009 um 00:07 schrieb Stefan Thomas:
>> >
>> >> Dear community,
>> >> I have succesfully made my first few patches and I can play it live
>> >> via midi, using  "-odevaudio -M1 -b400" as csounds options.
>> >> Now I would like to record what I'm playinf directly to a wave file,
>> >> but I don't know how to do it.
>> >> Maybee I should mention, that I'm using a linux machine, with kubuntu
>> >> studio.
>> >> Thanks for Your support
>> >> Stefan
>> >>
>> >>
>> >> Send bugs reports to this list.
>> >> To unsubscribe, send email sympa@lists.bath.ac.uk with body
>> >> "unsubscribe
>> >> csound"
>> >
>> >
>> >
>> > Send bugs reports to this list.
>> > To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> > csound"
>> >
>>
>>
>> Send bugs reports to this list.
>> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe
>> csound"
>
> ________________________________
> Rediscover Hotmail®: Get e-mail storage that grows with you. Check it out.