# Wave format not recognized on Windows

**URL:** <https://forum.csound.com/t/wave-format-not-recognized-on-windows/2446>\
**Category:** Newbies\
**Created:** [March 20, 2026, 3:14am UTC](https://forum.csound.com/t/wave-format-not-recognized-on-windows/2446 "2026-03-20T03:14:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![wavesinaroom](https://forum.csound.com/letter_avatar_proxy/v4/letter/w/d2c977/32.png) [@wavesinaroom](https://forum.csound.com/u/wavesinaroom)\
**Post date:** [March 20, 2026, 3:14am UTC](https://forum.csound.com/t/wave-format-not-recognized-on-windows/2446/1 "2026-03-20T03:14:44Z")

</div>

I’ve been trying to play a sample with CSound without a frontend in multiple ways but failed. The output says this:

```nohighlight
INIT ERROR in instr 1 (opcode diskin) line 16: diskin2: samples/snaredrum
.wav: failed to open file: Format not recognised.
 from file .\main.csd (1),aRead diskin "samples/snaredrum.wav" kSpeed i
Skip iLoop 0 0 0 0 0
          B 0.000 - note deleted. i1 (snare) had 0 init errors

```

I downloaded or played different wave and ogg files but I get the same result. Also, I copied the exact code from different tutorial but same luck. I even install Cabbage and open my csd file and still didn’t get anything. This is my code taken from the official tutorial.

```csound
<CsoundSynthesizer>
<CsOptions>
-odac --env:SSDIR+=samples
</CsOptions>
<CsInstruments>

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

instr snare
 kSpeed = p4
 iSkip = p5
 iLoop = p6
 aRead[] diskin "samples/snaredrum.wav", kSpeed, iSkip, iLoop
out aRead[0], aRead[0]
endin

</CsInstruments>
<CsScore>
i "snare" 0 2 1
</CsScore>
</CsoundSynthesizer>

```

I’m currently coding inside WSL NixOs although I run `csound.exe` from powershell to avoid setting up a pulseaudio server on Windows which is frankly a pain in the back.

Why I know this is related to samples only? Because I succesfully played a note from the `osc` opcode so it has to do with samples.

Can anyone lend me a hand on this please?

---

<div class="post-metadata">

**Author:** ![rory](https://forum.csound.com/user_avatar/forum.csound.com/rory/32/7_2.png) [@rory](https://forum.csound.com/u/rory)\
**Post date:** [March 20, 2026, 9:43am UTC](https://forum.csound.com/t/wave-format-not-recognized-on-windows/2446/2 "2026-03-20T09:43:29Z")

</div>

I’m wondering if the wav error is a red herring, perhaps Csound just can’t find the actual file. Can you try passing the absolute path?

---

<div class="post-metadata">

**Author:** ![wavesinaroom](https://forum.csound.com/letter_avatar_proxy/v4/letter/w/d2c977/32.png) [@wavesinaroom](https://forum.csound.com/u/wavesinaroom)\
**Post date:** [March 20, 2026, 4:02pm UTC](https://forum.csound.com/t/wave-format-not-recognized-on-windows/2446/3 "2026-03-20T16:02:47Z")

</div>

Thanks for taking time!

Yeah I feel the same, maybe csound can’t find my file. I’ll be trying to pass the absolute path and get back to you in few hours

---

<div class="post-metadata">

**Author:** ![wavesinaroom](https://forum.csound.com/letter_avatar_proxy/v4/letter/w/d2c977/32.png) [@wavesinaroom](https://forum.csound.com/u/wavesinaroom)\
**Post date:** [March 21, 2026, 2:40am UTC](https://forum.csound.com/t/wave-format-not-recognized-on-windows/2446/4 "2026-03-21T02:40:47Z")

</div>

Alright, I’m back with some progress.

I found [this question](https://forum.cabbageaudio.com/t/potential-breaking-change-with-paths-in-csound/3491) on another forum after doing a bit of research to find a way to print out my sample path.

```csound
<CsoundSynthesizer>
<CsOptions>
-odac 
</CsOptions>
<CsInstruments>

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

opcode getFullPath, S,S
    SFile xin
    xout sprintf("%s/%s", chnget:S("CSD_PATH"), SFile)
endop
instr snare
    a1, a2 diskin2 getFullPath("samples/snaredrum.wav"), 1, 0, 1
    outs a1, a2
endin

</CsInstruments>
<CsScore>
i "snare" 0 2 1
</CsScore>
</CsoundSynthesizer>

```

Now CSound complains with an failed to open file

```nohighlight
INIT ERROR in instr 1 (opcode diskin2) line 17: diskin2: /samples/snaredrum.wav: failed to open file (No Error.)

```

I wish there was a more descriptive error log to describe why my sample file can’t be opened.

Is there a way to get a clearer output from my error on CSound?

---

<div class="post-metadata">

**Author:** ![wavesinaroom](https://forum.csound.com/letter_avatar_proxy/v4/letter/w/d2c977/32.png) [@wavesinaroom](https://forum.csound.com/u/wavesinaroom)\
**Post date:** [March 21, 2026, 3:03am UTC](https://forum.csound.com/t/wave-format-not-recognized-on-windows/2446/5 "2026-03-21T03:03:40Z")

</div>

I’ve just tried something different:

```csound
instr snare
    iCnt int 0
    SFilenames[] directory "samples"
    iNumberOfFiles lenarray SFilenames

    until iCnt>=iNumberOfFiles do
        printf_i "Filename = %s \n", 1, SFilenames[iCnt]
        iCnt = iCnt+1
    od
endin

```

This code actually outputs files on `samples` folder

```csound
Filename = samples\.
Filename = samples\..
Filename = samples\hihats.wav
Filename = samples\kick_drum.wav
Filename = samples\kick_o.ogg
Filename = samples\snaredrum.wav

```

So paths are fine, I’m gonna find another opcode for file names that can give me more clues on why I can’t open a file

---

<div class="post-metadata">

**Author:** ![joachim](https://forum.csound.com/letter_avatar_proxy/v4/letter/j/a87d85/32.png) [@joachim](https://forum.csound.com/u/joachim)\
**Post date:** [March 21, 2026, 9:37pm UTC](https://forum.csound.com/t/wave-format-not-recognized-on-windows/2446/6 "2026-03-21T21:37:58Z")

</div>

i have some ideas / questions:

1. your output always uses the backslash. did you try to use backslash  
in your own code, instead of slash?
2. can you play the sound files with another application?
3. did you install csound with libsndfile? actually when you use a  
normal installer, it should be included.
4. instead of using diskin, you can also try to load your .wav into a  
function table via GEN01, just to see if there is the same issue. you  
can try this code in the global space (outside any instrument):  
gitable ftgen 0,0,0,1,“samples/snaredrum.wav”,0,0,1

joachim

---

<div class="post-metadata">

**Author:** ![wavesinaroom](https://forum.csound.com/letter_avatar_proxy/v4/letter/w/d2c977/32.png) [@wavesinaroom](https://forum.csound.com/u/wavesinaroom)\
**Post date:** [March 21, 2026, 11:43pm UTC](https://forum.csound.com/t/wave-format-not-recognized-on-windows/2446/7 "2026-03-21T23:43:53Z")

</div>

Thanks for taking time!

1. My output has backslashes because I’m running csound from powershell. To get sound out from Windows Subsytem Linux I would have to use routing in a weird way that never worked for me ☹

2. Bingo! That was the problem. For some reason I believed that my file was ok, it actually wasn’t though.

3. I installed csound with the normal installer so it had to include lbsndfile

4. Thanks! I tried to do that with my “snaredrum.wav” sample (corrupted file) so I had the same output. Code is right sample is not

Key lesson here is to check sample file first before working with them. I did a lot of things before doing that. One of them was to install csound on my desktop computer.

Your [example](https://flossmanual.csound.com/samples/record-and-play-soundfiles) was really useful as well 🙂 thanks for that Joachim

Have a good one 🙂

---

<div class="post-metadata">

**Author:** ![joachim](https://forum.csound.com/letter_avatar_proxy/v4/letter/j/a87d85/32.png) [@joachim](https://forum.csound.com/u/joachim)\
**Post date:** [March 22, 2026, 7:43pm UTC](https://forum.csound.com/t/wave-format-not-recognized-on-windows/2446/8 "2026-03-22T19:43:18Z")

</div>

glad to know you could figure out the reason, and thanks for the  
feedback to the example!
