Csound Csound-dev Csound-tekno Search About

[Csnd] midi recorder

Date2011-12-25 01:08
Fromzappfinger
Subject[Csnd] midi recorder
I am trying to create a midi recorder using the fluid opcodes and some
tables.
I do not hear anything when the playback starts. Is it because I trigger the
midi note from a higher instrument than the midi instrument?

here's the score:



; Select audio/midi flags here according to platform
;-+rtmidi=virtual    ;;;realtime audio out and realtime midi in
-odac -iadc --midi-device=0 -M0 -m0d -B256 -b64
;-F ./midis/%s



sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

giStat      ftgen     0, 0, -60*kr, 2, 0; size for 60 seconds of recording
status
giChan      ftgen     0, 0, -60*kr, 2, 0; size for 60 seconds of recording
channel
giDat1      ftgen     0, 0, -60*kr, 2, 0; size for 60 seconds of recording
data1
giDat2      ftgen     0, 0, -60*kr, 2, 0; size for 60 seconds of recording
data2

massign 0, 1
;massign 2, 2
;massign 10,10

; piano
giengine1 fluidEngine
isfnum1	 fluidLoad "./samples/acoustic_piano_imis_1.sf2", giengine1, 1
	 fluidProgramSelect giengine1, 1, isfnum1, 0, 0

; bass
giengine2 fluidEngine
isfnum2	 fluidLoad "./samples/003.3mg GS Roland Sound Set 16 bit Bank.SF2",
giengine2, 1
	 fluidProgramSelect giengine2, 2, isfnum2, 0, 33  ; Fingered bass

; drums
giengine10 fluidEngine
isfnum1	 fluidLoad "./samples/003.3mg GS Roland Sound Set 16 bit Bank.SF2",
giengine10, 1
	 fluidProgramSelect giengine10, 10, isfnum1, 128, 32

instr 1

	mididefault   60, p3
	midinoteonkey p4, p5
ikey	init p4
ivel	init p5
	fluidNote giengine1, 1, ikey, ivel
endin

instr 2 ; bass

	mididefault   60, p3
	midinoteonkey p5, p4
ikey	init p5
ivel	init p4
	fluidNote giengine2, 2, ikey, ivel
endin

instr 10  ; drums

	mididefault   60, p3
	midinoteonkey p5, p4
ikey	init p5
ivel	init p4
	fluidNote giengine10, 10, ikey, ivel
endin

instr 100 ; only play back
imvol  init 7
asigl, asigr fluidOut giengine1
       outs asigl*imvol, asigr*imvol
endin

instr 101
imvol  init 7
asigl, asigr fluidOut giengine1
       outs asigl*imvol, asigr*imvol
       
kstatus, kchan, kdata1, kdata2 midiin
printks "status = %d chan = %d data1=%d data2=%d \n", 0.1, kstatus, kchan,
kdata1, kdata2
prints    "RECORDING!%n"
;create a writing pointer in the table,
;moving in 60 seconds from index 0 to the end
kindx     linseg    0, 60, ftlen(giStat)
;write the k-signal
    	tablew    kstatus, kindx, giStat
    	tablew    kchan, kindx, giChan
    	tablew    kdata1, kindx, giDat1
    	tablew    kdata2, kindx, giDat2
endin

instr 102
imvol init 4
asigl, asigr fluidOut giengine2		 ;add a stereo flanger
adelL linseg 0, p3*.5, 0.02, p3*.5, 0	 ;max delay time =20ms
adelR linseg 0.02, p3*.5, 0, p3*.5, 0.02 ;max delay time =20ms		
asigL flanger asigl, adelL, .6
asigR flanger asigr, adelR, .6
      outs asigL*imvol, asigR*imvol
endin

instr 110
imvol  init 7
asigl, asigr fluidOut giengine10
       outs asigl*imvol, asigr*imvol
endin

instr 99
prints    "PLAYING!%n"
;create a reading pointer in the table,
;moving in 60 seconds from index 0 to the end
kindx     linseg    0, 60, ftlen(giStat)
;read the k-signal
kstatus     table     kindx, giStat
kchan     table     kindx, giChan
kdata1     table     kindx, giDat1
kdata2     table     kindx, giDat2
printks "status = %d chan = %d data1=%d data2=%d \n", 0.1, kstatus, kchan,
kdata1, kdata2
if kstatus != 0 then
	;midiout kstatus, kchan, kdata1, kdata2
	fluidNote giengine1, 1, i(kdata1), i(kdata2)
