Csound Csound-dev Csound-tekno Search About

[Csnd] load file via function table / ftgen vs soundin

Date2017-10-15 15:13
FromMo Morsi
Subject[Csnd] load file via function table / ftgen vs soundin
Greetings! Long time csound user and mailing-list lurker, first time poster. I apologize if this has been asked before, I tried googling my issue and found a few related threads, but nothing has worked so far.

Long story short, I am unable to load wavfiles via function tables and the ftgen opcode. Loading the same soundfiles via soundin works fine as demonstrated via the following example:


<CsoundSynthesizer>
<CsOptions>
</CsOptions>
<CsInstruments>
sr = 44100
ksmps = 32
nchnls = 2
0dbfs  = 1

instr 1
asig soundin "beats.wav"
endin
</CsInstruments>
<CsScore>
;f1 0 256 1 "beats.wav" 0 0 0
i1 0 0.5
e
</CsScore>
</CsoundSynthesizer>

beats.wav is that found linked in the official csound reference manual. As is, this works 100% on my system. But when I uncomment the "f1 0 256 1 "beats.wav" 0 0 0" line, the result is:

SECTION 1:
ftable 1:
soundin cannot open soundin.0
ftable 1: Failed to open file
f  1     0.00   256.00     1.00     nan ...
new alloc for instr 1:
B  0.000 ..  0.500 T  0.500 TT  0.500 M:  0.00000  0.00000
...


I am running the latest stock csound (version 6.03.2) shipped on Fedora 26+ (Linux).

Has anyone else encountered this issue? Is there a workaround to load audio files into function tables (for use in other opcodes?)

Thank you greatly,
  Mo Morsi


Date2017-10-15 16:05
FromTarmo Johannes
SubjectRe: [Csnd] load file via function table / ftgen vs soundin

Hi,

 

have a look at the table definition:

 

f1 0 256 1 "beats.wav" 0 0 0

 

here 256 is the size of the table, 256 samples being clearly too little to contain an audio file. The most typical use is to keep it 0 and correct size is found automatically.

 

See

http://www.csounds.com/manual/html/GEN01.html

 

like

f 2 0 0 1 "flute.aiff" 0 0 0

 

Maybe there is something else too, by try first to set p3 of the f-line to 0.

 

tarmo

 

 

 

On pühapäev, 15. oktoober 2017 17:13.59 EEST you wrote:

> Greetings! Long time csound user and mailing-list lurker, first time

> poster. I apologize if this has been asked before, I tried googling my

> issue and found a few related threads, but nothing has worked so far.

> Long story short, I am unable to load wavfiles via function tables and

> the ftgen opcode. Loading the same soundfiles via soundin works fine as

> demonstrated via the following example:

>

> <CsoundSynthesizer>

> <CsOptions>

> </CsOptions>

> <CsInstruments>

> sr = 44100

> ksmps = 32

> nchnls = 2

> 0dbfs = 1

>

> instr 1

> asig soundin "beats.wav"

> endin

> </CsInstruments>

> <CsScore>

> ;f1 0 256 1 "beats.wav" 0 0 0

> i1 0 0.5

> e

> </CsScore>

> </CsoundSynthesizer>

>

> beats.wav is that found linked in the official csound reference manual.

> As is, this works 100% on my system. But when I uncomment the "f1 0 256

> 1 "beats.wav" 0 0 0" line, the result is:

> SECTION 1:

> ftable 1:

> soundin cannot open soundin.0

> ftable 1: Failed to open file

> f 1 0.00 256.00 1.00 nan ...

> new alloc for instr 1:

> B 0.000 .. 0.500 T 0.500 TT 0.500 M: 0.00000 0.00000

> ...

>

>

> I am running the latest stock csound (version 6.03.2) shipped on Fedora

> 26+ (Linux).

> Has anyone else encountered this issue? Is there a workaround to load

> audio files into function tables (for use in other opcodes?)

> Thank you greatly,

> Mo Morsi

> http://mo.morsi.org

>

>

> 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

 

 


Date2017-10-15 16:10
Fromjpff
SubjectRe: [Csnd] load file via function table / ftgen vs soundin
Humm,   Works for me on Linux though I agree 256 is way too low for 88200 
samles.

Cannot see how the lengt affects the string being treated as a number 0 
though

Remin me again of the platform.


On Sun, 15 Oct 2017, Tarmo Johannes wrote:

