Csound Csound-dev Csound-tekno Search About

[Cs-dev] filevalid

Date2011-01-22 12:52
Fromnabob_cd@yahoo.com
Subject[Cs-dev] filevalid
Hi,

I am pretty busy making good and simple examples for the manual:
the filevalid opcode has an example that i would like to replace. The manual page and the example is made by you, it's pretty new and so i like to contact you personally before replacing the example by mine just like that.

The present example is this:



; Select audio/midi flags here according to platform
; Audio out   Audio in
-odac           -iadc    ;;;RT audio I/O
; For Non-realtime ouput leave only the line below:
; -o filelen.wav -W ;;; for file output any platform



; Initialize the global variables.
sr = 44100
kr = 4410
ksmps = 10
nchnls = 1

; Instrument #1.
instr 1
  ; Check that the audio file "mary.wav" is avalable
  ivld  filevalid "mary.wav"
  print ivld
endin





; Play Instrument #1 for 0.1 second.
i 1 0 0.1
e





It works, but i thought it would make even more sense if there was an example that says: check if the audio file exists and if it does not, produce no sound and continue as if nothing has happened to the next note, perhaps producing silence for the duration of that note. 
What happens now is that Csound just quits, something for which i would like to choose the exitnow opcode.
This is my example, but when filevalid produces a 0 because the file was not found, Csound quits too.
Do you see a way to get it to work or perhaps is it better to request for such a feature for filevalid "officialy" on the Csound forum?

greetings
Menno

 My example:



; Select audio/midi flags here according to platform
-odac     ;;;realtime audio out
;-iadc    ;;;uncomment -iadc if realtime audio input is needed too
; For Non-realtime ouput leave only the line below:
;-o filevalid.wav -W ;;; for file output any platform



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

instr 1
Sfile     strget    p4
ivld      filevalid Sfile

if ivld>0 then
asig      diskin2   Sfile, 1
          outs      asig, asig
else
          printf_i  "Audiofile '%s' does not exist!\n", 1, Sfile
endif
endin




i 1 0 3 "frox.wav";file does not exist!!!
i 1 + 3 "fox.wav";but this one certainly does...

e



------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net

Date2011-01-22 14:40
Frommenno
SubjectRe: [Cs-dev] filevalid
this is not cool, i was quite sure to have sent this email to the person who
conserns this only and not for everyone to see.
I am sorry this happend, i apologize...

ah, and now i see my mistake...grrrr

menno
-- 
View this message in context: http://csound.1045644.n5.nabble.com/filevalid-tp3352791p3352860.html
Sent from the Csound - Dev mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires 
February 28th, so secure your free ArcSight Logger TODAY! 
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Csound-devel mailing list
Csound-devel@lists.sourceforge.net