double

Importing a .wav file in c# and extracting the signal an array of doubles

北慕城南 提交于 2019-12-24 10:52:09
问题 I'm doing a project on audio signal processing and I need to import a wav file in c# and extract an array of doubles or floats that contains the signal data. Most of the tutorials for audio libraries I've found don't seem to do stuff this low-level. Any help would be appreciated, thanks. 回答1: http://www.codeproject.com/KB/audio-video/PlayWavFiles.aspx this site helped me, but the .exe file became very large due to the imported wav files. So sending the project via email will be a problem. :)

Find the average within variable number of doubles

自古美人都是妖i 提交于 2019-12-24 10:48:07
问题 I have an ArrayList of doubles, and i need to find the average between all numbers. The amount of Double instances in the arraylist is not constant, could be 2, could be 90 I have been trying for hours to get the algorithm myself but could not get it to work in anyway. do you have any advice? or maybe you can link me to an existing library to get this average? Thank you 回答1: Create a sum variable: double sum = 0; Go through the elements in the list using a for-loop: for (double d : yourList)

Android app installed is double the size of the apk

独自空忆成欢 提交于 2019-12-24 10:46:51
问题 I upgraded my Eclipse ADT tools to r20 (from r17 or so) and now the applications installed on the devices use twice the size of the apk. The app itself is running fine. This happens for both the release and the debug versions, and whether I generate the apk with ant (and install thru usb) or launch the app from eclipse. I tried with various target versions but it's always the same thing. For info - I do not use "copy protection" nor licensing, this is direct install, not thru the play store.

LINQ to Entities does not recognize the method Double Round(Double, Int32, System.MidpointRounding) method

大兔子大兔子 提交于 2019-12-24 10:44:34
问题 I've tried the below LINQ Query in Linqer it is working fine but it is giving the below error while i tried with C# from IHeal_Mnt_Tickets in iHealEntities.iHeal_Mnt_Tickets where Tickets.Active == 1 && Tickets.MntID == 1 && Tickets.InsertedOn >= fromdate && Mnt_Tickets.InsertedOn <= todate && (new string[] { "Resolved", "Assigned" }).Contains(Tickets.status) group Tickets by new { Tickets.Instance } into g select new { Instance = g.Key.Summus_Instance, Assigned = (Int64?)g.Count(p => p

Float and Double for monetary values

拈花ヽ惹草 提交于 2019-12-24 10:42:11
问题 I have experimented what is wrong with float and double types, in Java System.out.print(1-.6) prints .4 and the result is a bit unexpected (0.30000000000000004) in case of System.out.print(1-.7). It would be helpful if anyone is able to direct me towards some resources that explain WHY does it happen. I am assuming its not Java specific its something inherently wrong with these types. Thanks! 回答1: The real types in Java are implementations of IEEE754 single and double precision floating point

Java: Format double with decimals

岁酱吖の 提交于 2019-12-24 09:49:12
问题 In Objective C I have been using this code to format a value so that a value with zero decimals will be written without decimals and a value with decimals will be written with one decimal: CGFloat value = 1.5; return [NSString stringWithFormat:@"%.*f",(value != floor(value)),value]; //If value == 1.5 the output will be 1.5 //If value == 1.0 the output will be 1 I need to do the same thing for a double value in Java, I tried the following but that is not working: return String.format("%.*f",

Java string to double conversion

微笑、不失礼 提交于 2019-12-24 09:31:04
问题 I've been reading up on the net about the issues with handling float and double types in java. Unfortunately, the image is still not clear. Hence, i'm asking here direct. :( My MySQL table has various DECIMAL(m,d) columns. The m may range from 5 to 30. d stays a constant at 2. Question 1. What equivalent data-type should i be using in Java to work (i.e store, retrieve, and process) with the size of the values in my table? (I've settled with double - hence this post). Question 2. While trying

string parsing to double fails in C++

别等时光非礼了梦想. 提交于 2019-12-24 09:12:41
问题 Here's a fun one I've been trying to figure out. I have the following program: #include <iostream> #include <string> #include <sstream> using namespace std; int main(int argc, char *argv[]) { string s("5"); istringstream stream(s); double theValue; stream >> theValue; cout << theValue << endl; cout << stream.fail(); } The output is: 0 1 I don't understand why this is failing. Could somebody please tell me what I'm doing wrong? Thanks, helixed EDIT: Okay, sorry to turn this into a double post,

how to set two x axis and two y axis using ggplot2

孤街浪徒 提交于 2019-12-24 08:57:02
问题 My data looks like this: d <- data.frame(X=c('x1','x2','x3','x1','x2','x3','x1','x2','x3'), Y=c('y1','y1','y1','y2','y2','y2','y3','y3','y3'), Value=c(1,2,1,3,1,4,3,5,2)) I use the following code to generate a heat map: ggplot(d,aes(x=X,y=Y,fill=Value)) + geom_tile() + scale_fill_gradient2(low='green',mid='white',high='red',midpoint=3) + theme(axis.text.x = element_text(angle = 90), axis.text = element_text(size = 10), panel.background = element_blank()) + labs(x='',y='') The graph is: But,

Java doesn't seem to be comparing Doubles right

百般思念 提交于 2019-12-24 07:35:35
问题 I created a Linked List, with insert, search and remove functions. I also created a iterator for it. Now, suppose I do this: myList<Integer> test = new myList(); test.insert(30); test.insert(20); test.insert(10); myList.iterator it = test.search(20); if(it.hasNext()) System.out.println(it.next()); And voila, it works (it prints the value of the element at the node, in this case 20). Now, if I do this: myList<Double> test = new myList(); test.insert(30.1); test.insert(20.1); test.insert(10.1);