> 
> Hi,
> 
>  
> 
> have a look at the table definition:
> 
>  
> 
> f1 0 256 1 "beats.wav" 0 0 0
> 
>  
> 
> here 256 is the size of the table, 256 samples being clearly too little to
> contain an audio file. The most typical use is to keep it 0 and correct size
> is found automatically.
> 
>  
> 
> See
> 
> http://www.csounds.com/manual/html/GEN01.html
> 
>  
> 
> like
> 
> f 2 0 0 1 "flute.aiff" 0 0 0
> 
>  
> 
> Maybe there is something else too, by try first to set p3 of the f-line to 0.
> 
>  
> 
> tarmo
> 
>  
> 
>  
> 
>  
> 
> On pühapäev, 15. oktoober 2017 17:13.59 EEST you wrote:
> 
> > Greetings! Long time csound user and mailing-list lurker, first time
> 
> > poster. I apologize if this has been asked before, I tried googling my
> 
> > issue and found a few related threads, but nothing has worked so far.
> 
> > Long story short, I am unable to load wavfiles via function tables and
> 
> > the ftgen opcode. Loading the same soundfiles via soundin works fine as
> 
> > demonstrated via the following example:
> 
> >
> 
> > 
> 
> > 
> 
> > 
> 
> > 
> 
> > sr = 44100
> 
> > ksmps = 32
> 
> > nchnls = 2
> 
> > 0dbfs = 1
> 
> >
> 
> > instr 1
> 
> > asig soundin "beats.wav"
> 
> > endin
> 
> > 
> 
> > 
> 
> > ;f1 0 256 1 "beats.wav" 0 0 0
> 
> > i1 0 0.5
> 
> > e
> 
> > 
> 
> > 
> 
> >
> 
> > beats.wav is that found linked in the official csound reference manual.
> 
> > As is, this works 100% on my system. But when I uncomment the "f1 0 256
> 
> > 1 "beats.wav" 0 0 0" line, the result is:
> 
> > SECTION 1:
> 
> > ftable 1:
> 
> > soundin cannot open soundin.0
> 
> > ftable 1: Failed to open file
> 
> > f 1 0.00 256.00 1.00 nan ...
> 
> > new alloc for instr 1:
> 
> > B 0.000 .. 0.500 T 0.500 TT 0.500 M: 0.00000 0.00000
> 
> > ...
> 
> >
> 
> >
> 
> > I am running the latest stock csound (version 6.03.2) shipped on Fedora
> 
> > 26+ (Linux).
> 
> > Has anyone else encountered this issue? Is there a workaround to load
> 
> > audio files into function tables (for use in other opcodes?)
> 
> > Thank you greatly,
> 
> > Mo Morsi
> 
> > http://mo.morsi.org
> 
> >
> 
> >
> 
> > 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

Date2017-10-15 16:17
Fromjpff
SubjectRe: [Csnd] load file via function table / ftgen vs soundin
PS Your example after removing the spurious character after 0dbfs says

SECTION 1:
ftable 1:
audio sr = 44100, monaural
opening WAV infile beats.wav
WARNING: GEN1: aiff file truncated by ftable size
WARNING:        audio samps 88200 exceeds ftsize 256
non-deferred ftable 1 needs size 131072
ftable 1:       256 points, scalemax 1.000

which is odd as it is wav not aiff, but it runs

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

Date2017-10-15 16:22
Fromjpff
SubjectRe: [Csnd] load file via function table / ftgen vs soundin
Just read
> 
> I am running the latest stock csound (version 6.03.2) shipped on Fedora 26+
> (Linux).
>

Wow!  6.03 was in May 2014.  The chance of debugging something that old is 
slim

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

Date2017-10-15 17:13
FromMo Morsi
SubjectRe: [Csnd] load file via function table / ftgen vs soundin
I tried changing 256 to 0 but no such luck, the error still persists.

  -Mo

On Sun, Oct 15, 2017, at 11:05 AM, Tarmo Johannes wrote:

Hi,

 

have a look at the table definition:

 

f1 0 256 1 "beats.wav" 0 0 0

 

here 256 is the size of the table, 256 samples being clearly too little to contain an audio file. The most typical use is to keep it 0 and correct size is found automatically.

 

See

http://www.csounds.com/manual/html/GEN01.html

 

like

f 2 0 0 1 "flute.aiff" 0 0 0

 

