{"id":6922,"date":"2014-05-11T17:45:33","date_gmt":"2014-05-11T17:45:33","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/05\/11\/libgdx-error-creating-music-collection-of-common-programming-errors\/"},"modified":"2014-05-11T17:45:33","modified_gmt":"2014-05-11T17:45:33","slug":"libgdx-error-creating-music-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/05\/11\/libgdx-error-creating-music-collection-of-common-programming-errors\/","title":{"rendered":"LIBGDX &#8211; Error creating music-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m attempting to simply load a Music asset using libgdx, and this is what I have:<\/p>\n<pre><code>Music main_background;\nmain_background = Gdx.audio.newMusic(Gdx.files.internal(\"data\/music\/main_bg.wav\"));\n<\/code><\/pre>\n<p>This code is exactly the same code as they have in the small tutorial of &#8220;Making a game&#8221; with libgdx, and I&#8217;m trying to load my own sound that I have made (Using GarageBand, in case that matters). Whenever I try running this as a Desktop application, I get a bunch of errors:<\/p>\n<blockquote>\n<p>Exception in thread &#8220;LWJGL Application&#8221; com.badlogic.gdx.utils.GdxRuntimeException: Error creating music com.badlogic.gdx.backends.openal.Wav$Music for file: data\/music\/main_bg.wav<\/p>\n<p>Caused by: java.lang.reflect.InvocationTargetException<\/p>\n<p>Caused by: com.badlogic.gdx.utils.GdxRuntimeException: Error reading WAV file: data\/music\/main_bg.wav<\/p>\n<p>Caused by: com.badlogic.gdx.utils.GdxRuntimeException: RIFF header not found: data\/music\/main_bg.wav<\/p>\n<\/blockquote>\n<p>I&#8217;m not sure what the problem could be, because the audio file isn&#8217;t corrupt (because I can listen to it perfectly fine) yet I can&#8217;t find information anywhere about people getting this type of error when loading an asset.<\/p>\n<p>I have a bunch of Texture&#8217;s loaded just fine, but for some unknown reason I can&#8217;t load a Music asset (and for the record, I tried loading the same file as a Sound asset and get essentially the same error).<\/p>\n<p>Has anyone come across this before or have any ideas on what could be wrong?<\/p>\n<p>EDIT: I should mention I also get this error if I try loading an mp3 or ogg file as well, it doesn&#8217;t just happen with a wav<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m attempting to simply load a Music asset using libgdx, and this is what I have: Music main_background; main_background = Gdx.audio.newMusic(Gdx.files.internal(&#8220;data\/music\/main_bg.wav&#8221;)); This code is exactly the same code as they have in the small tutorial of &#8220;Making a game&#8221; with libgdx, and I&#8217;m trying to load my own sound that I have made (Using GarageBand, [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6922","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6922","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=6922"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/6922\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=6922"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=6922"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=6922"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}