Csound Csound-dev Csound-tekno Search About

simple file playback

Date2016-04-21 22:19
FromMichael Mossey
Subjectsimple file playback
My goal is to play back a sound file from the command line on Windows. Perhaps a simple csound csd is the way to do this. Or is there an existing utility for it?

I tried using the csd below. Two problems:

(1) it sounds like the file is being played back at the wrong sample rate (too fast). This same file sounds fine in Windows Media Player or VLC.

(2) I don't know how to make instrument 1's duration exactly equal to the duration of the soundfile.


<CsoundSynthesizer>

<CsOptions>
; desktop:
;   dac1 is realtek digital optical output
;   M3  is internal midi pipe 03
;
; laptop:
;   dac7 is iFi driver (the one that works)
;   M2  is internal midi input 03
;  
; -+rtmidi=virtual is virtual midi keyboard
-odac3

</CsOptions>

<CsInstruments>

sr     = 44100
kr     = 44100
ksmps  = 1
nchnls = 2

instr 1
  ainL init 0
  ainR init 0

  fin "\\Users\\Mike\\out.aif", 0, 1, ainL, ainR

  outs ainL, ainR

endin

</CsInstruments>

<CsScore>

i1 0 10

</CsScore>

</CsoundSynthesizer>

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2016-04-21 23:33
FromJohn
SubjectRe: simple file playback

Use diskin2 and flen to set p3.  With Dr conversion with more thought....

Sent from TypeApp

On 21 Apr 2016, at 22:19, Michael Mossey <michaelmossey@GMAIL.COM> wrote:
My goal is to play back a sound file from the command line on Windows. Perhaps a simple csound csd is the way to do this. Or is there an existing utility for it?

I tried using the csd below. Two problems:

(1) it sounds like the file is being played back at the wrong sample rate (too fast). This same file sounds fine in Windows Media Player or VLC.

(2) I don't know how to make instrument 1's duration exactly equal to the duration of the soundfile.


<CsoundSynthesizer>

<CsOptions>
; desktop:
;   dac1 is realtek digital optical output
;   M3  is internal midi pipe 03
;
; laptop:
;   dac7 is iFi driver (the one that works)
;   M2  is internal midi input 03
;  
; -+rtmidi=virtual is virtual midi keyboard
-odac3

</CsOptions>

<CsInstruments>

sr     = 44100
kr     = 44100
ksmps  = 1
nchnls = 2

instr 1
  ainL init 0
  ainR init 0

  fin "\\Users\\Mike\\out.aif", 0, 1, ainL, ainR

  outs ainL, ainR

endin

</CsInstruments>

<CsScore>

i1 0 10

</CsScore>

</CsoundSynthesizer>

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2016-04-22 10:33
FromRory Walsh
SubjectRe: simple file playback
<CsInstruments>

sr     = 44100
kr     = 44100
ksmps  = 1
nchnls = 2

instr 1
iLen filelen "soundfile.wav"
iChans filenchnls "soundfile.wav"
p3 = iLen
if iChans == 1 then
a1 diskin2 "soundfile.wav"
outs a1, a1
else
a1, a2 diskin2 "soundfile.wav"
outs a1, a2
endif
endin

</CsInstruments>
<CsScore>
i1 0 1
</CsScore>

You could also pass the soundfile to the instrument using --macro

On 21 April 2016 at 23:33, John <jpff@codemist.co.uk> wrote:

Use diskin2 and flen to set p3.  With Dr conversion with more thought....

Sent from TypeApp

On 21 Apr 2016, at 22:19, Michael Mossey <michaelmossey@GMAIL.COM> wrote:
My goal is to play back a sound file from the command line on Windows. Perhaps a simple csound csd is the way to do this. Or is there an existing utility for it?

I tried using the csd below. Two problems:

(1) it sounds like the file is being played back at the wrong sample rate (too fast). This same file sounds fine in Windows Media Player or VLC.

(2) I don't know how to make instrument 1's duration exactly equal to the duration of the soundfile.


<CsoundSynthesizer>

<CsOptions>
; desktop:
;   dac1 is realtek digital optical output
;   M3  is internal midi pipe 03
;
; laptop:
;   dac7 is iFi driver (the one that works)
;   M2  is internal midi input 03
;  
; -+rtmidi=virtual is virtual midi keyboard
-odac3

</CsOptions>

<CsInstruments>

sr     = 44100
kr     = 44100
ksmps  = 1
nchnls = 2

instr 1
  ainL init 0
  ainR init 0

  fin "\\Users\\Mike\\out.aif", 0, 1, ainL, ainR

  outs ainL, ainR

endin

</CsInstruments>

<CsScore>

i1 0 10

</CsScore>

</CsoundSynthesizer>

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Date2016-04-22 10:38
FromVictor Lazzarini
SubjectRe: simple file playback
you might just be able to use arrays, eliminates the need to check for channels

instr 1
asig[] diskin  ...
out asig[]
endin


Victor Lazzarini
Dean of Arts, Celtic Studies, and Philosophy
Maynooth University
Ireland

On 22 Apr 2016, at 10:33, Rory Walsh <rorywalsh@EAR.IE> wrote:

<CsInstruments>

sr     = 44100
kr     = 44100
ksmps  = 1
nchnls = 2

instr 1
iLen filelen "soundfile.wav"
iChans filenchnls "soundfile.wav"
p3 = iLen
if iChans == 1 then
a1 diskin2 "soundfile.wav"
outs a1, a1
else
a1, a2 diskin2 "soundfile.wav"
outs a1, a2
endif
endin

</CsInstruments>
<CsScore>
i1 0 1
</CsScore>

You could also pass the soundfile to the instrument using --macro

On 21 April 2016 at 23:33, John <jpff@codemist.co.uk> wrote:

Use diskin2 and flen to set p3.  With Dr conversion with more thought....

Sent from TypeApp

On 21 Apr 2016, at 22:19, Michael Mossey <michaelmossey@GMAIL.COM> wrote:
My goal is to play back a sound file from the command line on Windows. Perhaps a simple csound csd is the way to do this. Or is there an existing utility for it?

I tried using the csd below. Two problems:

(1) it sounds like the file is being played back at the wrong sample rate (too fast). This same file sounds fine in Windows Media Player or VLC.

(2) I don't know how to make instrument 1's duration exactly equal to the duration of the soundfile.


<CsoundSynthesizer>

<CsOptions>
; desktop:
;   dac1 is realtek digital optical output
;   M3  is internal midi pipe 03
;
; laptop:
;   dac7 is iFi driver (the one that works)
;   M2  is internal midi input 03
;  
; -+rtmidi=virtual is virtual midi keyboard
-odac3

</CsOptions>

<CsInstruments>

sr     = 44100
kr     = 44100
ksmps  = 1
nchnls = 2

instr 1
  ainL init 0
  ainR init 0

  fin "\\Users\\Mike\\out.aif", 0, 1, ainL, ainR

  outs ainL, ainR

endin

</CsInstruments>

<CsScore>

i1 0 10

</CsScore>

</CsoundSynthesizer>

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here
Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here

Csound mailing list Csound@listserv.heanet.ie https://listserv.heanet.ie/cgi-bin/wa?A0=CSOUND Send bugs reports to https://github.com/csound/csound/issues Discussions of bugs and features can be posted here