Maybe there is something else too, by try first to set p3 of the f-line to 0.

 

tarmo

 

 

 

On pühapäev, 15. oktoober 2017 17:13.59 EEST you wrote:

> Greetings! Long time csound user and mailing-list lurker, first time

> poster. I apologize if this has been asked before, I tried googling my

> issue and found a few related threads, but nothing has worked so far.

> Long story short, I am unable to load wavfiles via function tables and

> the ftgen opcode. Loading the same soundfiles via soundin works fine as

> demonstrated via the following example:

>

> <CsoundSynthesizer>

> <CsOptions>

> </CsOptions>

> <CsInstruments>

> sr = 44100

> ksmps = 32

> nchnls = 2

> 0dbfs = 1

>

> instr 1

> asig soundin "beats.wav"

> endin

> </CsInstruments>

> <CsScore>

> ;f1 0 256 1 "beats.wav" 0 0 0

> i1 0 0.5

> e

> </CsScore>

> </CsoundSynthesizer>

>

> beats.wav is that found linked in the official csound reference manual.

> As is, this works 100% on my system. But when I uncomment the "f1 0 256

> 1 "beats.wav" 0 0 0" line, the result is:

> SECTION 1:

> ftable 1:

> soundin cannot open soundin.0

> ftable 1: Failed to open file

> f 1 0.00 256.00 1.00 nan ...

> new alloc for instr 1:

> B 0.000 .. 0.500 T 0.500 TT 0.500 M: 0.00000 0.00000

> ...

>

>

> I am running the latest stock csound (version 6.03.2) shipped on Fedora

> 26+ (Linux).

> Has anyone else encountered this issue? Is there a workaround to load

> audio files into function tables (for use in other opcodes?)

> Thank you greatly,

> Mo Morsi

> http://mo.morsi.org

>

>

> 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 listCsound@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


Date2017-10-15 17:15
FromMo Morsi
SubjectRe: [Csnd] load file via function table / ftgen vs soundin
I think this was a copy-and-paste artifact, it does not appear in my
local source

  -Mo

On Sun, Oct 15, 2017, at 11:17 AM, jpff wrote:
> PS Your example after removing the spurious character after 0dbfs says
> 
> SECTION 1:
> ftable 1:
> audio sr = 44100, monaural
> opening WAV infile beats.wav
> WARNING: GEN1: aiff file truncated by ftable size
> WARNING:        audio samps 88200 exceeds ftsize 256
> non-deferred ftable 1 needs size 131072
> ftable 1:       256 points, scalemax 1.000
> 
> which is odd as it is wav not aiff, but it runs
> 

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

Date2017-10-15 17:17
FromMo Morsi
SubjectRe: [Csnd] load file via function table / ftgen vs soundin
I agree, I'm thinking the old version is the culprit.  Since I'm running
the packaged csound, figure I'd ask to see if it was a know issue before
running through the compilation process. But I will do that next and
with any luck this will resolve that issue

Thanks for all the info / help!

  -Mo


On Sun, Oct 15, 2017, at 11:22 AM, jpff wrote:
> Just read
> > 
> > I am running the latest stock csound (version 6.03.2) shipped on Fedora 26+
> > (Linux).
> >
> 
> Wow!  6.03 was in May 2014.  The chance of debugging something that old
> is 
> slim
> 
> 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

Date2017-10-20 09:44
FromMo Morsi
SubjectRe: [Csnd] load file via function table / ftgen vs soundin
Just to follow up, I built the latest version of csound 6.10 on my
Fedora setup and confirmed that this issue was no longer present.

Thanks for the help!

---

On Sun, Oct 15, 2017, at 12:17 PM, Mo Morsi wrote:
> I agree, I'm thinking the old version is the culprit.  Since I'm running
> the packaged csound, figure I'd ask to see if it was a know issue before
> running through the compilation process. But I will do that next and
> with any luck this will resolve that issue
> 
> Thanks for all the info / help!
> 
>   -Mo
> 
> 
> On Sun, Oct 15, 2017, at 11:22 AM, jpff wrote:
> > Just read
> > > 
> > > I am running the latest stock csound (version 6.03.2) shipped on Fedora 26+
> > > (Linux).
> > >
> > 
> > Wow!  6.03 was in May 2014.  The chance of debugging something that old
> > is 
> > slim
> > 
> > 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