endif
endin



i 101 0 60      ; record 
i 102 0 60
i 99  62 60     ; play back data
i 100 62 60
e

 

--
View this message in context: http://csound.1045644.n5.nabble.com/midi-recorder-tp5099814p5099814.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-12-25 10:15
Fromzappfinger
Subject[Csnd] Re: midi recorder
I changed it a bit.
The strange thing is, that the midiout to an external synth works, but
somehow the line

	fluidNote giengine1, 1, i(kdata1), i(kdata2)

in instr 99 does nothing???

Richard




; Select audio/midi flags here according to platform
;-+rtmidi=virtual    ;;;realtime audio out and realtime midi in
-odac -iadc --midi-device=0 -M0 -Q0 -m0d -B256 -b64
;-F ./midis/%s



sr = 44100
ksmps = 32
nchnls = 2
0dbfs = 1

giStat      ftgen     0, 0, -60*kr, 2, 0; size for 60 seconds of recording
status
giChan      ftgen     0, 0, -60*kr, 2, 0; size for 60 seconds of recording
channel
giDat1      ftgen     0, 0, -60*kr, 2, 0; size for 60 seconds of recording
data1
giDat2      ftgen     0, 0, -60*kr, 2, 0; size for 60 seconds of recording
data2

massign 0, 1
;massign 2, 2
;massign 10,10

; piano
giengine1 fluidEngine
isfnum1	 fluidLoad "./samples/acoustic_piano_imis_1.sf2", giengine1, 1
	 fluidProgramSelect giengine1, 1, isfnum1, 0, 0

; bass
giengine2 fluidEngine
isfnum2	 fluidLoad "./samples/003.3mg GS Roland Sound Set 16 bit Bank.SF2",
giengine2, 1
	 fluidProgramSelect giengine2, 2, isfnum2, 0, 33  ; Fingered bass

; drums
giengine10 fluidEngine
isfnum1	 fluidLoad "./samples/003.3mg GS Roland Sound Set 16 bit Bank.SF2",
giengine10, 1
	 fluidProgramSelect giengine10, 10, isfnum1, 128, 32

instr 1

	mididefault   60, p3
	midinoteonkey p5, p4
ikey	init p5
ivel	init p4
	fluidNote giengine1, 1, ikey, ivel
endin

instr 2 ; bass

	mididefault   60, p3
	midinoteonkey p5, p4
ikey	init p5
ivel	init p4
	fluidNote giengine2, 2, ikey, ivel
endin

instr 10  ; drums

	mididefault   60, p3
	midinoteonkey p5, p4
ikey	init p5
ivel	init p4
	fluidNote giengine10, 10, ikey, ivel
endin

instr 99
prints    "PLAYING!%n"
kindx     linseg    0, 60, ftlen(giStat)
;read the k-signal
kstatus    table     kindx, giStat
kchan      table     kindx, giChan
kdata1     table     kindx, giDat1
kdata2     table     kindx, giDat2
if kstatus != 0 then
	printks "status = %d chan = %d data1=%d data2=%d \n", 0.1, kstatus, kchan,
kdata1, kdata2
	midiout kstatus, kchan, kdata1, kdata2
	fluidNote giengine1, 1, i(kdata1), i(kdata2)
endif
endin

instr 100 ; only play back
imvol  init 7
asigl, asigr fluidOut giengine1
       outs asigl*imvol, asigr*imvol
endin

instr 101
imvol  init 7
asigl, asigr fluidOut giengine1
       outs asigl*imvol, asigr*imvol
       
kstatus, kchan, kdata1, kdata2 midiin
if kstatus != 0 then
	printks "status = %d chan = %d data1=%d data2=%d \n", 0.1, kstatus, kchan,
kdata1, kdata2
endif
prints    "RECORDING!%n"
kindx     linseg    0, 60, ftlen(giStat)
;write the k-signal
    	tablew    kstatus, kindx, giStat
    	tablew    kchan, kindx, giChan
    	tablew    kdata1, kindx, giDat1
    	tablew    kdata2, kindx, giDat2
endin

instr 102
imvol init 4
asigl, asigr fluidOut giengine2		 ;add a stereo flanger
adelL linseg 0, p3*.5, 0.02, p3*.5, 0	 ;max delay time =20ms
adelR linseg 0.02, p3*.5, 0, p3*.5, 0.02 ;max delay time =20ms		
asigL flanger asigl, adelL, .6
asigR flanger asigr, adelR, .6
      outs asigL*imvol, asigR*imvol
