| you can try my "soundinmac" opcode: (if you are using an older OS it may not work -- let me know and i can send you a different version that should work)
Begin forwarded message: Date: July 25, 2010 5:06:52 PM PDT
Subject: soundinmac FINAL
OK - here is the final release for the mac-only "soundinmac" opcode plugin: ar1[, ar2[, ar3[, ... a24]]] soundinmac ifilcod [, kpitch] [, iskptim] [, iwrap] http://sonomatics.com/soundinmac.zipthe package includes a .html documentation. this version includes k-rate pitch shifting -- btw, there is noticeably less aliasing than diskin2's (sinc mode)!!! looping seems goes out of phase fairly quickly when running side-by-side with soundin/diskin could be my code or apple's -- either way i probably wouldn't mix up soundinmac and diskin with anything that is time-critical (loops or otherwise) thanks, matt On Jul 22, 2010, at 2:14 PM, matt ingalls wrote: hi everyone,
i had started making this before i realized there were those new mp3 opcodes
(reading from mp3 was my main objective) but there are some other features in here
that may be useful to you mac users out there (using ANY frontend or commandline)
it's a "soundin" opcode that uses the OSX native soundfile reading routines.
ar1[, ar2[, ar3[, ... a24]]] soundinmac ifilcod [,itransp] [, iskptim] [, iwrap]
it is compiled as a universal 32/64 bit binary i think it should run with any CsoundLib version.
(also included in this library is the "filevalid" opcode but that will go away with next csoundlib release)
i think you might need MacOS 10.5 or later.
let me know how it works for you
thanks,
m@
FEATURES (benefits over existing soundin/diskins)
+ automatic sample rate and channel conversion (# of outputs can be DIFFERENT than # of soundfile channels)
+ transposition may be faster than diskin2's sinc interpolation (if apple is indeed using sinc sr conversion?)
however, soundinmac's transposition input parameter is i-rate only :(
+ reliable, fast file streaming (file i/o is handled in another thread - well technically, with apple's new "dispatch queue" )
+ all file formats supported by the currently running MacOS (including future ones)
i can't find documentation from apple as to what is supported, but it probably is the same as afconvert tool
(scroll to bottom of this text to see list of formats)
TO DOWNLOAD
http://sonomatics.com/libMacCsoundOpcodes.zip
TO INSTALL
either
1) use the -- --opcode-lib=path/libMacCsoundOpcodes.dylib command flag
or
2) put in the /Library/Frameworks/CsoundLib.framework/Versions/5.2/Resources/Opcodes/
directory
or
3) if you use MacCsound, replace the existing dylib in MacCsound's application bundle in Contents/Resources/
(or just wait for the next MacCsound release, in a few days)
DOCUMENTATION
soundinmac
soundinmac — Reads audio data from an external device or stream using native Mac OS functionality.
Description
Reads audio data from an external device or stream. Up to 24 channels may be read.
Syntax
ar1[, ar2[, ar3[, ... a24]]] soundinmac ifilcod [,itransp] [, iskptim] [, iwrap]
Initialization
ifilcod -- integer or character-string denoting the source soundfile name. An integer denotes the file soundin.filcod; a character-string (in double quotes, spaces permitted) gives the filename itself, optionally a full pathname. If not a full path, the named file is sought first in the current directory, then in that given by the environment variable SSDIR (if defined) then by SFDIR. See also GEN01.
itransp (optional, default=0) -- transposition ratio (2 is an octave higher, .5 is an octave lower, etc)
iskptim (optional, default=0) -- time in seconds of input sound to be skipped. The default value is 0.
iwrap (optional, default=0) -- if non-zero, loops to beginning of file once end of file is reached.
Performance
soundinmac is functionally an audio generator that derives its signal from a pre-existing file. Opposed to soundin, the number of output channels do not have to match that of the input file. A soundinmac opcode opens this file whenever the host instrument is initialized, then closes it again each time the instrument is turned off.
There can be any number of soundinmac opcodes within a single instrument or orchestra. Two or more of them can read simultaneously from the same external file.
Example
<CsoundSynthesizer>
<CsInstruments>
nchnls = 2
instr 1
; play a stereo mp3 file an octave higher.
; for demonstration purposes, this example outputs 3 channels
; and uses a skiptime of 20 seconds, with looping on
al, ar, aunused soundinmac "/Users/matt/Music/cecil.mp3", 2, 20, 1
outs al, ar
endin
</CsInstruments>
<CsScore>
i1 0 100
</CsScore>
</CsoundSynthesizer>
SUPPORTED FORMATS (i think)
'3gpp' = 3GP Audio (.3gp)
data_formats: 'aac ' 'samr'
'3gp2' = 3GPP-2 Audio (.3g2)
data_formats: 'aac ' 'samr'
'adts' = AAC ADTS (.aac, .adts)
data_formats: 'aac ' 'aach'
'ac-3' = AC3 (.ac3)
data_formats: 'ac-3'
'AIFC' = AIFC (.aifc, .aiff, .aif)
data_formats: I8 BEI16 BEI24 BEI32 BEF32 BEF64 UI8 'ulaw'
'alaw' 'MAC3' 'MAC6' 'ima4' 'QDMC' 'QDM2'
'Qclp' 'agsm'
'AIFF' = AIFF (.aiff, .aif)
data_formats: I8 BEI16 BEI24 BEI32
'amrf' = AMR (.amr)
data_formats: 'samr'
'caff' = Apple CAF (.caf)
data_formats: '.mp1' '.mp2' '.mp3' 'QDM2' 'QDMC' 'Qclp'
'Qclq' 'aac ' 'aach' 'aacl' 'alac' 'alaw'
'dvi8' 'ilbc' 'ima4' I8 BEI16 BEI24 BEI32
BEF32 BEF64 LEI16 LEI24 LEI32 LEF32 LEF64
'ms\x00\x02' 'ms\x00\x11' 'ms\x001' 'samr'
'ulaw'
'm4af' = Apple MPEG-4 Audio (.m4a)
data_formats: 'aac ' 'aach' 'aacl' 'alac'
'MPG1' = MPEG Layer 1 (.mp1, .mpeg, .mpa)
data_formats: '.mp1'
'MPG2' = MPEG Layer 2 (.mp2, .mpeg, .mpa)
data_formats: '.mp2'
'MPG3' = MPEG Layer 3 (.mp3, .mpeg, .mpa)
data_formats: '.mp3'
'mp4f' = MPEG-4 Audio (.mp4)
data_formats: 'aac ' 'aach' 'aacl'
'NeXT' = NeXT/Sun (.snd, .au)
data_formats: I8 BEI16 BEI24 BEI32 BEF32 BEF64 'ulaw'
'Sd2f' = Sound Designer II (.sd2)
data_formats: I8 BEI16 BEI24 BEI32
'WAVE' = WAVE (.wav)
data_formats: UI8 LEI16 LEI24 LEI32 LEF32 LEF64 'ulaw'
'alaw'
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"
On Oct 31, 2010, at 11:21 AM, Enrico Francioni wrote: but, if you mean as in this example, does not work..., why? <CsoundSynthesizer> <CsInstruments> nchnls = 2 instr caf a1, a2 soundin "test.caf" outs a1, a2 endin </CsInstruments> <CsScore> i"caf" 0 86400 e </CsScore> </CsoundSynthesizer> <MacOptions> Version: 3 Render: Real Ask: Yes Functions: ioObject Listing: ioObject WindowBounds: 2 46 1438 894 CurrentView: orc IOViewEdit: On Options: -b128 -A -s -m167 -R --midi-velocity-amp=4 --midi-key-cps=5 </MacOptions> <MacGUI> ioView nobackground {65535, 65535, 65535} ioListing {10, 10} {350, 500} ioGraph {360, 10} {300, 500} </MacGUI> -- View this message in context: http://csound.1045644.n5.nabble.com/caf-tp3244007p3244250.htmlSent 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=564599Discussions of bugs and features can be posted here To unsubscribe, send email sympa@lists.bath.ac.uk with body "unsubscribe csound"
|