After extensive research into the subject I have reached a brick wall.  All I want to do is add a collection of .wav files into a byte array, one after another, and output them all into one complete newly created .wav file. I extract all the .wav data into a byte array, skipping the .wav header and going straight for the data, then when it comes to writing it to the newly created .wav file I get an error like:  Error1: javax.sound.sampled.UnsupportedAudioFileException: could not get audio input stream from input stream Error2: could not get audio input stream from input stream  The code is:      try     {     String path = "*********";     String path2 = path + "newFile.wav";      File filePath = new File(path);     File NewfilePath = new File(path2);      String [] folderContent = filePath.list();      int FileSize =  0;      for(int i = 0; i &lt; folderContent.length; i++)         {             RandomAccessFile raf = new RandomAccessFile(path + folderContent[i], "r");             FileSize = FileSize + (int)raf.length();          }      byte[] FileBytes = new byte[FileSize];      for(int i = 0; i &lt; folderContent.length; i++)         {             RandomAccessFile raf = new RandomAccessFile(path + folderContent[i], "r");             raf.skipBytes(44);             raf.read(FileBytes);             raf.close();          }      boolean success = NewfilePath.createNewFile();      InputStream byteArray = new ByteArrayInputStream(FileBytes);      AudioInputStream ais = AudioSystem.getAudioInputStream(byteArray);      AudioSystem.write(ais, Type.WAVE, NewfilePath);      }
Given an InputStream called in which contains audio data in a compressed format (such as MP3 or OGG), I wish to create a byte array containing a WAV conversion of the input data. Unfortunately, if you try to do this, JavaSound hands you the following error:  java.io.IOException: stream length not specified   I managed to get it to work by writing the wav to a temporary file, then reading it back in, as shown below:  AudioInputStream source = AudioSystem.getAudioInputStream(new BufferedInputStream(in, 1024)); AudioInputStream pcm = AudioSystem.getAudioInputStream(AudioFormat.Encoding.PCM_SIGNED, source); AudioInputStream ulaw = AudioSystem.getAudioInputStream(AudioFormat.Encoding.ULAW, pcm); File tempFile = File.createTempFile("wav", "tmp"); AudioSystem.write(ulaw, AudioFileFormat.Type.WAVE, tempFile); // The fileToByteArray() method reads the file // into a byte array; omitted for brevity byte[] bytes = fileToByteArray(tempFile); tempFile.delete(); return bytes;   This is obviously less desirable. Is there a better way?
I have to prove this : "$n^7-n$ is a multiple of 7". This is what I have done this so far :  $P(n):n^7-n$ On putting $n=1,$ $P(1):1^7-1=0$, which is a multiple of 7. So, $P(1)$ is true. Let $P(k)$ be a multiple of 7. So, $k^7-k$ is a multiple of 7. So, $k^7-k=7m$, where $m$ is any natural number. Let $P(k+1)$ be true, Hence, $(k+1)^7-(k+1)$ is a multiple of 7.  Now, how do I evaluate $(k+1)^7$ without using the binomial theorem ? Or is there some other way to do it ? Closing Reject Suggested Edit dialogue freezes review process I've had an issue for a while now which makes my Alt + Tab not work and function correctly.  I can't:   Click on it It displays items which are supposed to be hidden (?) It doesn't use the Aero theme   I've tried the following:   Rebooting Closing dwm.exe Updating Windows.   If there is a need for OS: I'm running Win 8.1 x64.  Example: Does it mean that two threads can't change the underlying data simultaneously? Or does it mean that the given code segment will run with predictable results when multiple threads are executing that code segment? C++ copy-construct construct-and-assign question Why didn't Thanos come to Earth to retrieve Tesseract by himself? In the Avengers movie, why didn't Thanos personally come to Earth instead of Loki? Or, if Loki's skills were required, why didn't he come with Chitauri? He knew that humans were primitive; there wouldn't be any threat and he could personally secure Tesseract.  AFAIK, the movie didn't display much. Is there any other source answering this? I am a relatively recent graphic design graduate. I have been working at a small printing house for about two years, but will soon be interviewing for a different position in another city.  My question is about what to include in my design portfolio. When I was in school, my professors all insisted that work included in a portfolio should be 100% original: my original photography, my original logos, my original layout, my original written content etc. However, at my current office, we rely heavily on client-supplied logos, type content, and photography—and stock photography (shutterstock, etc).  What do other designers include in their portfolios? Has anyone else had this issue and can I reasonable include these more recent projects in my portfolio if I label them appropriately (something like "layout design")? Application launchers in '/usr/share/applications' not working in Nautilus Graph Proof by induction. Can you prove via induction that there exists a node in a directed graph of n nodes that can be reached in at most two edges from every other node in the graph. Every node in the graph is required to have an edge with every other node that either points out or in (For every pair of nodes X and Y, either X points to Y or Y points to X). What's the difference between an inverter with a bubble at the input and one with a bubble at the output? See , page 2: the internal logic diagram for the MM74HC138.    The diagram shows logic inverters with bubbles at the input or at the output. Is there an actual difference between them? Zsh says "no matches found" when trying to download video with youtube-dl I downloaded youtube-dl using pip on CrunchBang (a Debian Wheezy distro). When I run   youtube-dl {video URL}   I get  zsh: no matches found: {video URL}   I guess it has something to do with zsh, because I found some users on Arch forums complaining about it. When I switched to bash it worked. I have this new problem since 2014 begin. I cant remotely login to this enterprise network for giving them support. Its keep showing this new error.  How to fix it please?    EDIT: Is there a simple way to flatten a list of iterables with a list comprehension, or failing that, what would you all consider to be the best way to flatten a shallow list like this, balancing performance and readability?  I tried to flatten such a list with a nested list comprehension, like this:  [image for image in menuitem for menuitem in list_of_menuitems]   But I get in trouble of the NameError variety there, because the name 'menuitem' is not defined.  After googling and looking around on Stack Overflow, I got the desired results with a reduce statement:  reduce(list.__add__, map(lambda x: list(x), list_of_menuitems))   But this method is fairly unreadable because I need that list(x) call there because x is a Django QuerySet object.  Conclusion:   Thanks to everyone who contributed to this question.  Here is a summary of what I learned.  I'm also making this a community wiki in case others want to add to or correct these observations.  My original reduce statement is redundant and is better written this way:  &gt;&gt;&gt; reduce(list.__add__, (list(mi) for mi in list_of_menuitems))   This is the correct syntax for a nested list comprehension (Brilliant summary !):  &gt;&gt;&gt; [image for mi in list_of_menuitems for image in mi]   But neither of these methods are as efficient as using itertools.chain:  &gt;&gt;&gt; from itertools import chain &gt;&gt;&gt; list(chain(*list_of_menuitems))   And as @cdleary notes, it's probably better style to avoid * operator magic by using chain.from_iterable like so:  &gt;&gt;&gt; chain = itertools.chain.from_iterable([[1,2],[3],[5,89],[],[6]]) &gt;&gt;&gt; print(list(chain)) &gt;&gt;&gt; [1, 2, 3, 5, 89, 6] Is there a built-in function to print all the current properties and values of an object? So what I'm looking for here is something like PHP's  function.  This is so I can debug my scripts by seeing what's the state of the object in question. proof of binomial identity involving double sum Every countably generated sigma algebra is generated by a random variable How do I set a user environment variable? (permanently, not session) This is irritating me. I seen several suggestions (all using different files and syntax) and none of them worked.  How do I set an environment variable for a specific user? I am on debian squeeze. What is the exact syntax I should put in the file to make ABC = "123"? Turning fullscreen on made Minecraft crash, and now it crashes on start every time I switched to full screen on minecraft, the screen turned black as if it were loading it took a while so i closed minecraft and reopened it. When I logged on it gave me a program on my taskbar saying "minecraft minecraft" then when i closed the program it gave me this error message:   java(tm) platform SE binary has stopped working.    Is there a way to fix this? Tips and resources for beginning designers Thanks to the internet, graphic design and programming are becoming increasingly overlapping fields.   As a programmer, I constantly find myself needing basic knowledge of Graphic Design, but have trouble locating thorough yet concise graphic design learning resources, and instead usually find bits and pieces of knowledge applicable to the task at hand.  Can you guys offer some tips or recommend some good books, tutorials, blogs, and websites which provide a beginner level overview of web design that have been, in your experience, effective and high quality learning materials. I'm not looking for tips on how to use image editing tools, but assuming a basic grasp of those, which resources and advice will best help a new designer create professional looking designs? mysql_fetch_array does not retrieve all rows