endin

instr 110
imvol  init 7
asigl, asigr fluidOut giengine10
       outs asigl*imvol, asigr*imvol
endin




i 101 0 60      ; record 
i 102 0 60
i 99  62 60     ; play back data
i 100 62 60
e

  

--
View this message in context: http://csound.1045644.n5.nabble.com/midi-recorder-tp5099814p5100075.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-12-25 11:40
FromTito Latini
SubjectRe: [Csnd] Re: midi recorder
AttachmentsNone  

Date2011-12-25 11:50
Fromzappfinger
Subject[Csnd] Re: midi recorder
Hi Tito,

I tried your suggestion, still no sound...

regards,
Richard

--
View this message in context: http://csound.1045644.n5.nabble.com/midi-recorder-tp5099814p5100149.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-12-25 11:56
FromTito Latini
SubjectRe: [Csnd] Re: midi recorder
AttachmentsNone  

Date2011-12-25 12:01
Fromzappfinger
Subject[Csnd] Re: midi recorder
Weird...

--
View this message in context: http://csound.1045644.n5.nabble.com/midi-recorder-tp5099814p5100156.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-12-25 12:17
FromTito Latini
SubjectRe: [Csnd] Re: midi recorder
AttachmentsNone  

Date2011-12-25 12:31
Fromzappfinger
Subject[Csnd] Re: midi recorder
No, I have Csound version 5.13 (float samples) Jan 17 2011
I could try to upgrade.
But the if gets executed, unless the bug implies that it only executes the
first line in the if block, then it would make sense.

--
View this message in context: http://csound.1045644.n5.nabble.com/midi-recorder-tp5099814p5100182.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-12-25 12:49
FromTito Latini
SubjectRe: [Csnd] Re: midi recorder
AttachmentsNone  

Date2011-12-25 14:30
Fromzappfinger
Subject[Csnd] Re: midi recorder
oops, upgrading made things worse.
I got the following error:


    import csnd
  File
"/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/csnd.py",
line 7, in 
    import _csnd
ImportError:
dlopen(/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/_csnd.so,
2): Library not loaded:
/Library/Frameworks/CsoundLib64.framework/Versions/5.2/CsoundLib64
  Referenced from:
/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/_csnd.so
  Reason: no suitable image found.  Did find:
	/Library/Frameworks/CsoundLib64.framework/Versions/5.2/CsoundLib64: unknown
required load command 0x80000022
	/Library/Frameworks/CsoundLib64.framework/Versions/5.2/CsoundLib64: unknown
required load command 0x80000022


--
View this message in context: http://csound.1045644.n5.nabble.com/midi-recorder-tp5099814p5100258.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-12-25 14:41
Fromzappfinger
Subject[Csnd] Re: midi recorder
Ok, I went back to version 5.14 (still one version higher than my previous),
since I am on OS X 10.5.8. This did the trick! It works...

--
View this message in context: http://csound.1045644.n5.nabble.com/midi-recorder-tp5099814p5100271.html
Sent from the Csound - General mailing list archive at Nabble.com.


Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"

Date2011-12-25 15:05
FromVictor Lazzarini
SubjectRe: [Csnd] Re: midi recorder
yes, 5.14 is the last 10.5 release. I am afraid we don't have a 10.5 machine to build on anymore.

Victor
On 25 Dec 2011, at 14:41, zappfinger wrote:

> Ok, I went back to version 5.14 (still one version higher than my previous),
> since I am on OS X 10.5.8. This did the trick! It works...
> 
> --
> View this message in context: http://csound.1045644.n5.nabble.com/midi-recorder-tp5099814p5100271.html
> Sent from the Csound - General mailing list archive at Nabble.com.
> 
> 
> Send bugs reports to the Sourceforge bug tracker
>            https://sourceforge.net/tracker/?group_id=81968&atid=564599
> Discussions of bugs and features can be posted here
> To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
> 

Dr Victor Lazzarini
Senior Lecturer
Dept. of Music
NUI Maynooth Ireland
tel.: +353 1 708 3545
Victor dot Lazzarini AT nuim dot ie





Send bugs reports to the Sourceforge bug tracker
            https://sourceforge.net/tracker/?group_id=81968&atid=564599
Discussions of bugs and features can be posted here
To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"